Hi,
I made a few changes but didn't test it. Give it a try...
PHP Code:
<form action="index.php?p=login" method="post" enctype="multipart/form-data">
Username:
<input type="text" name="user" />
Password:
<input type="password" name="pass" />
<input type="submit" value="Login" />
</form>
<?php
if ( $_GET['p'] == 'login' ) {
$host = "localhost";
$user = "username";
$pass = "password";
$db = "forums";
$con = mysql_connect($server, $username, $password);
mysql_select_db($database);
// Get user details from MySQL Table
$Query = mysql_query( " SELECT * FROM user WHERE username ='" . mysql_real_escape_string($_POST['user']) . "',
" );
$result = mysql_fetch_array( $Query );
// MD5 the form password
$md5Pass = md5(md5($pass).$result['salt']);
// Check that the form password matches the one in the database
if ( $md5Pass == $result['password'] ) {
echo 'User logged in';
} else {
echo 'Wrong Password, please try again';
}
}
?>
Change user, pass and db.
Hope that helps.
Tim
www.SuppYo.com