aidan           Thu Sep  9 08:49:36 2004 EDT

  Modified files:              
    /phpdoc/en/security database.xml 
  Log:
  Used non-deprecated functions, thanks nocturnal
  
http://cvs.php.net/diff.php/phpdoc/en/security/database.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/security/database.xml
diff -u phpdoc/en/security/database.xml:1.6 phpdoc/en/security/database.xml:1.7
--- phpdoc/en/security/database.xml:1.6 Thu Aug 12 21:00:48 2004
+++ phpdoc/en/security/database.xml     Thu Sep  9 08:49:33 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
 <!-- splitted from ./index.xml, last change in rev 1.66 -->
   <chapter id="security.database">
    <title>Database Security</title>
@@ -122,18 +122,17 @@
 // storing password hash
 $query  = sprintf("INSERT INTO users(name,pwd) VALUES('%s','%s');",
             addslashes($username), md5($password));
-$result = pg_exec($connection, $query);
+$result = pg_query($connection, $query);
 
 // querying if user submitted the right password
 $query = sprintf("SELECT 1 FROM users WHERE name='%s' AND pwd='%s';",
             addslashes($username), md5($password));
-$result = pg_exec($connection, $query);
+$result = pg_query($connection, $query);
 
-if (pg_numrows($result) > 0) {
-    echo "Welcome, $username!";
-}
-else {
-    echo "Authentication failed for $username.";
+if (pg_num_rows($result) > 0) {
+    echo 'Welcome, $username!';
+} else {
+    echo 'Authentication failed for $username.';
 }
 
 ?>
@@ -175,7 +174,7 @@
 $offset = argv[0]; // beware, no input validation!
 $query  = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;";
 // with PostgreSQL 
-$result = pg_exec($conn, $query);
+$result = pg_query($conn, $query);
 // with MySQL
 $result = mysql_query($query);
 

Reply via email to