Advertisement
Guest User

LOGIN1.php

a guest
Mar 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. include ("../../mysql_connect.php");
  4. $pass = md5($_POST['password']);
  5. $sql="SELECT id,username FROM book_user WHERE password='{$pass}' and username='{$_POST["username"]}'";
  6.  
  7. if($vysledek=mysql_query($sql)){
  8.  
  9. if(mysql_num_rows($vysledek)>0){
  10.  
  11. session_name("WebsiteID");
  12.  
  13. session_start();
  14.  
  15. $_SESSION['username']=$_POST['username'];
  16.  
  17. $_SESSION['id']=mysql_result($vysledek,0,'id');
  18.  
  19. header("location:index.php");
  20.  
  21. }else{
  22.  
  23. header ("location:login_error.php");
  24.  
  25. }
  26.  
  27. }else{
  28.  
  29. echo mysql_error();
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement