Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require 'connect.php';
- echo "Test";
- //Hash passwords using MD5 hash (32bit string).
- $username=($_POST['username']);
- $password=MD5($_POST['password']);
- //Get required information from admin_logins table
- $sql=mysql_query("SELECT * FROM admin_logins WHERE Username='$username' ");
- $row=mysql_fetch_array($sql);
- //Check that entered username is valid by checking returned UserID
- if($row['UserID'] === NULL){
- header("Location: ../adminlogin.php?errCode=UserFail");
- }
- //Where username is correct, check corresponding password
- else if ($row['UserID'] != NULL && $row['Password'] != $password){
- header("Location: ../adminlogin.php?errCode=PassFail");
- }
- else{
- $_SESSION['isAdmin'] = true;
- header("Location: ../admincontrols.php");
- }
- mysql_close($con);
- ?>
- <?php
- $con = mysql_connect("localhost","username","password");
- if(!$con) {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("dbname", $con);
- ?>
- SELECT *
- FROM admin_logins
- WHERE `Username` = '$username'
- <?php
- $stmt = $dbh->prepare("SELECT * FROM admin_logins WHERE `Username` = ?");
- $stmt->bindParam(1, $username);
- if ($stmt->execute(array($_GET['name']))) {
- while ($row = $stmt->fetch()) {
- print_r($row);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement