stokie-rich Posted December 7, 2009 Share Posted December 7, 2009 hey can any one help im designing a website with php for uni and i cannot get my log in page to work it keeps saying sometging about the else statement <?php //password parameter if ($_POST["user"] == "user" && $_POST["password"]== "password") //this is if the users password matches the one on the systems, it will then load into the main website {header('location:http://Fcetdev1.student.staffs.ac.uk/wwwdata/DSA/2009-2010/hv001341/Hospital Login Success.html');} //new connection object $adoCon = new COM("ADODB.Connection"); $sHere = dirname(__FILE__); //opens the connection using a standard connection string $adoCon->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\\Fcetdev1.student.staffs.ac.uk\wwwdata\DSA\2009-2010\0db\Hv001341"); $rsmain = $adoCon->Execute ("SELECT * FROM tblusers WHERE usname ='$sUser';"); $suserfirstname =$rsmain->Fields("userfirstname")->Value; $suserlastname =$rsmain->Fields("userlastname")->Value; echo "Welcome $sfname $slname you have succesfully logged in <br/> \n" // if the password is not correct then the user will be show a incorrect password screen and then re-directed back to the main log in page else {header('location:http://Fcetdev1.student.staffs.ac.uk/wwwdata/DSA/2009-2010/hv001341/Hospital Login Denied.html');} //Assigning of the variables to php $sUser = $_POST["Username"]; $sPass = $_POST["Password"]; ?> thanks rich Quote Link to comment https://forums.phpfreaks.com/topic/184268-help-with-log-in-form/ Share on other sites More sharing options...
aeroswat Posted December 7, 2009 Share Posted December 7, 2009 You need to close the if before you start an else. You don't have an end bracket } Quote Link to comment https://forums.phpfreaks.com/topic/184268-help-with-log-in-form/#findComment-972786 Share on other sites More sharing options...
premiso Posted December 7, 2009 Share Posted December 7, 2009 You need to close the if before you start an else. You don't have an end bracket } He has the end bracket, but you are almost there. You have to start the else right after the if ends. Not doing so causes some syntax errors. if ($correct) { // code here }else { //code here } The above is correct way to do it, below is the wrong way if (!$correct) { } //code here else { } Hope that clears it up for you Quote Link to comment https://forums.phpfreaks.com/topic/184268-help-with-log-in-form/#findComment-972929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.