stabs909 Posted March 26, 2012 Share Posted March 26, 2012 (edited) i keep geting this error message Parse error: syntax error, unexpected T_LOGICAL_OR in /home/u571822004/public_html/login.php on line 11 this <?php session_start(); $username = $_POST['username']; $password = $_POST['password']; if ($username AND $password) { $connect = mysql_connect("xxxxxx","xxxxxxx","xxxxxxx"); or die ("Couldnt Connect To Database"); mysql_select_db("xxxxxxx") or die ("couldnt find database"); $query = mysql_query("SELECT * FROM users WHERE username='$username'" $numrows = mysql_num_rows($query); if($numrows !=0) { while ($rows = mysql_fetch_assoc($query)) { dbusername = $row ['username']; dbpassword = $row ['password']; } if ($username==dbusername&&$password==$dbpassword) { ehco "Login successful.a <href='home.php'>CLick here to go home</a>"; $_SESSION['username']=$dbusername; } else echo "incorrect password"; } else die ("echo "That username does not exist"); } else die ("Please enter a username and password ?> Edited March 26, 2012 by illusions Erased personal data Quote Link to comment Share on other sites More sharing options...
JordanD Posted March 26, 2012 Share Posted March 26, 2012 Well, first of all, it looks like this line: die ("Please enter a username and password needs to be finished: die ("Please enter a username and password"); Quote Link to comment Share on other sites More sharing options...
SirChick Posted March 26, 2012 Share Posted March 26, 2012 (edited) Just to for-warn you this script is really vunerable to hack attacks + the passwords are not secure either which you need to encrypt. There was at least 10 errors i found i fixed them all: Code: <?php session_start(); $username = $_POST['username']; // add string security $password = $_POST['password']; //add string security if ($username && $password) { $connect = mysql_connect("xxxxxx","xxxxxxx","xxxxxxx") or die ("Couldnt Connect To Database"); mysql_select_db("xxxxx") or die ("couldnt find database"); $query = mysql_query("SELECT username,password,count(username) as total FROM users WHERE username='$username' LIMIT 1"); //add limit 1 to reduce memory useage when only searching for one result $row = mysql_fetch_assoc($query); if($row['total']){ $tempu = $row ['username']; $tempp = $row ['password']; if ($username === $tempu && $password === $tempp){ //use === not == for a more accurate checking $_SESSION['username']=$row['username']; // add string security echo "Login successful <href='home.php'>CLick here to go home</a>"; }else{ echo "incorrect login!"; } } else { echo "incorrect login!"; } }else{ echo "incorrect login!"; } ?> Also ADD MD5 encryption to password! Edited March 26, 2012 by SirChick Quote Link to comment Share on other sites More sharing options...
Spudinski Posted March 26, 2012 Share Posted March 26, 2012 The get to the PROBLEM. It's a parse error, you used a semi-colon which isn't correct. [color=#333333]$connect = mysql_connect("xxxxxx","xxxxxxx","xxxxxxx"); or die ("Couldnt Connect To Database"); Should be: [/color][color=#333333]$connect = mysql_connect("xxxxxx","xxxxxxx","xxxxxxx") or die ("Couldnt Connect To Database"); [/color] Quote Link to comment Share on other sites More sharing options...
Uridium Posted March 26, 2012 Share Posted March 26, 2012 line 14 >>> $query = mysql_query("SELECT * FROM users WHERE username='$username'" change to $query = mysql_query("SELECT * FROM users WHERE username='$username'"); line 45 >>> die ("Please enter a username and password change to die ("Please enter a username and password"); Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 26, 2012 Author Share Posted March 26, 2012 thanks alot its working now. i been trying to get it to work all day. i got another one for you. i want a muisc to play every time some one types in my website. but i dont want a play button or any of that stuff to show. i just want it to auto play. Quote Link to comment Share on other sites More sharing options...
Uridium Posted March 26, 2012 Share Posted March 26, 2012 thanks alot its working now. i been trying to get it to work all day. i got another one for you. i want a muisc to play every time some one types in my website. but i dont want a play button or any of that stuff to show. i just want it to auto play. VERRRRRY bad idea not everyone likes music on sites so always make sure you give your users a choice to turn off the player But in all honest i wouldnt have one if any users are still on dial up you'll kill em.. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted March 26, 2012 Share Posted March 26, 2012 There is a couple of ways to handle sound / music. The most official way (and yet brand new, however not supported by older browsers) is the audio tag: https://developer.mozilla.org/En/HTML/Element/Audio The format of the audio depends on the browsers. So check which one support which format. 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.