Hi guys,
I have functions which are used for storing, reading, and destroying sessions in a database but I get an error when I session_start() and try to set one after I have called session_set_save_handler(...My Functions...).
session_set_save_handler
Moderator: General Moderators
Reply
Hi guys,
Sorry for misleading you. I have found the bug. It is in the following code:
Sorry for misleading you. I have found the bug. It is in the following code:
Code: Select all
/*******************************************************************************************************/
//Vars and Arrs
$var_names = array();
$referer = "";
$host = "";
$host_arr = array();
$file_num = 0;//int
$file = "";
/*******************************************************************************************************/
/*******************************************************************************************************/
//Check where a request came from
$referer = $_SERVER["HTTP_REFERER"];
//Extract the host only(Domain)
$host = str_replace("http://", "", $referer);
$host = str_replace("www.", "", $host);
$host_arr = explode("/", $host);
$host = $host_arr[0];
//Check
if(!strcmp($host, $HOST_DOMAIN)) {
}
else {
exit()
}
/*******************************************************************************************************/Code: Select all
Do you spot an error?
Can this cause my sessions not to run?
Any suggestions?- aaronhall
- DevNet Resident
- Posts: 1040
- Joined: Tue Aug 13, 2002 5:10 pm
- Location: Back in Phoenix, missing the microbrews
- Contact:
Did you find the bug, or do you assume that it's in this block? I don't see anything here that would cause your sessions to explode, though you might use parse_url() to extract the host from HTTP_REFERER instead.