Dam annoying
| From: | David Costelloe | Date: | Mon, 14 Aug 2000 21:30:14 +0000 |
| Subject: | Dam annoying | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11686@lists.php.net to get a copy of this message | ||
Hi all,
I'm getting extremely frustrating with this header stuff, in ASP all I did was add the
response.Redirect with PHP all I get is 404 or page not found. Here is the code tell me please what
it is that is so hard to achieve.
<%
$IntCount = 0;
$strFileTo = $HTTP_POST_VARS["Product"];
$ErrMsg = "Sorry there was an error with the database.Please send Email to
welford-costelloe@home.com";
$strFileName = "Thank You for Downloading: ";
// Build the if statement
switch ($strFileTo)
{
Case "Protect Visual Basic EXE":
$strFileName .= $strFileTo;
$IntCount = 1;
$strFileTo = "http://www.mysite.com/dl/protvb60.zip";
break;
case "Extract Icon":
$strFileName .= $strFileTo;
$IntCount = 2;
$strFileTo = "http://www.mysite.com/dl/Extrac10.zip";
break;
case "Temp Cleaner":
$strFileName .= $strFileTo;
$IntCount = 3;
$strFileTo = "http://www.mysite.com/dl/TempCleaner.exe";
break;
case "BootDone 1.0":
$strFileName .= $strFileTo;
$IntCount = 4;
$strFileTo = "http://www.mysite.com/dl/Bootdone10.zip";
break;
case "ProjectX Source Code":
$strFileName .= $strFileTo;
$IntCount = 5;
$strFileTo = "http://www.mysite.com/dl/projectgroupx.zip";
break;
case "Agent Reader Source Code":
$strFileName .= $strFileTo;
$IntCount = 6;
$strFileTo = "http://www.mysite.com/dl/agentreader.zip";
break;
default:
$strFileTo = "";
break;
}
If ($strFileTo > "" )
{
$connection = mysql_connect("Enterprise","MrSpock","4077") or
die($ErrMsg);
$db = mysql_select_db("Startrek",$connection) or die(ErrMsg);
// Setup Database Connection
$MySql = "SELECT DL FROM products WHERE Num = $IntCount ";
$sql_result = mysql_query($MySql,$connection) or die($ErrMsg);
while ($row = mysql_fetch_array($sql_result))
{
$Total = $row["DL"];
}
$Total++;
// Set the date format to yyyy-mm-dd 00:00:00
$TheDate = date("Y-m-d");
$TheTime = date("G:i:s");
$MySql = "UPDATE products SET DL = '$Total', DLDate = '$TheDate',DLTime =
'$TheTime' WHERE Num = '$IntCount'";
mysql_free_result($sql_result);
$sql_result = mysql_query($MySql,$connection) or die($ErrMsg);
$P_Product = strtoupper($HTTP_POST_VARS["Product"]);
$P_Name = strtoupper($HTTP_POST_VARS["Name"]);
$P_Address = strtoupper($HTTP_POST_VARS["Address"]);
$P_Address1 = strtoupper($HTTP_POST_VARS["Address1"]);
$P_City = strtoupper($HTTP_POST_VARS["City"]);
$P_Prov = strtoupper($HTTP_POST_VARS["Prov"]);
$P_Country = strtoupper($HTTP_POST_VARS["Country"]);
$P_Date = date("Y-m-d");
$P_Time = date("G:i:s");
$MySql = "INSERT INTO downloads";
$MySql .= "(Product,Name,Address,Address1,City,Prov,Country,p_Date,p_Time)";
$MySql .= " VALUES ";
$MySql .= "( '$P_Product','$P_Name',";
if ( $P_Address1 > "" )
{
$MySql .= " '$P_Address','$P_Address1',";
}
else
{
$MySql .= " '$P_Address','NULL',";
}
$MySql .= " '$P_City','$P_Prov',";
$MySql .= " '$P_Country',";
$MySql .= " '$P_Date','$P_Time')";
$sql_result = mysql_query($MySql,$connection) or die($ErrMsg);
if ( $strFileName != "Download Failed Please Try again!" )
{
// This always fails no matter what I do
header("Location: $strFileTo");
}
}
Else
{
$strFileName ="Download Failed Please Try again!";
}
%>
<!-- Migrated to PHP4 from ASP -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Application Downloads</title>
</head>
<body background="IMAGES/WCIIBKG.gif">
<p align="center">
<img border="0" src="IMAGES/welford-costelloe%20logo.gif"
width="384" height="96"><br>
<img border="0" src="IMAGES/Logo00.gif"><br>
</p>
<hr>
<div align="center">
<center>
<table border="1" width="100%">
<tr>
<td width="100%">
<p align="center">
<b><font size="4"
color="#FFFF00"><%=$strFileName%></font></b></td>
</tr>
</table>
</center>
</div>
<hr>
</font></a><font size="1" color="#3399FF"><br>
<br>
</font></p>
</body>
</html>
What is it I am doing wrong?
If you have a solution it would be greatly appreciated.
thanks
David.........