0

hi all. i searched and i did find that someone was facing this same problem. Although i did what was told to him, i am still getting the same error. guide me?

Error : Parse error: syntax error, unexpected 'exist' (T_STRING) in C:\wamp\www\ProjectCms\login.php on line 6

<?php 
session_start(); 
include("passwords.php"); 
if ($_POST["ac"]=="log") { /// do after login form is submitted  
     if ($USERS[$_POST["username"]]==$_POST["password"]) { /// check if submitted 
     //username and password exist in $USERS array 
          $_SESSION["logged"]=$_POST["username"]; 
     } else { 
          echo'incorrect username/password. Please, try again.'; 
     }; 
}; 
if (array_key_exists($_SESSION["logged"],$USERS)) { //// check if user is logged or not  
     echo "You are logged in."; //// if user is logged show a message  
} else { //// if not logged show login form 
     echo '<form action="login.php" method="post"><input type="hidden" name="ac" value="log"> '; 
     echo 'Username: <input type="text" name="username" />'; 
     echo 'Password: <input type="password" name="password" />'; 
     echo '<input type="submit" value="Login" />'; 
     echo '</form>'; 
}; 
?>
3
Contributors
2
Replies
28
Views
3 Years
Discussion Span
Last Post by veedeoo
0

You should try to comment with /* */ each block inside IF conditions, and check step by step every part

1

remove all semi-colons following the curly brackets.

if(){

}

else{

}

please refer to the proper syntax usage in PHP here or here. You can also search google for PHP basic construct and semantics.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.