Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if($_SESSION['authenticate'] == "")
  5.     {
  6.  
  7.     //declaration of variables
  8.         //creating connection to serve
  9.     $con = mysql_connect("localhost","dbg","password") 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.    
  18.     $result = mysql_query("SELECT Number FROM $table WHERE Username = '$username' AND Password = '$password'");
  19.     $row = mysql_num_rows($result);
  20.     $id = $row['Number'];
  21.    
  22.     if($id > 0)
  23.     {
  24.     session_start();
  25.     $_SESSION['authenticate'] = 1;
  26.     header("Location: upload_form-1.php");
  27.     }
  28.     else
  29.     {
  30.     session_start();
  31.     $_SESSION['atuthenticate'] = "";
  32.     echo $id;
  33.     //header("Location: display.php");
  34.     }
  35.  
  36.    
  37.     //closing server connection
  38.     mysql_close($con);
  39.  
  40.     }
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement