[SOLVED] PHP Scripting Problems
Moderator: General Moderators
[SOLVED] PHP Scripting Problems
We are mirroring a download site from here in New Zealand. The download setup is PHP. We installed PHP 4.3.4 on IIS 5 (2k server).
When we click this url
http://bgw.gtcs.net.nz/dl.php?file=Airbornev1.5.ZIP
we get an error on line 60 of dl.php
I am a newbie to PHP, you can look at the dl.php file and the ftp://mirrors.gtcs.net.nz
it uses the server.txt file to create the download link url so the clients browser will be pointed to the correct file
When we click this url
http://bgw.gtcs.net.nz/dl.php?file=Airbornev1.5.ZIP
we get an error on line 60 of dl.php
I am a newbie to PHP, you can look at the dl.php file and the ftp://mirrors.gtcs.net.nz
it uses the server.txt file to create the download link url so the clients browser will be pointed to the correct file
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I think this is it in dl.asp
$display_template = "<div align=\"center\">
<center>
<table border=\"0\" width=\"25%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"100%\"><p align=\"center\"><font face=\"Tahoma\" size=\"2\" color=\"#000080\"><b><a href='<URL>'target=\"_blank\"</b></font><font face=\"Tahoma\" size=\"2\"><b><MIRROR></a></b></font></td>
</tr>
<tr>
<td width=\"100%\">
<p align=\"center\"><font face=\"Tahoma\" size=\"2\" color=\"#000000\">(Opens In
A New Window)</font></td>
</tr>
</table>
</center>
</div>";
$servers = file ('servers.txt');
for ($i = 0; $i < count ($servers); $i++)
Hope this helps.
$display_template = "<div align=\"center\">
<center>
<table border=\"0\" width=\"25%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"100%\"><p align=\"center\"><font face=\"Tahoma\" size=\"2\" color=\"#000080\"><b><a href='<URL>'target=\"_blank\"</b></font><font face=\"Tahoma\" size=\"2\"><b><MIRROR></a></b></font></td>
</tr>
<tr>
<td width=\"100%\">
<p align=\"center\"><font face=\"Tahoma\" size=\"2\" color=\"#000000\">(Opens In
A New Window)</font></td>
</tr>
</table>
</center>
</div>";
$servers = file ('servers.txt');
for ($i = 0; $i < count ($servers); $i++)
Hope this helps.
Here is the code on line 60:
This is the code leading up to it
Many thanks for looking at this for me. Apologies for posting twice, was unsure of the first place to post.
Kind Regards,
Geoff.
Code: Select all
<?php
$sarr[2] = str_replace ('<FILENAME>', $file, $sarr[2]);
?>Code: Select all
<?php
$display_template = "<div align="center">
<center>
<table border="0" width="25%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><p align="center"><font face="Tahoma" size="2" color="#000080"><b><a href='<URL>'target="_blank"</b></font><font face="Tahoma" size="2"><b><MIRROR></a></b></font></td>
</tr>
<tr>
<td width="100%">
<p align="center"><font face="Tahoma" size="2" color="#000000">(Opens In
A New Window)</font></td>
</tr>
</table>
</center>
</div>";
$servers = file ('servers.txt');
for ($i = 0; $i < count ($servers); $i++)
{
$sarr = explode ('::', $servers[$i]);
$sarr[2] = str_replace ('<FILENAME>', $file, $sarr[2]);
$dtmp = str_replace ('<URL>', $sarr[2], $display_template);
$dtmp = str_replace ('<MIRROR>', $sarr[1], $dtmp);
$dtmp = str_replace ('<LOCATION>', $sarr[0], $dtmp);
$dtmp = str_replace ('<COUNTER>', $i + 1, $dtmp);
echo $dtmp;
}
?>Kind Regards,
Geoff.
OK I have ripped down the script so it just has pure php and no html codes here:
You can view the script in action here: http://bgw.gtcs.net.nz/genmirlist.php (you will see the error message in bold)
Now to understand how the script works, it works by a user requesting a file to download, such as: http://bgw.gtcs.net.nz/dl.php?file=filesnamehere.zip now the dl.php script is obviously executed and goes to a server.txt file which looks like:
And loads the files name along with the location stated in the above txt file, it prints it out as a URL, the user then clicks, and the file downloads.
Now the part which is pruducing the error in the dl.php file is:
Now this php script works on other servers, so I know that it does definetely work...
The php that is installed on the server is: http://www.php.net/get/php-4.3.4-instal ... m/a/mirror
its for windows....
Does something need to be configured after install on the server?
Any help would be greatly appreciated!
Note: genmirlist.php is the same file as dl.php but without any html codes, genmirlist.php is just pure php.
Code: Select all
<?php
$display_template = "<p><COUNTER>: download from <a href='<URL>'><MIRROR> (location: <LOCATION>)</a></p>";
$servers = file ('servers.txt');
for ($i = 0; $i < count ($servers); $i++)
{
$sarr = explode ('::', $serversї$i]);
$sarrї2] = str_replace ('<FILENAME>', $file, $sarrї2]);
$dtmp = str_replace ('<URL>', $sarrї2], $display_template);
$dtmp = str_replace ('<MIRROR>', $sarrї1], $dtmp);
$dtmp = str_replace ('<LOCATION>', $sarrї0], $dtmp);
$dtmp = str_replace ('<COUNTER>', $i + 1, $dtmp);
echo $dtmp;
}
?>Now to understand how the script works, it works by a user requesting a file to download, such as: http://bgw.gtcs.net.nz/dl.php?file=filesnamehere.zip now the dl.php script is obviously executed and goes to a server.txt file which looks like:
Code: Select all
New Zealand::GTCS::http://bgw.gtcs.net.nz/files/<FILENAME>Now the part which is pruducing the error in the dl.php file is:
Code: Select all
$sarrї2] = str_replace ('<FILENAME>', $file, $sarrї2]);The php that is installed on the server is: http://www.php.net/get/php-4.3.4-instal ... m/a/mirror
its for windows....
Does something need to be configured after install on the server?
Any help would be greatly appreciated!
Note: genmirlist.php is the same file as dl.php but without any html codes, genmirlist.php is just pure php.