function fp_get_session_id_from_str
Search API
7.x misc.inc | fp_get_session_id_from_str($str) |
6.x misc.inc | fp_get_session_id_from_str($str) |
This will validate the session str (or the session_id.
See also
fp_get_session_str()) and return back either FALSE
1 call to fp_get_session_id_from_str()
File
- includes/
misc.inc, line 1676 - This file contains misc functions for FlightPath
Code
function fp_get_session_id_from_str($str) {
// We expect $str to look like this:
// session_id~_md5(session_id . ip . php_uname('n'))
$temp = explode("~_", $str);
$session_id = trim($temp [0]);
$hash = trim($temp [1]);
$ip = @$_SERVER ["REMOTE_ADDR"];
if ($ip == "") {
$ip = "000";
}
$test_hash = md5($session_id . $ip . php_uname('n'));
if ($test_hash === $hash) {
// Success!
return $session_id;
}
return FALSE;
}