more session stuff

This commit is contained in:
Dan Buch 2010-12-31 14:12:18 -05:00
parent ccc7b95af3
commit f0c5b3b756
3 changed files with 58 additions and 1 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
docroot/nginx.conf
docroot/html/writable/*.*
docroot/php.ini
docroot/session.save_path/sess_*

56
docroot/html/sessions.php Normal file
View File

@ -0,0 +1,56 @@
<?php
if ($_POST['destroy-session'] != "yes") {
session_start();
$_SESSION['fingerprint'] = md5('SECRET-SALT' . $_SERVER['HTTP_USER_AGENT']);
} else {
session_start();
session_regenerate_id();
$_SESSION['fingerprint'] = md5('SECRET-SALT' . $_SERVER['HTTP_USER_AGENT']);
}
require_once("_head.php");
mkheader("sessions!", "#aea");
?>
<body>
<!-- ======================================================= -->
<?php
if ($_POST['destroy-session'] == "yes") {
session_destroy();
?>
<p>Successfully destroyed session</p>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">clear this</a>
<?php
} else {
?>
<form name="session_destroy" action="" method="POST">
<input type="hidden" name="destroy-session" value="yes" />
<input type="submit" name="submit" value="Destroy Session" />
</form>
<?php
}
?>
<!-- ======================================================= -->
<pre><?php
print("Current session data:\n");
print_r($_SESSION);
?></pre>
<!-- ======================================================= -->
<pre><?php
print("Current cookie data:\n");
print_r($_COOKIE);
?></pre>
</body>
</html>

View File

@ -765,7 +765,7 @@ auto_append_file =
;
; PHP's built-in default is text/html
; http://php.net/default-mimetype
default_mimetype = "text/plain"
default_mimetype = "text/html"
; PHP's default character set is set to empty.
; http://php.net/default-charset