Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //session_start();
- include 'dbConnect.php';
- function loginaction(){
- include 'dbConnect.php';
- $time = time();
- if(isset($_REQUEST[βloginβ)])){
- $key = $_GET['telegram_key'];
- $username=$_POST['user'];
- $password=$_POST['pass'];
- $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));
- $result = $query->fetchAll();
- $squery = $db->prepare("SELECT * FROM operators WHERE email = ? and heslo = ?;");
- $sResult = $squery->execute(array($username,$password));
- if($result){
- header('location: user.php');
- }
- elseif($sResult){
- while($row = $squery ->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';
- }
- }
- }
- else{
- echo ' no result';
- }
- }
- }
- loginaction();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement