<?php
$host="localhost"; // Host name
$username="cody2000"; // username
$password="115cody"; // password
$db_name="cody2000_aspire"; // Database name
$tbl_name="Users"; // Table name
// Replace database connect functions depending on database you are using.
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name");
// username and password sent from form
//NEVER Remove the mysql_real_escape_string. Else there could be an Sql-Injection!
$myusername=mysql_real_escape_string($_POST['loginuser']);
$mypassword=mysql_real_escape_string($_POST['loginpass']);
$result=mysql_query($sql);
mysql_fetch_assoc(mysql_query("SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"
$count=mysql_num_rows($result);
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:menu.php");
} else {
echo "Wrong Username or Password. Try again";
}
?>
它说我的密码不正确。请帮助我是这方面的初学者。我有一堆代码混合在一起,我不知道哪个是正确的