My login script suddenly stopped working after I started trying to incorporate md5...any ideas?
This is the error:
Parse error: parse error, unexpected T_STRING in /home/tcp/public_html/dl/usersystem/login.php on line 12
And line 12 is this:
$pass=md5('$_POST['pass']')
Code:
<center>
<?php
session_start();
// connect to the mysql database server.
include('inc/connect.php');
if ($_POST['username']) {
//did they supply a password and username
$username=$_POST['username'];
$pass=md5('$_POST['pass']')
if ($pass==NULL) {
echo "No password given.";
}else{
$query = mysql_query("SELECT username,pass FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['pass'] != $pass) {
echo "The supplied login is incorrect";
}else{
$query = mysql_query("SELECT username,pass FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
echo "You have successfully logged in as ".$_SESSION['s_username']." and can go to the index <a href='index.php'>here</a>.";
}
}
}
?>
<h1>Login</h1>
<form action='login.php' method='POST'>
<table style='border:1px solid #000000;'>
<tr>
<td align='right'>
Username: <input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td align='right'>
Password: <input type='password' size='15' maxlength='25' name='pass'>
</td>
</tr>
<tr>
<td align='center'>
<input type="submit" value="Login">
</td>
</tr>
<tr>
<td align='center'>
<a href='register.php'>Register Here</a>
</td>
</tr>
</table>
</form>
</center>
This is the error:
Parse error: parse error, unexpected T_STRING in /home/tcp/public_html/dl/usersystem/login.php on line 12
And line 12 is this:
$pass=md5('$_POST['pass']')