Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("dbConnect.php");
- if(isset($_GET['Login'])){
- //$myusername = $_GET['operator_id'];
- $key = $_GET['telegram_key'];
- //$query = $db->prepare("SELECT * FROM telegramlog WHERE operator_id = ? and telegram_key = ?;");
- $query = $db->prepare("SELECT operators.operator_id, telegramlog.telegram_key FROM
- telegramlog LEFT JOIN operators ON telegramlog.operator_id = operators.operator_id WHERE telegramlog.telegram_key = ? ;");
- $query->execute(array($key));
- $count = $query->rowCount();
- $result = $query->fetchAll();
- if($result){
- header('location: user.php');
- }
- else{
- echo ' no result';
- }
- }
- if(isset($_POST['Login'])){
- $username=$_POST['user'];
- $password=$_POST['pass'];
- $query = $db->prepare("SELECT * FROM operators WHERE email = ? and heslo = ?;");
- $result = $query->execute(array($username,$password));
- if($result){
- while($row = $query ->fetch(PDO::FETCH_ASSOC)){
- echo '<script type="text/javascript">alert("You are logged in as user '. $row['users'] . '")</script>';
- if($row['users']=="a"){
- header('location: admin.php');
- }
- elseif($row['users']=="b"){
- header('location: leader.php');
- }
- elseif($row['users']=="c"){
- header('location: user.php');
- }
- else{
- echo ' no result';
- }}}}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement