#19328 [Opn->Bgs]: Web Site cannot be displayed

From: Date: Tue, 10 Sep 2002 08:27:47 +0000
Subject: #19328 [Opn->Bgs]: Web Site cannot be displayed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18894@lists.php.net to get a copy of this message
ID: 19328 Updated by: jan@php.net Reported By: hd@tiro.de -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Linux PHP Version: 4.2.2 New Comment: Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. wild guess: check your register_globals setting. see also the release announcement for 4.2 Previous Comments: ------------------------------------------------------------------------ [2002-09-10 03:25:12] hd@tiro.de The below attached source reads a 635 lines CSV file. On a installation with PHP 4.1.0 everything works. On 4.2.2 no output is available most of the time, but sometimes it is. There are no log entries. The working script is on http://worldsportingclays.de/index.php The CSV is on http://worldsportingclays.de/results.csv Here is the index.php: <?php //////////////////////////////////////////////////////////////////////// // // FITASC Sporting World Championship 2002 // R E S U L T S // // (c) by Hinrich Donner, GPL // //////////////////////////////////////////////////////////////////////// error_reporting(E_ALL); ob_start("ob_gzhandler"); define('_VERSION', '0.6'); //////////////////////////////////////////////////////////////////////// // // Init some things // //ini_set("session.name", "FITASCID"); //ini_set("session.use_cookies", "0"); ini_set("max_execution_time", 180); session_start(); //phpinfo(); exit(); //////////////////////////////////////////////////////////////////////// // // Functions // function LoadFromFile($filename) { $lines = array(); $fh = fopen($filename, "r"); if (!$fh) return false; while (!feof($fh)) { $line = fgets($fh, 1024); $line = trim($line); if (!empty($line)) $lines[] = $line; } fclose($fh); unset($line); // $lines = file($filename); if (!is_array($lines)) return false; // walk trhoug but ignore headers // $first = true; $result = array(); for($loop = 0; $loop < count($lines); $loop++) { $line = $lines[$loop]; if ($first) { $first = false; continue; } $line = preg_split("/;/", $line); $line = preg_replace("/^\"(.*)\"$/", "\\1", $line); // init result // $item = array(); $item['rank'] = '&nbsp;'; $item['no'] = $line[0]; $item['name'] = $line[1]; $item['nation'] = $line[2]; $item['category'] = $line[3]; $item['total'] = 0; $item['1'] = $line[4]; $item['total'] += $line[4]; $item['2'] = $line[5]; $item['total'] += $line[5]; $item['3'] = $line[6]; $item['total'] += $line[6]; $item['4'] = $line[7]; $item['total'] += $line[7]; $item['5'] = $line[8]; $item['total'] += $line[8]; $item['6'] = $line[9]; $item['total'] += $line[9]; $item['7'] = $line[10]; $item['total'] += $line[10]; $item['8'] = $line[11]; $item['total'] += $line[11]; $item['shoot_off1'] = $line[13]; $item['shoot_off2'] = $line[14]; $item['team_s'] = $line[15]; $item['team_v'] = $line[16]; $item['team_d'] = $line[17]; $item['team_j'] = $line[18]; $item['clubs'] = $line[19]; $result[] = $item; unset($item); } return $result; } function btnDisplay($current) { echo 'Show <select name="display">' .'<option value="seniors"'.(($current == 'seniors') ? ' selected' : '').'>Seniors</option>' .'<option value="juniors"'.(($current == 'juniors') ? ' selected' : '').'>Juniors</option>' .'<option value="ladies"'.(($current == 'ladies') ? ' selected' : '').'>Ladies</option>' .'<option value="veterans"'.(($current == 'veterans') ? ' selected' : '').'>Veterans</option>' .'<option value="veterans2"'.(($current == 'veterans2') ? ' selected' : '').'>Super Veterans</option>' .'<option value="scratch"'.(($current == 'scratch') ? ' selected' : '').'>All</option>' ."</select>,\n"; } function btnSortBy($current) { echo 'ordered by <select name="sortby">' .'<option value="0"'.(($current == '0') ? ' selected' : '').'>results</option>' .'<option value="1"'.(($current == '1') ? ' selected' : '').'>names</option>' .'<option value="2"'.(($current == '2') ? ' selected' : '').'>nation and results</option>' .'<option value="3"'.(($current == '3') ? ' selected' : '').'>nation and names</option>' ."</select>,\n"; } function btnItemsPerPage($current) { echo '<select name="itemsperpage">' .'<option value="1000"'.(($current == '1000') ? ' selected' : '').'>Unlimited</option>' .'<option value="100"'.(($current == '100') ? ' selected' : '').'>100</option>' .'<option value="50"'.(($current == '50') ? ' selected' : '').'>50</option>' .'<option value="40"'.(($current == '40') ? ' selected' : '').'>40</option>' .'<option value="30"'.(($current == '30') ? ' selected' : '').'>30</option>' .'<option value="25"'.(($current == '25') ? ' selected' : '').'>25</option>' .'<option value="20"'.(($current == '20') ? ' selected' : '').'>20</option>' .'<option value="15"'.(($current == '15') ? ' selected' : '').'>15</option>' .'<option value="10"'.(($current == '10') ? ' selected' : '').'>10</option>' .'<option value="5"'.(($current == '5') ? ' selected' : '').'>5</option>' ."</select>&nbsp; entries per page.\n"; } function BaseSort($a, $b) { if ($a['total'] == $b['total']) { if ($a['shoot_off1'] == $b['shoot_off1']) { if ($a['shoot_off2'] == $b['shoot_off2']) { return 0; } return (($a['shoot_off2'] > $b['shoot_off2']) ? -1 : 1); } return (($a['shoot_off1'] > $b['shoot_off1']) ? -1 : 1); } return (($a['total'] > $b['total']) ? -1 : 1); } function NameSort($a, $b) { return strcmp($a['name'], $b['name']); } function NationResultSort($a, $b) { $sorta = sprintf("%s%03d", $a['nation'], 200-$a['total']); $sortb = sprintf("%s%03d", $b['nation'], 200-$b['total']); return strcmp($sorta, $sortb); } function NationNameSort($a, $b) { $sorta = sprintf("%s-%s", $a['nation'], $a['name']); $sortb = sprintf("%s-%s", $b['nation'], $b['name']); return strcmp($sorta, $sortb); } function DisplayResults(&$results, $offset, $itemsperpage) { global $config; $list = array(); switch ($config['display']) { case 'seniors': $title_display = "Seniors"; for ($loop = 0; $loop < count($results); $loop++) { $item = $results[$loop]; if ($item['category'] == 'S') $list[] = $item; } usort($list, "BaseSort"); break; case 'juniors': $title_display = "Juniors"; for ($loop = 0; $loop < count($results); $loop++) { $item = $results[$loop]; if ($item['category'] == 'J') $list[] = $item; } usort($list, "BaseSort"); break; case 'veterans': $title_display = "Veterans"; for ($loop = 0; $loop < count($results); $loop++) { $item = $results[$loop]; if ($item['category'] == 'V') $list[] = $item; } usort($list, "BaseSort"); break; case 'veterans2': $title_display = "Super Veterans"; for ($loop = 0; $loop < count($results); $loop++) { $item = $results[$loop]; if ($item['category'] == 'W') $list[] = $item; } usort($list, "BaseSort"); break; case 'ladies': $title_display = "Ladies"; for ($loop = 0; $loop < count($results); $loop++) { $item = $results[$loop]; if ($item['category'] == 'D') $list[] = $item; } usort($list, "BaseSort"); break; default: $title_display = "All Entries (Scratch Results)"; $list = $results; usort($list, "BaseSort"); } // make ranks $rank = 0; for ($i = 0; $i < count($list); $i++) { $item = &$list[$i]; if (!is_array($list)) break; if ($rank < 5) { $rank++; } elseif ($item['total'] != $last_total) { $rank = $i+1; } $last_total = $item['total']; $item['rank'] = $rank; } switch ($config['sortby']) { case 1: // names $title_sort = 'sorted by names'; usort($list, "NameSort"); break; case 2: // nations and results $title_sort = 'sorted by nations and results'; usort($list, "NationResultSort"); break; case 3: // nations and names $title_sort = 'sorted by nations and names'; usort($list, "NationNameSort"); break; default: $title_sort = 'sorted by results'; } echo "<h2>$title_display<br /><small>$title_sort</small></h2>"; echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" width=\"90%\">" ."<tr>" ."<th bgcolor=\"#b0b0b0\" align=\"left\" class=\"TextCell\">Place</th>" ."<th bgcolor=\"#b0b0b0\" align=\"left\" class=\"TextCell\">Name</th>" ."<th bgcolor=\"#b0b0b0\" align=\"left\" class=\"TextCell\">Category</th>" ."<th bgcolor=\"#b0b0b0\" align=\"left\" class=\"TextCell\">Nation</th>" ."<th colspan=\"8\" bgcolor=\"#b0b0b0\" class=\"TextCell\" align=\"center\">Results</th>" ."<th bgcolor=\"#b0b0b0\" align=\"center\" class=\"TextCell\">Total</th>" ."<th colspan=\"2\" bgcolor=\"#b0b0b0\" class=\"TextCell\" align=\"center\">Shoot Off</th>" ."</tr>\n"; $even = false; $rank = 0; for ($i = $config['offset']; $i < ($config['offset'] + $config['itemsperpage']); $i++) { $bg = (($even) ? ' bgcolor="#c0c0c0" ': ''); $even = !$even; $item = &$list[$i]; if (!is_array($item)) break; if ($rank == $item['rank']) { $r = "&nbsp;"; } else { $rank = $item['rank']; $r = "".$item['rank']; } switch ($item['category']) { case 'S': $cat = 'Senior'; break; case 'V': $cat = 'Veteran'; break; case 'W': $cat = 'Super Veteran'; break; case 'D': $cat = 'Lady'; break; case 'J': $cat = 'Junior'; break; default: $cat = 'n/a'; } echo "<tr>" ."<td$bg align=\"left\" valign=\"top\" class=\"TextCell\">$r</td>" ."<td$bg align=\"left\" valign=\"top\" class=\"TextCell\">".htmlentities($item['name'])."</td>" ."<td$bg align=\"left\" valign=\"top\" class=\"TextCell\">$cat</td>" ."<td$bg align=\"left\" valign=\"top\" class=\"TextCell\">".htmlentities(ucwords(strtolower($item['nation'])))."</td>"; for ($j = 1; $j < 9; $j++) { if ($item["$j"] == 25) $x = "<font color=\"red\"><b>".$item["$j"]."</b></font>"; else $x = "".$item["$j"]; echo "<td$bg align=\"center\" valign=\"top\" class=\"TextCell\">$x</td>"; } echo "<td$bg align=\"center\" valign=\"top\" class=\"TextCell\"><b>$item[total]</b></td>" ."<td$bg align=\"center\" valign=\"top\" class=\"TextCell\">$item[shoot_off1]</td>" ."<td$bg align=\"center\" valign=\"top\" class=\"TextCell\">$item[shoot_off2]</td>" ."</tr>\n"; } echo "</table>"; $p = ((($config['offset'] - $config['itemsperpage']) < 1) ? '0' : ($config['offset'] - $config['itemsperpage'])); if ($i < count($list)) $next = "<a href=\"index.php?offset=$i\">Next ".$config['itemsperpage']."</a>"; if ($config['offset'] != 0) $prev = "<a href=\"index.php?offset=$p\">Previous ".$config['itemsperpage']."</a>"; if (!empty($next) && !empty($prev)) { $choice = "$prev | $next"; } elseif (empty($prev) && !empty($next)) { $choice = "$next"; } elseif (empty($next) && !empty($prev)) { $choice = "$prev"; } echo "<hr /><p><div align=\"center\">[ $choice ]</div></p>\n"; } // Set defaults // if (!session_is_registered("config")) { $config = array(); $config['sortby'] = 0; $config['display'] = 'seniors'; $config['itemsperpage'] = 25; $config['offset'] = 0; } // Get parameters // if (isset($_GET['offset'])) $config['offset'] = $_GET['offset']; if (!empty($_GET['display'])) { $config['display'] = $_GET['display']; $config['offset'] = (int) 0; } if (isset($_GET['sortby'])) { $config['sortby'] = $_GET['sortby']; $config['offset'] = (int) 0; } if (!empty($_GET['itemsperpage'])) $config['itemsperpage'] = $_GET['itemsperpage']; // Remember me // session_register("config"); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n\n" ."<html>\n" ."<head>\n" ."<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-15\" />\n" ."<title>F.I.T.A.S.C. Sporting World Championship 2002 - Results</title>\n" ."<meta name=\"keywords\" content=\"tiro, fitasc, shooting, shoot, worldchampionship, parcours, dornsberg\" />\n" ."<meta name=\"description\" content=\"World Sporting Championships 2002 - Results\" />\n" ."<meta name=\"robots\" content=\"index,nofollow\" />\n" ."<meta http-equiv=\"expires\" content=\"0\" />\n" ."<meta name=\"author\" content=\"TIRO e.V.\" />\n" ."<meta name=\"copyright\" content=\"Copyright (c) 2001-2002 by TIRO e.V.\" />\n" ."<meta name=\"distribution\" content=\"Global\" />\n" ."<link rel=\"StyleSheet\" href=\"style.css\" type=\"text/css\" />\n" ."</head>\n\n"; echo "<body bgcolor=\"#000000\">\n" .'<div align="center">' .'<br />' .'<table bgcolor="#ffe4c4" border="0" cellpadding="5" cellspacing="0" width="95%" height="95%">' ."<tr>\n" .'<td align="left" valign="top" rowspan="2"><br /><img src="images/tirofitasc.gif" alt="" width="100" height="75" hspace="15" vspace="0" border="0" align="left"></td>' .'<td align="right" valign="top"><h1><small>XXIV. F.I.T.A.S.C. Sporting World Championship</small>&nbsp;&nbsp;<br />Results&nbsp;&nbsp;&laquo;&nbsp;&nbsp;</h1></td></tr>' ."<tr>\n" .'<td align="right" valign="top">' .'[ <a href="http://www.tiro.de/" target="_blank">TIRO e.V.</a> ' .'| <a href="http://www.parcour.cz/" target="_blank">European Championship 2003</a> ' .'| <a href="http://www.claythorne.com/" target="_blank">World Championship 2003</a> ' ."]\n" .'<br />&nbsp;' .'</td></tr><tr><td align="left" valign="top"><blockquote>&nbsp;</blockquote></td></tr>' ."<tr>\n" .'<td colspan="2" align="left" valign="top" height="100%"><blockquote><span class="content">' ."\n<p>" ."<b>NOTE:</b> Here you find the results of the <b>XXIV. F.I.T.A.S.C. Sporting World Championship 2002</b>.\n" ."You can shrink the list by the categories and sort it by results or names. If you want to print the list,\n" ."please use the function of your software. If you like to have a file, please\n" .'<a href="wm2002.xls" target="_blank">download</a> the Microsoft Excel <super>&trade;</super> file.' ."</p>\n\n" ."<p><small>We still have some trouble with the server. Sorry about that.</small></p>\n" ."<p>\n" .'<form action="index.php" method="get">'; btnDisplay($config['display']); echo "<br />\n"; btnSortBy($config['sortby']); echo "<br />\n"; btnItemsPerPage($config['itemsperpage']); echo "<br />\n"; echo "<input type=\"submit\" value=\"Update\" />\n" ."</form>\n" ."</p>\n" ."<hr />\n"; // Load file // $results = LoadFromFile("results.csv"); // Show source or list // if (isset($_GET['showsource']) && ($_GET['showsource'] == 1)) { // Show source // highlight_file('index.php'); } else { // Show list DisplayResults($results, (int) $config['offset'], $config['itemsperpage']); } ?> </span></blockquote></td> </tr> <tr> <td colspan="2" align="center" valign="bottom"> <small><!--<a href="" target="_blank"> <img src="images/print.gif" alt="Druckbare Ansicht" width="15" height="11" hspace="5" vspace="0" border="0" align="right"></a> --> Copyright TIRO e.V., &copy; 2001-2002<br /> WM Result Software Version <?php echo ""._VERSION; ?>, Copyright by <a href="http://tiro.de/hinrich/" target="_blank">Hinrich Donner</a>, &copy; 2002<br /> This software is under the <a href="http://gnu.org/" target="_blank">GPL</a>. <a href="index.php?showsource=1">View source</a></small> </td> </tr> </table> </div> </body> </html> <?php exit(); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19328&edit=1

« previous php.bugs (#18894) next »