Jump to content

unexpected T-String help


odetron

Recommended Posts

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();'

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.