Guest User

Untitled

a guest
Sep 4th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php session_start()?>
  2. <?php
  3. header("content-type: Access-Control-Allow-Origin: *");
  4. header("content-type: Access-Control-Allow-Methods: GET");
  5.  
  6. header("content-type: text/javascript");
  7.  
  8. if(isset($_GET['login']) && isset($_GET['callback']) && isset($_GET['password']))
  9. {
  10.  
  11. $obj->password=$_GET['password'];
  12.  
  13. $user=$_GET['login'];
  14. $pass=$_GET['password'];
  15.  
  16.  
  17. $bd_lacz = new mysqli('localhost', 'pbl', 'pbl', 'pbl');
  18. $quest = 'select * from accounts ' /* sending login and pass to the database */
  19. . "where login='$user' "
  20. . " and password='$pass'";
  21.  
  22. $result = $bd_lacz->query($quest);
  23. if ($result->num_rows > 0) {
  24. $_SESSION['prawid_uzyt'] = $user;
  25. $obj->message = "Logged " ;
  26. }
  27. else {
  28. $obj->message="Error";
  29. }
  30.  
  31. if(isset($_SESSION['prawid_uzyt'])){
  32. echo $_GET['callback']. '(' . json_encode($obj) . ');';}
  33. }
  34.  
  35. else {
  36.  
  37. echo("nothing is set");
  38.  
  39. }
  40. ?>
Add Comment
Please, Sign In to add comment