Membuat script untuk loin admin dalam bahasa pemrograman PHP tidaklah sulit. Mungkin Anda dapat mencoba kode PHP berikut ini.
Membuat form login admin :
<tr> <td valign="top">
<form action="admin.php" method="post"><br>
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr><td><b>Username:</b></ td>
<td><input type="text" name="username" size="10"></td></tr>
<tr><td><b>Password:</b></ td>
<td><input type="password" name="password" size="10"></td></tr>
<tr><td colspan="2"><center><input type="submit" value="Submit"></center></td>& lt;/tr>
</table></form>
Membuat fungsi setelah login admin :
<?
//<!-- start declare variables -->
$username=$HTTP_POST_VARS['username'] ;
$password=$HTTP_POST_VARS['password'] ;
//<!-- end declare variables -->
//<!-- start error detection -->
$errors=0;
if (!($username == "username")) //<!-- Username you want to use -->
{$user_error=("<font color=red><b>You entered the wrong username</b></font>"); $errors++;}
if (!($password == "password")) //<!-- Password you want to use -->
{$password_error=("<font color=red><b>You entered the wrong password</b></font>"); $errors++;}
if ($errors > 0)
{echo "<center><b>Errors that occured while trying to enter admin area</b></center><br><br>" ;}
if (isset($user_error))
{echo " $user_error <br>";}
if (isset($password_error))
{echo " $password_error <br>";}
if ($errors > 0)
{echo "
<table border=0 width=100% height=86% cellpadding=0 cellspacing=0>
<tr><td valign=bottom><center>Please click <a href=login.php>here</a> to go back and fix any errors</center> </td></tr>
</table>";}
if ($errors > 0)
{die ();}
//<!-- end error detection -->
?>
Selamat Mencoba
Membuat form login admin :
<tr> <td valign="top">
<form action="admin.php" method="post"><br>
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr><td><b>Username:</b></ td>
<td><input type="text" name="username" size="10"></td></tr>
<tr><td><b>Password:</b></ td>
<td><input type="password" name="password" size="10"></td></tr>
<tr><td colspan="2"><center><input type="submit" value="Submit"></center></td>& lt;/tr>
</table></form>
Membuat fungsi setelah login admin :
<?
//<!-- start declare variables -->
$username=$HTTP_POST_VARS['username'] ;
$password=$HTTP_POST_VARS['password'] ;
//<!-- end declare variables -->
//<!-- start error detection -->
$errors=0;
if (!($username == "username")) //<!-- Username you want to use -->
{$user_error=("<font color=red><b>You entered the wrong username</b></font>"); $errors++;}
if (!($password == "password")) //<!-- Password you want to use -->
{$password_error=("<font color=red><b>You entered the wrong password</b></font>"); $errors++;}
if ($errors > 0)
{echo "<center><b>Errors that occured while trying to enter admin area</b></center><br><br>" ;}
if (isset($user_error))
{echo " $user_error <br>";}
if (isset($password_error))
{echo " $password_error <br>";}
if ($errors > 0)
{echo "
<table border=0 width=100% height=86% cellpadding=0 cellspacing=0>
<tr><td valign=bottom><center>Please click <a href=login.php>here</a> to go back and fix any errors</center> </td></tr>
</table>";}
if ($errors > 0)
{die ();}
//<!-- end error detection -->
?>
Selamat Mencoba