code share
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Access level login with php

Go down

Access level login with php Empty Access level login with php

Post by r_kelly Sun Nov 27, 2016 1:58 pm

<?php

session_start();
if(!isset($_SESSION['user']))
{
$_SESSION['student_id'] = 0;
$_SESSION['access'] = 0;
}

$user = $_POST['username'];
$pass = $_POST['password'];


$mysqli = new mysqli("localhost","root","","marks");
$res = $mysqli->query("SELECT student_id,accessLevel FROM user WHERE email = '".$user."' AND password = '".$pass."'");


if($row = $res->fetch_assoc())
{
$_SESSION['student_id'] = $row['student_id'];
$_SESSION['access'] = $row['accessLevel'];
}
else
{

}

?>

r_kelly
Admin

Posts : 2
Join date : 2016-11-27

https://codeaccess.board-directory.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum