Advertisement
Guest User

Untitled

a guest
Jan 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.39 KB | None | 0 0
  1. <?php
  2.     require 'NFSKGBER7GI5HGIT7G54IHGJHGDFK/config.php';
  3.    
  4.     error_reporting(E_ERROR | E_PARSE);
  5.  
  6.    
  7.     // Get data from FORM
  8.         $username = $_GET["u"];
  9.         $password = $_GET["p"];
  10.         $action = $_GET["a"];
  11.        
  12.         //Remove '
  13.         //$username = str_replace("'", "", $username1);
  14.         //$password = str_replace("'", "", $password1);
  15.        
  16.  
  17.     if($action == 'login') {
  18.         $errMsg = '';
  19.  
  20.        
  21.        
  22.        
  23.  
  24.         if(isset($_GET['u']) && !isset($_GET['p'])){
  25.            
  26.             echo 'invalid login';
  27.            
  28.  
  29.         }else{
  30.  
  31.             try {
  32.                 $stmt = $connect->prepare('SELECT id, fullname, username, password, secretpin FROM pdo WHERE username = :username');
  33.                 $stmt->execute(array(
  34.                     ':username' => $username
  35.                     ));
  36.                 $data = $stmt->fetch(PDO::FETCH_ASSOC);
  37.  
  38.                 if($data == false){
  39.                     //$errMsg = "User $username not found.";
  40.                     echo 'invalid login';
  41.                 }
  42.                 else {
  43.                     if($password == $data['password']) {
  44.                         $_SESSION['name'] = $data['fullname'];
  45.                         $_SESSION['username'] = $data['username'];
  46.                         $_SESSION['password'] = $data['password'];
  47.                         $_SESSION['secretpin'] = $data['secretpin'];
  48.                        
  49.                         //User Loggedin
  50.                         echo 'valid login';
  51.  
  52.                         //header('Location: dashboard.php');
  53.                         //exit;
  54.                     }
  55.                     else
  56.                         echo 'invalid login';
  57.                 }
  58.             }
  59.             catch(PDOException $e) {
  60.                 //$errMsg = $e->getMessage();
  61.                 echo 'server down';
  62.             }
  63.            
  64.     }
  65.        
  66.     }else{
  67.             echo 'no action';
  68.     }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement