Jump to content

read_file() returns false for no reason


idiotstrike

Recommended Posts

Hello all. I have this code:

<?php

echo '
<br><br>
<center>
<table border="1" cellspacing="0" cellpadding="0" width="540">
<tr> 
<th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2">  Název mapy  </font></th>
<th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2"> Download </font></th>
<th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2"> Screenshot </font></th>
</tr>';

$file = fopen("T:/hns/cstrike/mapcycle.txt", "r");
while (($buffer = fgets($file, 4096)) != false)
{
   
if(file_exists("maps/".$buffer.".zip"))
	$download = "<a href='http://www.traxxzone.cz/maps/".$buffer.".zip'>Download</a>";
else
	$download = "---";

if(file_exists("maps/screenshots/".$buffer.".jpg"))
	$screen = "<a href='http://www.traxxzone.cz/maps/screenshots/".$buffer.".jpg'>Screenshot</a>";
else
	$screen = "---";

echo "<tr><th>".$buffer."</th><th>".$download."</th><th>".$screen."</th></tr>";
}
echo "</table></center>";
fclose($file);
?>

 

That should print out all maps listed in mapcycle.txt (counter-strike server) and if the mapname exists in maps/map_name.zip, then there is a download link. However it doesn't work as should. Map name is always true in first TH, no problems with that. However the link is all the time only on the last row (even if I change the map order in mapcycle.txt). Can anybody help me?

 

Edit: And for the screenshots, there aren't any now, so I can't check.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.