Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3.  
  4. //function pre($array) { echo sprintf("<pre>%s</pre>", print_r($array, true)); }  pre($_POST);
  5.  
  6.  
  7.     //declaration of variables
  8.         //creating connection to serve
  9.     $con = mysql_connect("localhost","user","pass") or die('Could not connect to server' . mysql_error());
  10.     $table = "user_pass";
  11.     $db = "whackand_wikieng";
  12.  
  13.         //making user input safe
  14.     mysql_select_db($db, $con);
  15.     $username = mysql_real_escape_string($_POST['username']);
  16.     $password = mysql_real_escape_string($_POST['password']);
  17.     //$username = $_POST["username"];
  18.     //$password = $_POST["password"];
  19.  
  20.     $result = mysql_query("SELECT Number FROM $table WHERE Username = '$username' AND Password = '$password'");
  21.     $row = mysql_num_rows($result);
  22.    
  23.     //echo $row;
  24.     //echo $id;
  25.  
  26.     if($row > 0)
  27.     {
  28.     session_start();
  29.     $_SESSION['authenticate'] = 1;
  30.     header("Location: upload_form-1.php");
  31.     }
  32.     else
  33.     {
  34.     session_start();
  35.     $_SESSION['authenticate'] = '';
  36.     header("Location: not_allowed.php");
  37.     }
  38.  
  39.    
  40.     //closing server connection
  41.     mysql_close($con);
  42.  
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement