Bantuan Pencarian :   
Home arrow Artikel arrow Web Programming arrow PHP arrow Login Admin dengan PHP
Login Admin dengan PHP PDF Cetak E-mail
(3 votes)
Ditulis Oleh oscorp   
Saturday, 06 December 2008

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>

Login Admin


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 -->
?>

Sumber : beritanet.com

» No Comments
There are no comments up to now.
» Post Comment
Email (will not be published)
Name
Title
Comment
 
< Sebelumnya   Berikutnya >

Donate Via Paypal

Enter Amount:

Online

Saat ini ada 9 tamu online
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday192
mod_vvisit_counterYesterday255
mod_vvisit_counterThis week1032
mod_vvisit_counterThis month2288
mod_vvisit_counterAll111020

Page Rank


PageRank
Add to Google
Computer Blogs - BlogCatalog Blog Directory