I have an
http://example.com/DL/
directory with free access for anyone, now I wanna to deny access for unauthorized users so I writte very simple index.php with code
<?php
include('config.php');
session_start();
$result = (mysql_query("SELECT * FROM accounts WHERE hash='".$_SESSION['hash']."' ");
$row = mysql_fetch_array(result);
if($row['access']) {
return true;
} else {
header("location: /login.php");
}
?>
question: is there way to setup .htaccess to check if index.php returns true every time user request
http://example.com/DL/*
?
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.