Advertisement
Guest User

Untitled

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