} foreach ($locations[0]['regions'] as $region) { if ($region['name'] != 'Metro Manila') { $i++; if ($i > 1 && ($i - 1) % (count($locations[0]['regions']) / 3) == 0) { echo '<td valign="top" align="left">'; } echo '<h2 style="display: inline;">' . str_replace('ñ', 'ñ', $region['name']) . '</h2>:<ul>'; foreach ($region['cities'] as $city) { $sql_query = "SELECT * FROM `{$table}` WHERE `place` = '" . mysql_escape_string($city['name']) . "' OR `place` = '" . mysql_real_escape_string(str_replace(array('City of ', ' City'), '', $city['name']) . ' City') . "' LIMIT 1"; $results = mysql_query($sql_query); $row = mysql_fetch_assoc($results); echo '<li>'; if (mysql_num_rows($results)) { echo '<a href="/map/' . urlencode(str_replace(' ', '+', strtolower($row['place']))) . '">'; } else { echo '<a href="/map/' . urlencode(str_replace(' ', '+', strtolower($city['name']))) . '">'; } echo '<h3 style="display: inline; font-weight: normal;">' . str_replace('ñ', 'ñ', $city['name']) . '</h3>'; echo '</a>'; echo '</li>'; } echo '</ul><br />'; if ($i > 1 && $i % (count($locations[0]['regions']) / 3) == 0) { echo '</td>'; } } } echo '</tr></table>'; htmlfooter();
function errorpage($message,$title = '',$isheader = 1,$isfooter = 1){ if($isheader) { htmlheader(); } !$isheader && $title = ''; if($message == 'login') { $message ='<h4>工具箱登录</h4> <form action="?" method="post"> <table class="specialtable"><tr> <td width="20%"><input class="textinput" type="password" name="toolpassword"></input></td> <td><input class="specialsubmit" type="submit" value="登 录"></input></td></tr></table> <input type="hidden" name="action" value="login"> </form>'; } else { $message = "<h4>$title</h4><br><br><table><tr><th>提示信息</th></tr><tr><td>$message</td></tr></table>"; } echo $message; if($isfooter) { htmlfooter(); } }
mysql_select_db(SQL_DATA); $prizes = array(); $sql = "select pdate, puser, pnote, pcountry from prize order by pdate desc limit 10"; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $prizes[] = array($row[0], $row[1], $row[2], $row[3]); } mysql_free_result($res); httpheader(); echo htmlheader('Travelrun: Prizes', usercss()); echo '<div class="prizenav">'; echo 'Go back to the <a href="index.php">start page</a>.'; echo '</div>'; echo '<div class="prizemain">'; echo 'Recent prizes:<br>'; echo '<table border="0" cellpadding="0" cellspacing="1" width="100%">'; echo '<tr><th>date</th><th>claimed</th><th>note</th><th>country</th></tr>'; foreach ($prizes as $p) { echo '<tr>'; echo '<td>', $p[0], '</td>'; echo '<td align="center">'; echo $p[1] ? $p[1] : '--'; echo '</td>'; echo '<td>', trim($p[2]) != '' ? $p[2] : ' ', '</td>'; echo '<td>', $p[3], '</td>'; echo '</tr>'; } echo '</table>'; echo '</div>'; echo htmlfooter();