parse error on php again?

OnePieceFan

New member
well I'm testing my login system on localhost, and after I log in with the username and password, this appears:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user '390053'@'localhost' (using password: YES) in C:\wamp\www\proyectMyResumenes\checklogin.php on line 18
cannot connect

Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MyResumen</title>
</head>

<body>

<?php
$host="localhost"; // Host name
$username="390053"; // Mysql username
$password="sikju9123"; // Mysql password
$db_name="membership"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_membership")or die("cannot select DB");

// username and password sent from form
$myusername=$_POST['john'];
$mypassword=$_POST['1234'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_members WHERE username='$john' and password='$1234'";
$result=mysql_query($sql);

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

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("john");
session_register("1234");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>

</body>
</html>

What do you think the error might be?
I would really appreciate any help. Thanks!
 
Back
Top