Advertisement
Guest User

Untitled

a guest
May 14th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2. function encrypt($string){
  3.     return base64_encode(base64_encode(base64_encode($string)));
  4. }
  5.  
  6. function decrypt($string){
  7.     return base64_decode(base64_decode(base64_decode($string)));
  8. }
  9.     include('../database.php');
  10.     $mail = mysql_real_escape_string($_POST['email']);
  11.     $pass = mysql_real_escape_string(encrypt($_POST['password']));
  12.     $my = mysql_query("SELECT * FROM user WHERE email = '$mail' and password = '$pass'");
  13.     $jumlah = mysql_num_rows($my);
  14.     $fetch = mysql_fetch_array($my);
  15.     $today = mysql_real_escape_string(date('Y-m-d | H:i:s'));
  16.     $ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
  17.     $simpan = mysql_query("UPDATE user SET ip_user = '$ip' WHERE email = '$mail'");
  18.     if ( $jumlah == 0 )
  19.     {
  20.         header('Location:index.php?message=Wrong_Login');
  21. ?>
  22. <?php
  23.         } else
  24.     {
  25.     $uq = mysql_query("INSERT INTO visit (`id`, `ip_user`, `tanggal`, `action`) VALUES (NULL, '$ip', '$today', 'Login With User : $user')");
  26.     $banned = $fetch['banned'];
  27.     $banned_reason = $fetch['banned_reason'];
  28.     if ( $banned == 1 )
  29.     {
  30.         header("Location:../page-error-404.html?banned=yes&email=$mail&message=Cannot Join On This Site.");
  31.     } else
  32.     {
  33.     session_start();
  34.       $_SESSION['email'] = $mail;
  35.       $_SESSION['password'] = $pass;
  36.       $_SESSION['level'] = $fetch['level'];
  37.       header('Location:page-pin.php');
  38.     }
  39.     }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement