I am writing a form that verifies a sign in according to a youtube tutorial: http://www.youtube.com/watch?v=mn0ucCuNOTI.
The thing is I can't make this particular page work:
<?php include_once("db.php")
session_start();
?>
<?php
$user = $_POST['name'];
$pass = $_POST['pwd'];
$sql="SELECT count(*) from phplogin WHERE(username='$user' and password='$pass')";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
if($result[0] > 0) {
$_SESSION['userName']=$user;
echo "Succesful login!";
echo "<br /> Welcome " .$_SESSION['userName']. "!";
echo "<br /><a href='signupform.php' > SignUp </a>";
echo "<br /><a href='signinform.php' > SignIn </a>";
echo "<br /><a href='logout.php' > LogOut </a>";
}
else{
echo "Login failed!";
echo "<br /><a href='signupform.php' > SignUp </a>";
echo "<br /><a href='signinform.php' > SignIn </a>";
}
?>
The thing is when I removed start_session() the site worked (of course I haven't started to use the session for real). I don't know if the problem is in my code.
Now I get the following error message instead: Parse error: syntax error, unexpected 'session_start' (T_STRING) in C:\webserver\apache\htdocs\sign_in_up\signin.php on line 2