Tuesday, 15 November 2011

Avoid page expired with php

<?php
session_start();
ini_set('session.cache_limiter', 'private');
$do = '';
if (isset($_GET['do'])) {$do = $_GET['do'];}
if ($do == 'post') {
header('Location: http://127.0.0.1/LDDShop/TestX.php?do=end');
if (isset($_SESSION['X'])) {
$_SESSION['X'] = $_SESSION['X'] + 1;
} else {
$_SESSION['X'] = 1;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
print_r($_GET);
if (isset($_SESSION['X'])) {
echo $_SESSION['X'];
} else {echo 'No session X';}
?>
<form action="TestX.php?do=post" method="post">
This is a test.
<input name="Test" id="Test" type="text" value="<?php if (isset($_SESSION['X'])) {echo $_SESSION['X'];} ?>" size="22" maxlength="22">
<input name="submitme" type="submit" value="Submit Me!">
</form>
</body>
</html>

Sunday, 9 October 2011

You keep reading, coding, learning new technologies to keep you in the game, and all of the sudden you realize that someone has already made a suite for almost everything, and all those scattered parts of endless code written by hand is now not handy at all...