odetron Posted November 23, 2006 Share Posted November 23, 2006 [quote]Parse error: parse error, unexpected T_STRING in /home/www/phimil.freehostia.com/odetronchat/login.php on line 19[/quote]Heres line 19.[code]$query = “select * from users were username=’$username’ and password=’$password'”;[/code]Whats wrong whit this? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 23, 2006 Share Posted November 23, 2006 My guess is you forgot the ";" at end of line 18 Quote Link to comment Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 no, I got that.Lines 16-19 (if that helps)[code]session_start();$username = $_POST[‘username’];$password = md5($_POST[‘password’]);$query =“SELECT * from users WHERE username='$username' and password='$password'”;[/code] Quote Link to comment Share on other sites More sharing options...
jawapro Posted November 23, 2006 Share Posted November 23, 2006 If that isnt the problem it could be cause [code]’$password'[/code] has one ’ and one ' which seem to be different.That COULD be a problem.Post the lines around the problem line, to see if the problem is in the ones before it. Quote Link to comment Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 nope. That did nothing. Ill put it up , but I think is was because I typed the wrong mysql sever info down. lol Quote Link to comment Share on other sites More sharing options...
ataria Posted November 23, 2006 Share Posted November 23, 2006 Read my newer post. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 23, 2006 Share Posted November 23, 2006 Your quote characters look weird! Quote Link to comment Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 alright I got it.it had to be changed to[code]$query = mysql_query("SELECT * FROM `users` WHERE `username`='{$username}' `password`='{$password}'");[/code] Quote Link to comment Share on other sites More sharing options...
ataria Posted November 23, 2006 Share Posted November 23, 2006 Alright. I am guessing this is a log-in page with two fileds.. username and password..this is how I would code it.. this is how I would code it..[code]if (isset($_POST['Login'])){ $get_user = mysql_query("SELECT *FROM `users`WHERE `username`='$_POST[username]'"); $count_user = mysql_num_rows($get_user); $user = mysql_fetch_assoc($get_user); $enc_pass = md5(strtolower($_POST['username']) . $_POST['password']); if (empty($_POST['username'])) echo 'You forgot to enter a username.'; elseif (empty($_POST['password'])) echo 'You forgot to enter your password.'; elseif ($count_user == 0) echo 'The username you entered does\'t exist.'; elseif ($enc_pass != $user['password']) echo 'Passwords don\'t match, try again.'; else { the success stuff goes here... }}else {// the form will go here.}[/code]if your gonna add cookies, don't forget your 'ob_start();' and 'ob_flush();' 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.