CollectiveIndustries / StarfleetDelta

Repository for Starfleet Delta Webpage, Database, and all in world scripts
https://www.starfleetdelta.com/
GNU General Public License v3.0
2 stars 4 forks source link

[Website] Session ID sanity checks #7

Open Morketh opened 8 years ago

Morketh commented 8 years ago

We need to validate the session ID by adding Sanity checks. A valid session id may consists of digits, letters A to Z (both upper and lower case), comma and dash. Described as a character class, it would be [-,a-zA-Z0-9]. A valid session id may have the length between 1 and 128 characters. A regular expression can be used to describe the desired format:

function is_valid_session($session_id)
{
    return preg_match('/^[-,a-zA-Z0-9]{1,128}$/', $session_id) > 0;
}