Advertisement
dganisha

Untitled

Oct 3rd, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.73 KB | None | 0 0
  1. <?php
  2. // Script by Denny Irawan
  3. ob_start();
  4. session_start();
  5.  
  6. if(isset($_SESSION['username'])) {
  7.     header('location:/');
  8. }
  9.  
  10. require_once("konak.php");
  11.  
  12. ?>
  13. <!DOCTYPE html>
  14. <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
  15. <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
  16. <!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
  17.  
  18. <!-- BEGIN HEAD -->
  19. <head>
  20.      <meta charset="UTF-8" />
  21.     <title>Masuk | D'Payer | Transaksi Pulsa,Kuota,Voucher Game Online,PLN secara mudah dan murah.</title>
  22.     <meta content="width=device-width, initial-scale=1.0" name="viewport" />
  23.     <meta content="" name="description" />
  24.     <meta content="" name="author" />
  25.      <!--[if IE]>
  26.         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  27.         <![endif]-->
  28.     <!-- GLOBAL STYLES -->
  29.      <!-- PAGE LEVEL STYLES -->
  30.      <link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.css" />
  31.     <link rel="stylesheet" href="assets/css/login.css" />
  32.     <link rel="stylesheet" href="assets/plugins/magic/magic.css" />
  33.     <script src='https://www.google.com/recaptcha/api.js'></script>
  34.      <!-- END PAGE LEVEL STYLES -->
  35.    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  36.     <!--[if lt IE 9]>
  37.       <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  38.       <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  39.     <![endif]-->
  40. </head>
  41.     <!-- END HEAD -->
  42.  
  43.     <!-- BEGIN BODY -->
  44. <body >
  45.  
  46.    <!-- PAGE CONTENT -->
  47.     <div class="container">
  48.     <div class="text-center">
  49.        
  50.         <a href="index.php"><img src="assets/img/logo1.png" width="250" height="80" alt="" /></a>
  51.     </div>
  52.     <div class="tab-content">
  53.         <div id="login" class="tab-pane active">
  54.            
  55.                         <!-- INI PROSES LOGIN -->
  56.                        
  57.         <?php if(isset($_POST['submit'])) {
  58. $username = $_POST['username'];
  59. $pass = $_POST['password'];
  60. //Captcha
  61. $captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response']:'';
  62. $secret_key = '6LfuZTEUAAAAAARv6RIb4k2xeMA4L-lEC-PyyXqp';
  63.  
  64. $cekuser = mysql_query("SELECT * FROM user WHERE username = '$username'");
  65. $jumlah = mysql_num_rows($cekuser);
  66. $get = mysql_fetch_array($cekuser);
  67. $angka = $get['max'];
  68.  
  69. //Cek IP
  70. $cekip = mysql_query("SELECT * FROM session WHERE username = '$username'");
  71. $ccc = mysql_fetch_array($cekip);
  72. $ipnya = $ccc['ip'];
  73.  
  74. //////=============DAPAT IP=============\\\\\\\\\\\
  75. $ip = $_SERVER['REMOTE_ADDR'];
  76. //================================================\\
  77.  
  78. //Verifikasi user
  79. $option = ['cost'=>10,];
  80. $hash = password_hash($pass, PASSWORD_DEFAULT, $option);
  81.  
  82. if($jumlah == 0) { // user tdk terdaftar ?>
  83. <div class="alert alert-danger"> <strong>Username atau Password Tidak Terdaftar.</strong> </div>
  84. <script>
  85. swal("Error!", "Data tidak terdaftar.", "error");
  86. </script>
  87.  
  88. <? } else if($pass <> $get['password']) { ?>
  89. <div class="alert alert-danger"> <strong>Username atau Password salah!</strong> </div>
  90. <script>
  91. swal("Error!", "Data yang dimasukkan tidak sesuai.", "error");
  92. </script>
  93.  
  94. <? } else if($ipnya != $ip) { // user tdk terdaftar ?>
  95. <div class="alert alert-danger"> <strong>Gagal</strong> IP anda berubah, silahkan login kembali. </div>
  96.     <? $destroyy = mysql_query("UPDATE session SET ip = '$ip' WHERE username = '$username");
  97.    
  98.  }else if ($captcha != ''){
  99.     $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secret_key) . '&response=' . $captcha;  
  100.    $recaptcha = file_get_contents($url);
  101.    $recaptcha = json_decode($recaptcha, true);
  102.         if (!$recaptcha['success']) { ?>
  103.           <div class="alert alert-danger"> <strong>Harap Verifikasi Captcha !</strong> </div>
  104.         <? } else { ?>
  105.             <div class="alert alert-success"> <center><strong>Login Berhasil, Tunggu sebentar!</strong><br><font size="1">Jika tidak dialhikan, <a href="index.php">Klik Disini</a></font></center></div>
  106.  
  107.                 <? if ($_SESSION['username'] = $get['username']){
  108.                     //$snd = mysql_query("INSERT INTO session (username) VALUES ('$usernamee')");
  109.                     $snd = mysql_query("UPDATE session SET ip = '$ip' WHERE username = '$username'");
  110.                 $usermax =  mysql_query("UPDATE user SET max='1' WHERE username= '$username'") or die (mysql_error()); ?>
  111.                                 <script language=javascript>
  112.             setTimeout("location.href='http://pulsa.lengkomedia.com'", 5000);
  113.             </script>
  114.                 <? }
  115.                
  116.              } ?>
  117. <? } else { ?>
  118.    
  119.     <div class="alert alert-danger"> <strong>Harap Verifikasi Captcha !</strong> </div>
  120.    
  121. <? }  }   ?>
  122.  
  123.                
  124.             <form class="form-signin" id="login-form" method="post" name="login-form" method="POST">
  125.                 <p class="text-muted text-center btn-block btn btn-primary btn-rect">
  126.                     Masukan Username & Password anda!
  127.                 </p>
  128.                 <input type="text" id="username" name="username" placeholder="Username" class="form-control" required/>
  129.                 <input type="password" id="password" name="password" placeholder="Password" class="form-control" required/>
  130.                 <div class="g-recaptcha" data-sitekey="6LfuZTEUAAAAALTt1YOckNfBEDZDnzA_5o2KGaFB"></div>
  131.                 <button class="btn text-muted text-center btn-info"  name="submit" type="submit">Masuk</button>
  132.                 <button class="btn text-muted text-center btn-default"  type="reset">Clear/Reset</button>
  133.             </form>
  134.         </div>
  135.         <!-- BEGIN FORGOT PASSWORD
  136.         <div id="forgot" class="tab-pane">
  137.             <form action="index.html" class="form-signin">
  138.                 <p class="text-muted text-center btn-block btn btn-primary btn-rect">Enter your valid e-mail</p>
  139.                 <input type="email"  required="required" placeholder="Your E-mail"  class="form-control" />
  140.                 <br />
  141.                 <button class="btn text-muted text-center btn-success" type="submit">Recover Password</button>
  142.             </form>
  143.         </div>
  144.         <!-- END FORGOT PASSWORD -->
  145.         <div id="signup" class="tab-pane">
  146.  
  147.             <form method="post" name="pendaftaran" class="form-signin">
  148.                 <p class="text-muted text-center btn-block btn btn-primary btn-rect">Please Fill Details To Register</p>
  149.                 <input type="text" name="username" placeholder="Username" class="form-control" required/>
  150.                 <input type="email" name="email" placeholder="Email" class="form-control" required/>
  151.                 <input type="password" name="passwor" placeholder="password" class="form-control" required/>
  152.                
  153.                 <button class="btn text-muted text-center btn-success" type="submit" name="add">Register</button>
  154.             </form>
  155.         </div>
  156.     </div>
  157.     <div class="text-center">
  158.         <ul class="list-inline">
  159.             <li><a class="text-muted" href="#login" data-toggle="tab">Login</a></li>
  160.             <!-- END FORGOT PASSWORD <li><a class="text-muted" href="#forgot" data-toggle="tab">Forgot Password</a></li> -->
  161.             <li><a class="text-muted" href="forgot.php">Forgot your Password?</a></li>
  162.             <li><a class="text-muted" href="daftar.php">Signup</a></li>
  163.             <li><a class="text-muted" href="listharga.php">List Harga</a></li>
  164.         </ul>
  165.     </div>
  166.  
  167.  
  168. </div>
  169.  
  170.       <!--END PAGE CONTENT -->    
  171.          
  172.       <!-- PAGE LEVEL SCRIPTS -->
  173.       <script src="assets/plugins/jquery-2.0.3.min.js"></script>
  174.       <script src="assets/plugins/bootstrap/js/bootstrap.js"></script>
  175.    <script src="assets/js/login.js"></script>
  176.    
  177.       <!--END PAGE LEVEL SCRIPTS -->
  178.  
  179. </body>
  180.     <!-- END BODY -->
  181. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement