Jump to content

unexpected T-String help


odetron

Recommended Posts

[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?
Link to comment
Share on other sites

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();'
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.