SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /* | |
| 3 | nulisnya harus <?php | |
| 4 | km hrs edit php.ini dan cari short_tag_open di php.ini | |
| 5 | */ | |
| 6 | - | <? session_start(); |
| 6 | + | session_start(); |
| 7 | include"assabil-include/koneksi.php"; | |
| 8 | include "menu.php"; | |
| 9 | ||
| 10 | ||
| 11 | if (isset($_POST['admin'])) | |
| 12 | {
| |
| 13 | - | $hasil=mysql_query($query); |
| 13 | + | |
| 14 | $user_name=htmlentities((trim($_POST['admin']))); | |
| 15 | $password=htmlentities(md5($_POST['kunci'])); | |
| 16 | $query="select * from admin where user='$user_name' and password='$password'"; | |
| 17 | $hasil=mysql_query($query)or die(mysql_error()); | |
| 18 | ||
| 19 | ||
| 20 | - | alert("Maaf, Password Anda salah!!");
|
| 20 | + | |
| 21 | if (empty($cek_login)) | |
| 22 | - | </script><? |
| 22 | + | |
| 23 | ?><script language="javascript"> | |
| 24 | alert("Maaf, Password or user salah Anda salah!!");
| |
| 25 | document.location="assabil-admin/index.php"; | |
| 26 | </script><?php | |
| 27 | } | |
| 28 | else | |
| 29 | {
| |
| 30 | //daftarkan ID jika user dan password BENAR | |
| 31 | - | |
| 31 | + | |
| 32 | - | session_register('id');
|
| 32 | + | |
| 33 | - | session_register('st');
|
| 33 | + | |
| 34 | - | session_register('user_name');
|
| 34 | + | |
| 35 | //===================VBENERIN INI | |
| 36 | - | if($st ==1) // menentukan tampilan halaman berdasarkan status |
| 36 | + | $_SESSION['id']=$id;$_SESSION['name']=$user_name;$_SESSION['pass']=$password; |
| 37 | ||
| 38 | - | else |
| 38 | + | |
| 39 | if($st ==1){ // menentukan tampilan halaman berdasarkan status
| |
| 40 | echo "<script> document.location.href='assabil-admin/index.php'; </script>"; | |
| 41 | }else{
| |
| 42 | echo "<script> document.location.href='alumni.php'; </script>"; | |
| 43 | } | |
| 44 | ||
| 45 | ||
| 46 | } | |
| 47 | } | |
| 48 | die(); | |
| 49 | } | |
| 50 | ?> | |
| 51 | ||
| 52 | <html> | |
| 53 | <title>Login</title> | |
| 54 | <head> | |
| 55 | <script language="javascript"> | |
| 56 | if (screen.width <= 700) //cek screenn layar jika hp langsung direck ke mobile | |
| 57 | {
| |
| 58 | document.location = "assabil-admin/index.php"; | |
| 59 | } | |
| 60 | </script> | |
| 61 | ||
| 62 | <script language="javascript"> | |
| 63 | function cek(){
| |
| 64 | var user= document.getElementById('userid').value;
| |
| 65 | var pass= document.getElementById('passwd').value;
| |
| 66 | if(user.replace(/^\s+|\s+$/g, '')==''){
| |
| 67 | alert('Username Harus Diisi!');
| |
| 68 | return false; | |
| 69 | } | |
| 70 | if(pass.replace(/^\s+|\s+$/g, '')==''){
| |
| 71 | alert('Password Harus diisi!');
| |
| 72 | return false; | |
| 73 | } | |
| 74 | return true; | |
| 75 | } | |
| 76 | </script> | |
| 77 | </head> | |
| 78 | <body "> | |
| 79 | <p> </p> | |
| 80 | <p> </p> | |
| 81 | <p> </p> | |
| 82 | ||
| 83 | <form action="index.php" method="post"> | |
| 84 | <table width="487" height="126" border="0" align="center"> | |
| 85 | <tr valign="bottom"> | |
| 86 | <td width="10" rowspan="4" align="center" valign="middle" background="secure.jpeg"> </td> | |
| 87 | <td width="14" rowspan="4" align="center" valign="middle" background="secure.jpeg"> </td> | |
| 88 | <td width="6" rowspan="4" align="center" valign="middle" background="secure.jpeg"> </td> | |
| 89 | <td width="141" height="35"><font size="4" face="verdana"><strong>Username </strong></font></td> | |
| 90 | <td width="27"><div align="center"><strong>:</strong></div></td> | |
| 91 | <td width="263"><input name="admin" type="text" id="userid" value="" size="20"></td> | |
| 92 | </tr> | |
| 93 | ||
| 94 | <tr valign="top"> | |
| 95 | <td height="21"> </td> | |
| 96 | <td> </td> | |
| 97 | <td> </td> | |
| 98 | </tr> | |
| 99 | <tr valign="top"> | |
| 100 | <td height="34"><font size="4" face="verdana"><strong>Password </strong></font></td> | |
| 101 | <td><div align="center"><strong>:</strong></div></td> | |
| 102 | <td><input name="kunci" type="password" id="passwd" value="" size="20"></td> | |
| 103 | </tr> | |
| 104 | ||
| 105 | <tr> | |
| 106 | <td> </td> | |
| 107 | <td> </td> | |
| 108 | <td><input name="submit" type="submit" onClick="return cek()" value="LOGIN"> | |
| 109 | <input type="reset" name="reset" value="CANCEL" /></td> | |
| 110 | </tr> | |
| 111 | </table> | |
| 112 | <div align="center"></div> | |
| 113 | </form> | |
| 114 | ||
| 115 | </body> | |
| 116 | </html> |