i am new to working with mysql with php
i need a full working user auth
can anyone take a look at the code below and let me know
what else i would need to add to make the user auth work?
if there is anything that i need to add, can you write out the
code for me below along with my user auth file.
thanks
<?
$host ="localhost";
$username="user";
$password="pass";
$database="database";
$table_name = "tablename";
$connection = mysql_connect( $host, $username, $password ) or die( "Connection Error" );
mysql_select_db($db);
$user = $POST['auser'];
$pass = $POST['apass'];
$result = mysql_query("SELECT * FROM $table_name WHERE auser == '$user' AND apass == '$pass'");
if ($auser == "$auser" AND $apass == "$apass")
{
echo "<br><br><center><font size='+2'>Welcome $auser <br>Click here to logon <br><br>";
echo "
<form action='login.html' method='post'>
<input type='hidden' name='select2' value='$auser'>
<a href='login.html'>login</a>
</form>
";
}
elseif ($auser <> "$auser" AND $apass <> "$apass")
{
echo "You are rejected, information has not been accepted as valid.<br><a href='login.html'>Login</a>";
}
else
{
echo ("<font size='+2'><strong>YOU GOT REJECTED</strong></font>, <BR> YOU MUST LOGIN FIRST <BR>BEFORE YOU MOVE ON<BR><a
href='login.html'>LOGIN</a><br>");
}
?>