PC Nerd Posted January 9, 2007 Share Posted January 9, 2007 hi guysi am creating this login script, but i am getting the following error:Parse error: parse error, unexpected $end in C:\xampp\xampp\htdocs\Battle-Ages\B_A-Login.php on line 109now the weird thing is that this line is the very last line in the entire page: "</html>", so even the php has finished giving our output, and being used.here is my code...., can anyone help me with this error[code]<html><head><link rel="stylesheet" type="text/css" href="B_A-CSS.css"><title>Battle Ages Login</title></head><body><table><thead> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'left'> </td> <td> </td> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'right'> </td></thead><tbody><tr><td class = left></td><td class = centre><?phpinclude("inc_files/Database_link.inc");$User_Name = $_POST['User_Name'];$Login_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '" .$User_Name."'";$result = @mysqli_query($DB_Server, $Login_SQL);if($result){ $confirm = @mysql_fetch_array($result); if($confirm['User_Name'] == $_POST['User_Name'] and $confirm['Password'] == $_POST['Password'] and $_POST['Pic_Value'] == $_POST['Pic_Name']){ $Cookie_SQL = "SELECT * FROM Table_1 WHERE User_Name = '".$_POST['User_Name']."'"; $G_Stats_Query = @mysqli_query($DB_Server, $Cookie_SQL); if(!$result){ echo "there was an error with the database connection. Although we were able to valadate your login, we cannot retrive your game stats from the database. If this persists please contact us."; } else{ } $Cookie_Create = @mysql_fetch_array($G_Stats_Query); if(!$Cookie_Create){ echo "We cannot retrive your game stats. please try to login again. if this problem persists, please contact us."; } else{ include("inc_files/B_A-Create_Cookies.inc"); echo "<form action = 'B_A-Base.php' method = 'POST'>"; echo "<input type = 'submit' value = 'Login'>"; echo "</form>"; } echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us.<a href = 'B_A-Home.html'>Home</a></p><br><br>"; } else{ echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>"; echo "Error"."$mysqli_error($result)"; }echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>";"}}?></td><td class = right></td></tr></tbody></table></body></html>[/code]thanks for any help in advance Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 take out the " at the end of this line [code]echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>";"}[/code] Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 9, 2007 Author Share Posted January 9, 2007 ok, now thats fixed, but im getting no output, even the button from the form????, why i cant see any error output, just the two images at the top, which arent even spaced correctly, even though the same code is used on every single page that ive made and it works on all those????? i just dont know whats happening Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 Try :[code]if(!empty($result)){[/code]instead of:[code]if($result){[/code] Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 How's it comin? Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 9, 2007 Author Share Posted January 9, 2007 ok, i changed that if() to that, and the other if thatr uses the $result..... to if(empty($result)) {........, im not getting any error, but im not getting anything either, just as though i had not changed a thing....??? any more ideas Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 it should be !empty notice the ! aka NOT Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 9, 2007 Author Share Posted January 9, 2007 i fixed the first if() one with that...... but the second one inside that if() that tests if $reslut is empty i changed to the if(empty($result)) {}, but thats just stupid i now relise, becauase weve already tested if the $result variable is empty.....hang on ill change it Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 9, 2007 Author Share Posted January 9, 2007 ok i changed that, but i still get no output????? anymore ideas anyone...thanks for al your help so far Quote Link to comment Share on other sites More sharing options...
bubblybabs Posted January 10, 2007 Share Posted January 10, 2007 I'm so far from expert I'm under the charts and not even at the bottom of them but I noticed you have 7 opening brackets { and 8 closing brackets } . Perhaps you need to add an opening bracket somewhere...Babs Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 I don't think you need to add one, but remove one from the two on line 90 & 91 Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 10, 2007 Author Share Posted January 10, 2007 ok, this is the code i have:, but its not giving any output, except the two image logos as the top, and the css link:[code]<html><head><link rel="stylesheet" type="text/css" href="B_A-CSS.css"><title>Battle Ages Login</title></head><body><table><thead> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'left'> </td> <td> </td> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'right'> </td></thead><tbody><tr><td class = left></td><td class = centre><?phpinclude("inc_files/Database_link.inc");$User_Name = $_POST['User_Name'];$Login_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '" .$User_Name."'";$result = @mysqli_query($DB_Server, $Login_SQL);if(!empty($result)){ $confirm = @mysql_fetch_array($result); if($confirm['User_Name'] == $_POST['User_Name'] and $confirm['Password'] == $_POST['Password'] and $_POST['Pic_Value'] == $_POST['Pic_Name']){ $Cookie_SQL = "SELECT * FROM Table_1 WHERE User_Name = '".$_POST['User_Name']."'"; $G_Stats_Query = @mysqli_query($DB_Server, $Cookie_SQL); $Cookie_Create = @mysql_fetch_array($G_Stats_Query); if(!$Cookie_Create){ echo "We cannot retrive your game stats. please try to login again. if this problem persists, please contact us."; } else{ include("inc_files/B_A-Create_Cookies.inc"); echo "<form action = 'B_A-Base.php' method = 'POST'>"; echo "<input type = 'submit' value = 'Login'>"; echo "</form>"; } echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us.<a href = 'B_A-Home.html'>Home</a></p><br><br>"; } else{ echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>"; echo "Error"."$mysqli_error($result)"; }echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>";}?></td><td class = right></td></tr></tbody></table></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 First, stop suppressing errors - no wonder you can't find them.Turn on error reporting and take out the @s.Use require instead of include for better errors. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 10, 2007 Author Share Posted January 10, 2007 ok, ill rrewrite the code, becauase im just too confused by what each this does, and this way ill find the error as i test it. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 Good idea. You should always understand your code! Best of luck. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 10, 2007 Share Posted January 10, 2007 I coulda swore we discussed this earlier, tisk tisk! On line 55, Cookie_Create is not a boolean value aka true/false, it is a mysql_query result aka an array of values, therefore calling it on line 57 as if(!$Cookie_Create) is trying to call it as a boolean value. Instead we call it as if(empty($Cookie_Create)) { Try this:[code]<html><head><link rel="stylesheet" type="text/css" href="B_A-CSS.css"><title>Battle Ages Login</title></head><body><table><thead> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'left'> </td> <td> </td> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = '75%' hight = '75%' align = 'right'> </td></thead><tbody><tr><td class = left></td><td class = centre><?phpinclude("inc_files/Database_link.inc");$User_Name = $_POST['User_Name'];$Login_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '" .$User_Name."'";$result = @mysqli_query($DB_Server, $Login_SQL);if(!empty($result)){ $confirm = @mysql_fetch_array($result); if($confirm['User_Name'] == $_POST['User_Name'] and $confirm['Password'] == $_POST['Password'] and $_POST['Pic_Value'] == $_POST['Pic_Name']){ $Cookie_SQL = "SELECT * FROM Table_1 WHERE User_Name = '".$_POST['User_Name']."'"; $G_Stats_Query = @mysqli_query($DB_Server, $Cookie_SQL); $Cookie_Create = @mysql_fetch_array($G_Stats_Query); if(empty($Cookie_Create)){ echo "We cannot retrive your game stats. please try to login again. if this problem persists, please contact us."; } else{ include("inc_files/B_A-Create_Cookies.inc"); echo "<form action = 'B_A-Base.php' method = 'POST'>"; echo "<input type = 'submit' value = 'Login'>"; echo "</form>"; } echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us.<a href = 'B_A-Home.html'>Home</a></p><br><br>"; } else{ echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>"; echo "Error"."$mysqli_error($result)"; }echo "<p>There has been an error with the login, please try to login again. If the problem persists, please contact us. <a href = 'B_A-Home.html'>Home</a></p><br><br>";}?></td><td class = "right"></td></tr></tbody></table></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
bubblybabs Posted January 10, 2007 Share Posted January 10, 2007 And let us know what you finally get when done, I'd love to see it...Babs Quote Link to comment 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.