Advertisement
Guest User

Untitled

a guest
May 16th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. include "top.php";
  3. include "connect.php";
  4.  
  5. $admin_username=$_POST['admin_username']; // Gets the inputted username from the form
  6. $admin_password=$_POST['admin_password']; // Gets the inputted password from the form
  7. $time=time();                 // Gets the current server time
  8.  
  9. print_r($admin_username.' - '.$admin_password);
  10. $query="SELECT * FROM admin WHERE username='".$admin_username."' AND password='".md5($admin_password)."'";
  11. $result=mysql_query($query,$connect);
  12. //row=mysql_fetch_array($result,MYSQL_ASSOC);
  13. print_r($query);
  14.  
  15. if (mysql_num_rows($result)) // If the username and password are correct do the following;
  16. {
  17.   $_SESSION['admin_loggedin']=1;
  18.  
  19.   setcookie("eBazar[admin_username]",$admin_username,0); // Sets the cookie username
  20.   setcookie("eBazar[admin_password]",$admin_password,0); // Sets the cookie password
  21.  
  22.   exit();
  23. }
  24. else    // If login is unsuccessful forwards the user back to the index page with an error
  25. {
  26.    header('Location: spravca_index.php');
  27.    exit();
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement