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>'; 
}; 
?>

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.