The session is a server side mechanism that does not prevent users from saving and editing their saved copy of the page.
users can save and edit pages anyway and they may also make some changes in the page code to crash the the serverside scripts. i know that we have to make strong scripts, but when a session is assined to a user,althoug he can save the page, but if he sends his edited pages by submiting a form,for example, his request is refused. because $_COOKIE['PHPSESSID'] is null and you know it better.
to add another security option, or make it difficult for a hacker to crash my site.
i wrote some code to achive my goal,it works. what's your opinion?
i think there's a way to solve this problem. when user clicks on a link named "link1" a request like this : ref.php?id=account is sent to the ref.php and user can't access the account.php directly.
in the ref.php some security check is done, then using following fsock instruction, we send a custom header to account.php :
$headerid='Dw1506';
$host="example.com";
$path=$_GET['id'] . 'php';
$port="80";
$tout = 5;
$handle = fsockopen($host, $port, $errno, $errstr,$tout);
fputs($handle,"GET $path HTTP/1.1\r\nHost: $host\r\nCustomHeader: $headerid\r\n\r\n");
while(!feof($handle))
echo fgets($handle,1024);
fclose($handle);
now in the account.php we can retrieve the header using:
$header=$_SERVER["HTTP_CUSTOMHEADER"];
if ($header!='dw1506') {
some code;
exit}