Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. //session_start();
  4. include 'dbConnect.php';
  5. function loginaction(){
  6. include 'dbConnect.php';
  7. $time = time();
  8.  
  9. if(isset($_REQUEST['Key'])&& isset($_REQUEST['Login'])){
  10. //if(isset($_GET['Key'])){
  11. //$myusername = $_GET['operator_id'];
  12. $key = $_GET['telegram_key'];
  13. $username=$_POST['user'];
  14. $password=$_POST['pass'];
  15.  
  16.  
  17. $query = $db->prepare("SELECT operators.operator_id, telegramlog.telegram_key FROM
  18. telegramlog LEFT JOIN operators ON telegramlog.operator_id = operators.operator_id WHERE telegramlog.telegram_key = ? ;");
  19. $query->execute(array($key));
  20. $result = $query->fetchAll();
  21.  
  22. $squery = $db->prepare("SELECT * FROM operators WHERE email = ? and heslo = ?;");
  23. $sResult = $squery->execute(array($username,$password));
  24.  
  25.  
  26.  
  27. if($result){
  28. header('location: user.php');
  29. }
  30. elseif($sResult){
  31. while($row = $squery ->fetch(PDO::FETCH_ASSOC)){
  32. echo '<script type="text/javascript">alert("You are logged in as user '. $row['users'] . '")</script>';
  33. if($row['users']=="a"){
  34. header('location: admin.php');
  35. }
  36. elseif($row['users']=="b"){
  37. header('location: leader.php');
  38. }
  39. else($row['users']=="c"){
  40. header('location: user.php');
  41. }}}
  42. else{
  43. echo ' no result';
  44. }}}}
  45. loginaction();
  46.  
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement