Forum Moderators: coopster
B) It give an error "unexpected string at line 5 which is $tokenstr = (str) date('W') . $salt;
<<<<<<<<<<
ini_set('session.use_only_cookies', true);
session_start();
$salt = 'YourSpecialValueHere';
$tokenstr = (str) date('W') . $salt;
$token = md5($tokenstr);
if (!isset($_REQUEST['token']) ¦¦ $_REQUEST['token']!= $token) {
// prompt for login
exit;
}
$_SESSION['token'] = $token;
>>>>>>>>>>>>>
thanks
$tokenstr = (string)date('W').$salt;
date() returns a string anyway, so you don't need the cast in there so you can just omit it:
$tokenstr = date('W').$salt;
Good luck :)
also added below $_SESSION['token']=$token;
output_add_rewrite_var ('token', $token);
acts as if we were hard coding
.php?$token in an URI
last use $_get
to grab $_token from the URI
and compare the token caried with a SESSION to the token carried by the URI
It kind on making sense but I would like confirmation from the "high spirits"
[edited by: henry0 at 9:49 pm (utc) on May 2, 2007]
And fixation:
is an attack that tricks the user into a seesion ID chosen by the attacker
The more you learn about defense the more you type.
Are attacks the result of keyboard factories seeking business? :)
I've sounded silly in posts before, but gah!
I told you I don't know much about session security ;) Guess that means I'll have some reading to do tonight!
Apparently there are some classes that already do this for you: phpclasses [google.com].
[edited by: eelixduppy at 9:51 pm (utc) on May 2, 2007]