29 lines
773 B
PHP
29 lines
773 B
PHP
<?php
|
|
$host_name = "localhost";
|
|
$database_name = "volvo";
|
|
$database_user = "root";
|
|
$database_password = "root";
|
|
|
|
|
|
$conn = mysqli_connect($host_name, $database_user, $database_password, $database_name, 3306);
|
|
|
|
$username = $_SESSION['username'];
|
|
$password = $_SESSION['userpassword'];
|
|
//session_cache_expire(60);
|
|
if (!validate($username, $password, $conn)) {
|
|
@header("Location: index.php?msg=Session Expired Please Login Again");
|
|
}
|
|
function validate($username, $password, $conn)
|
|
{
|
|
if ($username == "" || $password == "") {
|
|
return false;
|
|
}
|
|
$sql = "select * from tbl_users where user_name='" . $username . "' AND user_password='" . $password . "'";
|
|
$result = mysqli_query($conn, $sql);
|
|
if (mysqli_num_rows($result) > 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|