PHP Cache
Posted: Thu Aug 22, 2002 5:43 pm
Hi All,
I am just learning PHP. Please exscuse my newbieness.
I have a php page that keeps the form values after submitting it to the next page. I don't mind the php variables, it's the form variables like credit card # that I don't want cached.
This is somewhat how the page looks:
The no-cache is not working!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<title>Frank's Travel Services - Hotels</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--#include file="meta.htm" -->
<link href="assets/css/mysite.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "username";
$Password = "password";
$DBName = "database";
$TableName = "$HotelSelect";
print ("<p><b><font #003399>Hotel:</font></b> $TableName</p>");
$TableName = ereg_replace("[\r\n\t\v\ ]", "", trim($TableName));
$Rooms = "$Rooms";
$CheckIn = "$CheckIn";
$CheckOut = "$CheckOut";
$price = 0;
print ("<p><b><font #003399>Check In Date:</font></b> $CheckIn</p>");
print ("<p><b><font #003399>Check Out Date:</font></b> $CheckOut</p>");
$Link = mysql_connect ($Host, $User, $Password);
$Query02 = "SELECT Price FROM $TableName WHERE (Dates BETWEEN '$CheckIn' AND '$CheckOut')";
mysql_select_db($DBName) or die(mysql_error());
$Result02 = mysql_query ($Query02) or die(mysql_error().'<br />'.$Query02);
while ($Row = mysql_fetch_array ($Result02)) {
$price = $price + $Row[Price];
}
print ("</TABLE>\n");
$TotalPrice = $Rooms * $price;
print ("<p><strong><font color='#003399' size='3'>TOTAL COST:</font></strong> <b>$$TotalPrice.00<b></p>");
mysql_close ($Link);
$CheckInDate = ("$CheckIn");
$CheckOutDate = ("$CheckOut");
?>
<form action="hotels02.php" method="post" name="HotelForm" id="HotelForm">
<input name="CardNumber" type="text" id="CardNumber">
<input name="CheckOut" type="hidden" id="CheckOut" value="<? echo $CheckOut ?>">
<input name="CheckIn" type="hidden" id="CheckIn" value="<? echo $CheckIn ?>">
<input name="Rooms" type="hidden" id="Rooms" value="<? echo $Rooms ?>">
<input name="TotalPrice" type="hidden" id="TotalPrice" value="<? echo $TotalPrice ?>">
<input name="HotelSelect" type="hidden" id="HotelSelect" value="<? echo $HotelSelect ?>">
<input name="Submit2" type="submit" value="Submit">
</form>
</body>
</html>
I am just learning PHP. Please exscuse my newbieness.
I have a php page that keeps the form values after submitting it to the next page. I don't mind the php variables, it's the form variables like credit card # that I don't want cached.
This is somewhat how the page looks:
The no-cache is not working!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<title>Frank's Travel Services - Hotels</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--#include file="meta.htm" -->
<link href="assets/css/mysite.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "username";
$Password = "password";
$DBName = "database";
$TableName = "$HotelSelect";
print ("<p><b><font #003399>Hotel:</font></b> $TableName</p>");
$TableName = ereg_replace("[\r\n\t\v\ ]", "", trim($TableName));
$Rooms = "$Rooms";
$CheckIn = "$CheckIn";
$CheckOut = "$CheckOut";
$price = 0;
print ("<p><b><font #003399>Check In Date:</font></b> $CheckIn</p>");
print ("<p><b><font #003399>Check Out Date:</font></b> $CheckOut</p>");
$Link = mysql_connect ($Host, $User, $Password);
$Query02 = "SELECT Price FROM $TableName WHERE (Dates BETWEEN '$CheckIn' AND '$CheckOut')";
mysql_select_db($DBName) or die(mysql_error());
$Result02 = mysql_query ($Query02) or die(mysql_error().'<br />'.$Query02);
while ($Row = mysql_fetch_array ($Result02)) {
$price = $price + $Row[Price];
}
print ("</TABLE>\n");
$TotalPrice = $Rooms * $price;
print ("<p><strong><font color='#003399' size='3'>TOTAL COST:</font></strong> <b>$$TotalPrice.00<b></p>");
mysql_close ($Link);
$CheckInDate = ("$CheckIn");
$CheckOutDate = ("$CheckOut");
?>
<form action="hotels02.php" method="post" name="HotelForm" id="HotelForm">
<input name="CardNumber" type="text" id="CardNumber">
<input name="CheckOut" type="hidden" id="CheckOut" value="<? echo $CheckOut ?>">
<input name="CheckIn" type="hidden" id="CheckIn" value="<? echo $CheckIn ?>">
<input name="Rooms" type="hidden" id="Rooms" value="<? echo $Rooms ?>">
<input name="TotalPrice" type="hidden" id="TotalPrice" value="<? echo $TotalPrice ?>">
<input name="HotelSelect" type="hidden" id="HotelSelect" value="<? echo $HotelSelect ?>">
<input name="Submit2" type="submit" value="Submit">
</form>
</body>
</html>