Location: PHPKode > scripts > Php AddressBook 2 > php-addressbook-2/manage-check.php
<?php
include_once("config.php");
include_once("open-db.php");

// username and password sent from signup form
$myusername=$_POST['myusername'];

$passwordHash = sha1(mysql_real_escape_string($_POST['mypassword']));

$sql="SELECT * FROM members WHERE username='$myusername' and password='$passwordHash'";
$rs = mysql_query($sql) or die ("Query failed");

// Mysql_num_row is counting table row
$numofrows = mysql_num_rows($rs);
// If result matched $myusername and $mypassword, table row must be 1 row

// Close DB connection
mysql_close($cid);

if($numofrows==1){
// Register $myusername, $mypassword and redirect to file success file
// Yes
session_register("myemail");
header("location:index2.php");
}
else {
// No
header("location:index.php?title=deny");
}
?>
Return current item: Php AddressBook 2