<?php session_start();
// Note: this is a sample login you may use your own log and security script
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>phpMyApp - Login</title>
</head>
<body bgcolor="#e8e8e8">
<?php
require_once 'pmaconfig.php';
if(!$_GET['mode'])
{
?>
<form action="pmalog.php?mode=login" method="post">
<table align="center">
<tr>
<td colspan="2"><?php if($_GET['logerror'])echo '<font color=red>Wrong user Id or password.</font>'; ?></td>
</tr>
<tr>
<td>User Id</td><td><input style="font-family:Verdana, Arial, Helvetica, sans-serif" name="mid" size="20" type="text" /></td>
</tr>
<tr>
<td>Password</td><td><input style="font-family:Verdana, Arial, Helvetica, sans-serif" name="pwd" size="20" type="password" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" Login " /></td>
</tr>
</table>
</form>
<?php
}
if($_GET['mode']=='login')
{
if($_POST['mid']==$adminId && $_POST['pwd']==$adminPwd)
{
$_SESSION['mid']=$adminId;
die("<a href='index.php'>You have successfully logged in. Click to continue</a>");
}
else die("<script>window.location='pmalog.php?logerror=1'</script><font color=red>Wrong user Id or password.</font><a href=''> Click to continue</a>");
}
if($_GET['mode']=='logout')
{
session_destroy();
die("<a href=''>You have successfully logged out.</a>");
}
?>
</body>
</html>