parsing errors on php?

OnePieceFan

New member
So I'm making this login system, but when I test it on localhost and put the respective username and password, these errors appear:
Notice: Undefined variable: localhost in C:\wamp\www\proyectMyResumenes\checklogin.php on line 18

Notice: Undefined variable: sikju9123 in C:\wamp\www\proyectMyResumenes\checklogin.php on line 18

Warning: mysql_connect() [function.mysql-connect]: Access denied for user '$390053'@'localhost' (using password: NO) 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("$localhost", "$390053", "$sikju9123")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>

*390053 is mysql username and sikju9123 is the mysql password. I don't know what's going on! please help me!
web host is www.ueuo.com if that helps
To the first answerer: Ok it worked but I still get the last error which is:
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

Help?
 
Back
Top