Code: Select all
<?
$uname = isset($_POST['uname'])?($_POST['uname']): "";
$pass = isset($_POST['pass'])?($_POST['pass']): "";
if (isset($_POST['checklog']) == true):
$validate = 0;
if ($uname == 'test') {$validate++; }
if ($pass == 'test') {$validate++; }
if ($validate == 2)
{
session_start();
$_SESSION['_suname'] = $uname;
$_SESSION['_spass'] = $pass;
header("Location: mainmenu.php?" .SID); }
else { print "<I> Password or username error </I>"; }
endif;
?>
<HTML><HEAD><TITLE> Temp Logon page </TITLE></HEAD>
<BODY>
<H2> Logon Here: </H2><BR>
<FORM name='templogon' method='POST' action='templogon.php'>
Username: <INPUT type='text' name='uname'><BR>
Password: <INPUT type='password' name='pass'><BR>
<INPUT TYPE='submit' name='checklog' value='submit'>
</FORM></BODY></HTML>What I would like to know is how I can convert this code into a login code that will be able to compare the fields "passwords" and "username" from a password table "azizpassword".
And when it doesn't match what is typed in it will bring out an error message but if it does match it will go to and open the file mainmenu.php.
Basically I just want to know how I can convert the code given above to what I need and explain.
I really hope someone can help me coz I hae been trying different ways but none of them have worked and because of me being a beginner at PHP I find it very difficult to solve this problem I hope someone can help me with this
Thank You For Your Time
Take Care