Sinisterly
Simple Secure PHP sessions. - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: Simple Secure PHP sessions. (/Thread-Simple-Secure-PHP-sessions)



Simple Secure PHP sessions. - TeraByTe - 06-21-2011

This will set our session as the current time (md5 encoded)
Open PHP Tags
PHP Code:
<?php

Start the session :
PHP Code:
session_start();

set our session "sid" as an md5 encoded version of our current time :
PHP Code:
$_SESSION['sid'] = md5(time());

set variable $sid as our session :
PHP Code:
$sid = $_SESSION['sid'];

display our session to the page :
PHP Code:
echo $sid;

Close PHP tags
PHP Code:
?>

Full code :
Spoiler:
PHP Code:
<?php session_start(); $_SESSION['sid'] = md5(time()); $sid = $_SESSION['sid']; echo $sid; ?>


Live Demo: http://dev.hallwayinsider.com/ses.php
Our next tutorial : Cookies



RE: Simple Secure PHP sessions. - slbmeh - 06-29-2011

That's just a standard php session storing a hash of the time. What makes it secure?