Advertisement
Crecket

Untitled

Apr 2nd, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.     $conn = new PDO("mysql:host=$servername:3307;dbname=$dbname", $username, $password);
  3.     $conn->setAttribute(PDO::ATTR_ERRMODE,  PDO::ERRMODE_EXCEPTION, PDO::ERRMODE_SILENT);
  4.  
  5.     //gets the userid/usergroup from the users table
  6.     $sql = "SELECT Usergroup, user_ID FROM users WHERE Username = :username";
  7.     $sth = $conn->prepare($sql);
  8.     $sth->bindParam(':username', $testname, PDO::PARAM_STR);
  9.     $sth->execute();
  10.     $row = $sth->fetch();
  11.     //a table with all the failed logins is set to 0 if it exists for the username
  12.     $sql = "UPDATE failed_logins SET attempted = 0 WHERE username = :username";
  13.     $sth = $conn->prepare($sql);
  14.     $sth->bindParam(':username', $testname, PDO::PARAM_STR);
  15.     $sth->execute();
  16.  
  17.     //set the username/group/userid
  18.     $_SESSION['crecketgaming_usergroup'] = $row['Usergroup'];
  19.     $_SESSION['crecketgaming_username'] = $testname;
  20.     $_SESSION['crecketgaming_userid'] = $row['user_ID'];
  21.     include('sessiontest.php');
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement