----------------------------------------------------------
<SCRIPT LANGUAGE="JavaScript" src = "md5.js">
function Login(){
var username=document.login.username.value;
var password=document.login.password.value;
password = md5("password");
return password;
}
</script>
<h1>Please Log In</h1>
This page is secret.
<form method="post" action="something.php">
<table border="1">
<tr>
<th> Username </th>
<td> <input type="text" name="username"> </td>
</tr>
<tr>
<th> Password </th>
<td> <input type="password" name="password"> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Log In"
onSubmit= "Login()">
</td>
</tr>
</table>
</form>
<?php
// connect to mysql
$mysql = mysql_connect( 'localhost', 'user, 'password' );
if(!$mysql)
{
echo 'Cannot connect to database.';
exit;
}
// select the appropriate database
$mysql = mysql_select_db( 'database' );
if(!$mysql)
{
echo 'Cannot select database.';
exit;
}
$blah1= $HTTP_POST_VARS['username'];
$blah2= $HTTP_POST_VARS['password'];
// query the database to see if there is a record which matches
$query = "select count(*) from User where
uname = '".$blah1."' and
pword = '".$blah2."' ";
//echo $query;
$result = mysql_query( $query);
.... etc (the end is ok)
--------------------------------------------------------------------------
I would really preciate your help!