Jump to content

Cross server session stealing


nitation

Recommended Posts

Hi folks,

 

I want to verify if am on the right track. Am trying to prevent cross-server session stealing on my web page. This is what i came with so far. Do you think am on the right track?

 

<?php

IF (!isset($_SESSION['hash']) || ($_SESSION['hash'] != 
               md5($_SERVER['SERVER_NAME'].':'.$_SERVER['HTTP_HOST']))) {
	$_SESSION = array();
IF (isset($_COOKIE[session_name(md5($_SERVER['SERVER_NAME']))])) 
            {setcookie(session_name(md5($_SERVER['SERVER_NAME'])), '', time()-42000, '/');}
	session_destroy();
	session_start();
	$_SESSION['hash'] = md5($_SERVER['SERVER_NAME'].':'.$_SERVER['HTTP_HOST']);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/139961-cross-server-session-stealing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.