note 82957 added to function.session-start
| From: | AnthonyCatelp at NOSPAM dot rabol dot fr | Date: | Sat, 03 May 2008 15:02:37 +0000 |
| Subject: | note 82957 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139024@lists.php.net to get a copy of this message | ||
session_start() generate a warning if PHPSESSID contains illegal characters
Warning: session_start() [function.session-start]: The session id contains illegal characters, valid
characters are a-z, A-Z, 0-9 and '-,' in /home/para/dev/mon_site/header.php on line 17
To avoid i wrote this :
<?php
function my_session_start()
{
if (isset($_COOKIE['PHPSESSID'])) {
$sessid = $_COOKIE['PHPSESSID'];
} else if (isset($_GET['PHPSESSID'])) {
$sessid = $_GET['PHPSESSID'];
} else {
session_start();
return false;
}
if (!preg_match('/^[a-z0-9]{32}$/', $sessid)) {
return false;
}
session_start();
return true;
}
?>
----
Server IP: 217.174.223.124
Probable Submitter: 82.231.25.80
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/82957
Del: integrated -- https://master.php.net/note/delete/82957/integrated
Del: useless -- https://master.php.net/note/delete/82957/useless
Del: bad code -- https://master.php.net/note/delete/82957/bad+code
Del: spam -- https://master.php.net/note/delete/82957/spam
Del: non-english -- https://master.php.net/note/delete/82957/non-english
Del: in docs -- https://master.php.net/note/delete/82957/in+docs
Del: other reasons-- https://master.php.net/note/delete/82957
Reject -- https://master.php.net/note/reject/82957
Search -- https://master.php.net/manage/user-notes.php