I am building a site which has a user database where the users can log in and sign up. When I test the PHP code for login, it says “parse error” once and invalid { in line 16. What is worng in my code?
<?php
$user = $_REQUEST['user'];
$pass = $_REQUEST['pass'];
$con = mysql_connect("localhost","root","xxxxxxxxxx") or die('Could not connect:'.mysql_error());
$test = mysql_select_db("users",$con)or die("unable to connect");
$result = "SELECT * FROM users where username='$user' AND password='$pass'";
$alpha = @mysql_query($result,$con);
if($alpha==1)
{
$expire=time()+60*60*24*30;
setcookie("id",$row['id'],$expire);
echo "Logged in. as <b>".$row['username']."</b>";
$userID = $row['id'];
header("index map.html")
}
else
{
echo "<b>Username or password is wrong</b><br><br>";
header("index.html")
}
mysql_close($con);
?>