Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $pwd = "";
- $db = "fypforum";
- $con = ($GLOBALS["___mysqli_ston"] = mysqli_connect($host, $user, $pwd)) or die("Could not connect");
- mysqli_select_db($con, $db) or die("No database");
- ?>
- <?php
- session_start();
- include '../functions/db.php';
- $username = $_POST['username'];
- $password = $_POST['password'];
- $pwd = md5($password);
- $username = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $_POST['username']);
- $password = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $_POST['password']);
- $query = "SELECT * FROM tblaccount WHERE username = '$username' AND password = '$pwd'";
- $result = mysqli_query($GLOBALS["___mysqli_ston"], $query) or die ("Verification error");
- $array = mysqli_fetch_array($result);
- if ($array['username'] == $username){
- $_SESSION['username'] = $username;
- $_SESSION['fname'] = $array['fname'];
- $_SESSION['lname'] = $array['lname'];
- $_SESSION['user_Id'] = $array['user_Id'];
- header("Location: list.php");
- }
- else{
- echo '<script language="javascript">';
- echo 'alert("Incorrect username or password")';
- echo '</script>';
- echo '<meta http-equiv="refresh" content="0;url=../index.php" />';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement