HIMSISFO

Himpunan Mahasiswa Sistem Informasi Universitas Mercubuana


    Tips Membuat Login Admin Dengan PHP

    Share
    avatar
    Alen1.1
    Super Administrator
    Super Administrator

    Male Jumlah posting : 82
    Age : 28
    Fakultas : Fasilkom
    Jurusan : sistem informasi
    Interest in : Visual Basic,xna,C#
    Registration date : 07.01.09

    Tips Membuat Login Admin Dengan PHP

    Post by Alen1.1 on Sat Jan 17, 2009 3:37 am

    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 "&nbsp; $user_error <br>";}

    if (isset($password_error))
    {echo "&nbsp; $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 :malu:

    t-3-r-m-i-n-4-t-0-r
    Mahasiswa pendatang
    Mahasiswa pendatang

    Jumlah posting : 2
    Fakultas : Yash
    Jurusan : ---
    Interest in : Mig33, Hacking
    Registration date : 06.09.09

    Re: Tips Membuat Login Admin Dengan PHP

    Post by t-3-r-m-i-n-4-t-0-r on Sun Sep 06, 2009 9:54 am

    Nice script bro thanks :)

      Waktu sekarang Thu Aug 16, 2018 12:21 pm