Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'DB_login.php';
- require_once 'UTILS.php';
- session_start();
- $idcheck = $_POST["username"];
- $idpassword = $_POST["password"];
- //Create connection to database
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT username
- FROM users WHERE username='$idcheck' and password = '$idpassword'";
- $result = $conn->query($sql);
- //checkErrorReturn is a simple error-reporting and link-offering
- //function written in UTILS.php
- //Generally, you should put such auxliary functions in separte
- //files which can be imported from several scripts
- checkErrorReturn
- ($result->num_rows == 0,
- "This username does not exist.",
- "Back to the signin page",
- "index.html");
- //$row = $result->fetch_assoc();
- //Store the alienname in the session array, to make it available
- //to the next page, namely alienPicturesPage
- $_SESSION['username'] = $idcheck;
- //Instruct client to switch to a new location:
- header ("Location: UserHomePage2.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement