473,696 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please Help - Undefined index & Invalid argument supplied for foreach()

3 New Member
Hey there,

I am trying to upload old source files and came across these errors:

Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59

Notice: Undefined index: args in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92

Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92

You can see the site for yourselves: http://acssr.cashingathome.com/

The Source Files:
*************** Inc_html.php*** ***************
Expand|Select|Wrap|Line Numbers
  1. <?
  2.  
  3. function htmlStart($headextra="") {
  4.  
  5.     #if ($headextra != "")
  6.     #$headextra = " - " . $headextra;
  7.  
  8. header("Content-type: text/html; charset=utf-8");
  9. header("Cache-Control: no-cache");
  10.  
  11. ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  12.  
  13. <html>
  14. <head>
  15. <title><?=$headextra?>ACSSR - Australian Counter Strike:Source Rankings</title>
  16. <style type="text/css">
  17. @import "style.php";
  18. </style>
  19. <link rel="shortcut icon" href="img/icon.png">
  20. <meta name="resource-type" content="document">
  21. <meta name="description" content="A Counter-Strike:Source player ranking and tracking system that monitors Australian servers">
  22. </head>
  23. <body><div class="top"><table class="topoutline"><tr><td class="topoutlinebody">
  24. <!-- <a href="http://www.vindictivegaming.com.au/"><img src="/img/banners/vindictivegaming-standard.jpg"></a> -->
  25. <?
  26. if (1) {
  27. ?>
  28. <!--<a href="l.php"><img src="b.php" alt=""></a>-->
  29. <script type="text/javascript"><!--
  30. google_ad_client = "pub-9387561163499032";
  31. google_ad_width = 468;
  32. google_ad_height = 60;
  33. google_ad_format = "468x60_as";
  34. google_ad_type = "text_image";
  35. google_ad_channel ="";
  36. google_color_border = "006666";
  37. google_color_bg = "158289";
  38. google_color_link = "FFFFFF";
  39. google_color_url = "FFF600";
  40. google_color_text = "99FF66";
  41. //--></script>
  42. <script type="text/javascript"
  43.   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  44.   </script>
  45. <? } ?>
  46.  
  47. </table></div><table class="outline"><tr><td class="outlinebody"><form method="GET" action="search.php"><table style="width: 100%; background-color: #000;" ><tr><td class="navigation"><?
  48.  
  49. global $db;
  50.  
  51. /*
  52. checkBanner();
  53. $db->query("update adcounter set tryshow = tryshow + 1 where day = " . today());
  54. */
  55.  
  56. global $menus;
  57. $first = 0;
  58. //echo " | ";
  59. foreach($menus as $menu) {
  60.  
  61.     echo "<a class=\"navigation\" href=\"{$menu["link"]}\">{$menu["name"]}</a>";    
  62. //    echo "";
  63.  
  64. }
  65.  
  66. ?>
  67.  
  68. <td class="search"><input type="text" name="search" value="search for a player"
  69. onfocus="if (this.value == 'search for a player') this.value = '';"
  70. ><!--<input type="submit" value="go">-->
  71.  
  72. </table>
  73. </form>
  74.  
  75. <?
  76.  
  77. }
  78.  
  79. function htmlStop($dbok = 1) {
  80.  
  81. if ($dbok) {
  82.     global $db;
  83.     $db->query("update stats set hits = hits + 1");
  84. }
  85.  
  86. global $_GET;
  87.  
  88. if (isset($_GET["debug"])) {
  89.  
  90.     global $QUERIES;
  91.  
  92.     echo '<table border=1>';
  93.  
  94.     foreach($QUERIES as $q) {
  95.  
  96.         $q["sql"] = str_replace("\n", "<br>", $q["sql"]);
  97.         $q["sql"] = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $q["sql"]);
  98.  
  99.         for ($i = 0; $i < 10; $i++)
  100.             $q["sql"] = str_replace("  ", " ", $q["sql"]);
  101.  
  102.         echo '<tr><td class=sql';
  103.  
  104.         if ($q["time"] > 100) {
  105.             echo " style='background-color: #500000;'";
  106.         }
  107.  
  108.         echo ">";
  109.  
  110.         echo $q["time"] . "ms<br>";
  111.         echo $q["rows"] . " rows<br>";
  112.         echo $q["fields"] . " fields<br>";
  113.         echo $q["affectedrows"] . " affectedrows<br>";
  114.  
  115.         echo "<td class=sql";
  116.  
  117.         if (isset($q["error"])) {
  118.             echo " style='background-color: #FF0000;'";
  119.         }
  120.  
  121.         echo ">";
  122.  
  123.         echo $q["sql"];
  124.  
  125.  
  126.     }
  127.  
  128.     echo "</table>";
  129.  
  130. }
  131.  
  132. global $_SERVER;
  133. if (isset($_SERVER) and isset($_SERVER["REQUEST_URI"]))
  134.     $ref = $_SERVER["REQUEST_URI"];
  135. else
  136.     $ref = '';
  137.  
  138. ?>
  139.  
  140. <hr><div align="center">
  141. <? if (1) { ?>
  142. <script type="text/javascript"><!--
  143. google_ad_client = "pub-9387561163499032";
  144. google_ad_width = 728;
  145. google_ad_height = 90;
  146. google_ad_format = "728x90_as";
  147. google_ad_type = "text_image";
  148. google_ad_channel ="";
  149. google_color_border = "006666";
  150. google_color_bg = "158289";
  151. google_color_link = "FFFFFF";
  152. google_color_url = "FFF600";
  153. google_color_text = "99FF66";
  154. //--></script>
  155. <script type="text/javascript"
  156.   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  157.   </script>
  158. <? } ?>
  159. <!-- <a href="http://www.vindictivegaming.com.au/"><img src="/img/banners/vindictivegaming-large.jpg"></a> -->
  160. </div><hr>
  161. <span style="float: right;"><script type="text/javascript"><!--
  162. google_ad_client = "pub-9387561163499032";
  163. google_ad_width = 110;
  164. google_ad_height = 32;
  165. google_ad_format = "110x32_as_rimg";
  166. google_cpa_choice = "CAAQpeKZzgEaCL1N-uOV--c-KOP143Q";
  167. //--></script>
  168. <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  169. </script>
  170. </span>
  171. <span style="font-size: 9px;">
  172. ACSSR was created by <a href="http://geraldkaszuba.com/">Gerald Kaszuba</a>, <a href="http://slowchop.com/">Slowchop Studios</a>. Thanks to Jon Skinner and <a href="http://swapoff.org/">Alec Thomas</a> for providing code optimisation and <a href="playerdetails.php?id=539723">ren[FBi]</a> and <a href="http://acssr.slowchop.com/playerdetails.php?id=286585">Wally3K</a> for being good helper monkeys.<br>
  173. ACSSR is best viewed with a resolution of 1024x768 or higher. ACSSR is contactable by emailing 
  174. <script>d="slowchop.com";u="acssr";a="@";e=u+a+d;document.write("<a href=\"mailto:"+e+"\">"+e+"</a>");</script>.
  175. </span>
  176.  
  177. <br>
  178.  
  179. </table>
  180.  
  181. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  182. </script>
  183. <script type="text/javascript">
  184. _uacct = "UA-214748-1";
  185. urchinTracker();
  186. </script>
  187.  
  188. <script type="text/javascript" src="http://cetrk.com/pages/scripts/0006/4379.js"> </script>
  189.  
  190. </body>
  191. </html>
  192. <?
  193. if ($dbok)
  194.     session_write_close();
  195.  
  196. }
  197.  
  198. function serverLink($name, $address) {
  199.  
  200.     return '<a href="steam://connect/'.$address.'"><img src="img/join.png" title="Join '.$name.' ('.$address.')"></a>';
  201.  
  202. }
  203.  
  204. // function dumpTable($res, $total = true, $header = true, $tablestart = true, $tableend = true) {
  205. function dumpTable($res, $vars = array()) {
  206.  
  207.     // get user
  208.     global $_SESSION;
  209.     if (!isset($_SESSION["user"])) {
  210.             $usersession = null;
  211.     } else {
  212.         $usersession = $_SESSION["user"];
  213.     }
  214.  
  215.     include('admin.php');
  216.  
  217.     $options = array(
  218.  
  219.         array("name" => "total", "default" => true)
  220.         ,array("name" => "tablestart", "default" => true)
  221.         ,array("name" => "tableend", "default" => true)
  222.         ,array("name" => "header", "default" => true)
  223.         ,array("name" => "servercol", "default" => true)
  224.         ,array("name" => "scorecol", "default" => true)
  225.         ,array("name" => "secondscol", "default" => true)
  226.         ,array("name" => "totalfragscol", "default" => true)
  227.         ,array("name" => "ppmcolcol", "default" => true)
  228.         ,array("name" => "servercut", "default" => false)
  229.         ,array("name" => "reorderrank", "default" => false)
  230.         ,array("name" => "small", "default" => false)
  231.         ,array("name" => "compare", "default" => false)
  232.         ,array("name" => "morelink", "default" => "")
  233.         ,array("name" => "frienddelete", "default" => false)
  234.         ,array("name" => "user", "default" => false)
  235.         ,array("name" => "export", "default" => false)
  236.         ,array("name" => "format", "default" => 0)
  237.         ,array("name" => "meat", "default" => 0)
  238.  
  239.     );
  240.  
  241.  
  242.     foreach($options as $option) {
  243.  
  244.         $name = $option["name"];
  245.         $default = $option["default"];
  246.  
  247.         if (isset($vars[$name])) {
  248.  
  249.             $$name = $vars[$name];
  250.  
  251.         } else {
  252.  
  253.             $$name = $default;
  254.  
  255.         }
  256.  
  257.     }
  258.  
  259.     global $db;
  260.     global $rank_fields;
  261.  
  262.     if ($usersession) $user = true;
  263.  
  264.     // rank, name
  265.     if ($format == 1) {
  266.  
  267.         $servercol = false;
  268.         $secondscol = false;
  269.         $totalfragscol = false;
  270.         $ppmcol = false;
  271.         $scorecol = false;
  272.  
  273.     // rank, name, server
  274.     } else if ($format == 2) {
  275.  
  276.         $scorecol = false;
  277.         $secondscol = false;
  278.         $totalfragscol = false;
  279.         $ppmcol = false;
  280.  
  281.     }
  282.  
  283.     if ($export)
  284.         echo "<table class=\"acssr\">";
  285.  
  286.     else if ($tablestart)
  287.         echo "<table>";
  288.  
  289.     if ($header) {
  290.  
  291.         echo "<tr>";
  292.         foreach($rank_fields as $field) {
  293.  
  294.             if (!$field[RANK_SHOW])
  295.                 continue;
  296.  
  297. //            if ($field[1] == "server" && !$servercol)
  298. //                continue;
  299.  
  300.             $variable = $field[1] . 'col';
  301.             if (isset($$variable))
  302.                 if (!$$variable) {
  303.         //            echo "Skipping " . $variable . "<br>";
  304.                     continue;
  305.                 }
  306.  
  307.  
  308.             echo "<th class=\"{$field[1]}\">";
  309.  
  310.             if ($small)
  311.                 echo $field[0];
  312.             else
  313.                 echo $field[5];
  314.  
  315.         }
  316.  
  317.     }
  318.  
  319.     unset($totals);
  320.     $totals = new stdclass();
  321.     foreach($rank_fields as $field) {
  322.         $totals->$field[1] = 0;
  323.     }
  324.     $rows = 0;    // used for rank too
  325.     unset($id);
  326.     while (($dat = $db->fetchobject($res))) {
  327.  
  328.         $id[] = $dat->id;
  329.  
  330.         $rows++;
  331.  
  332.         $tdtag = ($rows % 2) ? '<td' : '<td class="alt"';
  333.         $pname = $dat->ename;
  334.  
  335.         if (!$dat->score)
  336.             $dat->rank = "-";
  337.  
  338.         $origservername = $dat->servername;
  339.  
  340.         if ($servercut) {
  341.  
  342.             $dat->servername = shortServerName($dat->servername);
  343.             $dat->servername = substr($dat->servername, 0, 25);
  344.  
  345.         }
  346.  
  347.         if ($dat->curserverid > 0)
  348.             $dat->server = serverLink($origservername, $dat->serveraddress) . " <a href=\"ladder.php?online={$dat->curserverid}\">$dat->servername</a>";
  349.         else {
  350.             $dat->server = humanTime(time() - $dat->lastserverwhen, true) . " ago";
  351.  
  352.         }
  353.  
  354. /*        
  355.         if ($dat->clanid > 0) {
  356.  
  357.             if ($dat->tagalign == 0) {
  358.  
  359.                 if ($dat->tag != substr($dat->ename, 0, strlen($dat->tag))) {
  360.  
  361.                     $l = "<a href=\"playerdetails.php?id={$dat->id}\">{$dat->ename}</a>";
  362.  
  363.                 } else {
  364.  
  365.                     $l = "<a class=\"ausourcelink\" href=\"http://ausource.slowchop.com/clandetails.php?id={$dat->clanid}\">{$dat->tag}</a>";
  366.                     $l .= "<a href=\"playerdetails.php?id={$dat->id}\">";
  367.                     $l .= substr($dat->ename, strlen($dat->tag));        
  368.                     $l .= "</a>";
  369.  
  370.                 }
  371.  
  372.                 $dat->ename = $l;
  373.  
  374.             }
  375.  
  376.             // $dat->ename = "yo";
  377.  
  378.         } else {
  379. */        
  380.             $dat->ename = "<a href=\"playerdetails.php?id={$dat->id}\">".htmlspecialchars($dat->ename)."</a>";
  381.  
  382. //        }
  383.  
  384.  
  385.         if ($frienddelete) {
  386.             $dat->ename .= " <a href=\"memberfrienddelete.php?id={$dat->id}\"><img title=\"Delete from friends\" alt=\"Delete from friends\" src=\"img/delete.png\"></a>";
  387.         }
  388.  
  389.         else if ($user) {
  390.                 $dat->ename .= " <a href=\"memberfind.php?id={$dat->id}&f=1\"><img title=\"Add $pname to your friends list\" alt=\"\" src=\"img/add.png\"></a>";
  391.         }
  392.  
  393.         if ($isAdmin) {
  394.                 $dat->ename .= " <a onclick=\"return confirm('Delete {$pname}?');\" href=\"memberdelete.php?id={$dat->id}\" style=\"color:black\">x</a>";
  395.         }
  396.  
  397.         if ($reorderrank) {
  398.  
  399.             $dat->rank = $rows;
  400.  
  401.         }
  402.  
  403.  
  404.         echo "<tr>";
  405.         foreach($rank_fields as $field) {
  406.  
  407. //            if (!isset($dat->$field[1]))
  408. //                continue;
  409.  
  410.             $totals->$field[1] += $dat->$field[1];
  411.  
  412.             if (!$field[RANK_SHOW])
  413.                 continue;
  414.  
  415.         //    if ($field[1] == "server" && !$servercol)
  416.         //        continue;
  417.             $variable = $field[1] . 'col';
  418.             if (isset($$variable))
  419.                 if (!$$variable) {
  420.         //            echo "Skipping " . $variable . "<br>";
  421.                     continue;
  422.                 }
  423.  
  424.             if ($small && !$export)
  425.                 echo $tdtag . " style=\"font-size: " . $field[4] . "px;\">";
  426.             else
  427.                 echo $tdtag . ">";
  428.  
  429.             if ($field[1] == "seconds") {
  430.  
  431.                 echo htmlspecialchars(humanTime($dat->seconds));
  432.  
  433.             } else {
  434.  
  435.                 echo $dat->$field[1];
  436.  
  437.             }
  438.  
  439.         }
  440.  
  441.     }
  442.  
  443.     if ($total && $totals->seconds > 0 && $totals->minutes > 0 && $rows > 1) {
  444.  
  445.         $id = implode(",", $id);
  446.  
  447.         echo "<tr>";
  448.  
  449.         unset($values);
  450.         $values = new stdclass();
  451.         $ratio = $totals->totalfrags / $totals->seconds;
  452.         $values->multiplier = 1 - FORMULA_OFFSETT / ($totals->seconds + FORMULA_OFFSETB);
  453.         $values->score = number_format($ratio * $values->multiplier * FORMULA_SCOREMULTIPLIER, 0, "", "");
  454.         $values->ename = "OVERALL";
  455.  
  456.         $nameextra = "";
  457.  
  458.         if ($compare)
  459.             $nameextra .= " <a href=\"playerdetails.php?compare=$id\">compare</a>";
  460.  
  461.         if ($morelink) {
  462.             for ($yay=0;$yay < 6;$yay++)
  463.             echo '<td class="total">';
  464.             echo '<td class="total" align="right">' . $morelink;
  465.         } else {
  466.  
  467.             if ($nameextra != "") {
  468.  
  469.                 $nameextra = trim($nameextra);
  470.  
  471.                 $nameextra = " <small>($nameextra)</small>";
  472.                 $values->ename .= $nameextra;
  473.  
  474.             }
  475.  
  476.             $values->multiplier = number_format($values->multiplier, 2);
  477.             $values->ppm = number_format($totals->totalfrags / $totals->minutes, 2);
  478.             $values->seconds = humanTime($totals->seconds);
  479.             $values->totalfrags = $totals->totalfrags;
  480.  
  481.             foreach($rank_fields as $field) {
  482.  
  483.                 if (!$field[RANK_SHOW])
  484.                     continue;
  485.  
  486.                 if ($field[1] == "server" && !$servercol)
  487.                     continue;
  488.  
  489.                 echo "<td class=\"total\">";
  490.  
  491.                 if (isset($values->$field[1])) {
  492.  
  493.                         echo $values->$field[1];
  494.  
  495.                 }
  496.  
  497.             }
  498.         }
  499.     }
  500.  
  501.     if ($tableend)
  502.         echo "</table>";
  503.  
  504. }
  505.  
  506. function homeHeading($a) {
  507.  
  508. //    old heading
  509. //    echo '<h2>'.$a.'</h2>';
  510.  
  511.     echo '<br>';
  512.     echo '<table><tr>';
  513.  
  514. //    echo '<td style="background-color: black; font-size: 12px; font-weight: 900; padding: 5px 5px 5px 5px; width: 10px;">';
  515. //    echo '<img src="img/icon.png">';
  516.  
  517.     echo '<td style="background-color: black; font-size: 12px; font-weight: 900; padding: 5px 5px 5px 5px;">';
  518.     echo $a;
  519.  
  520. //    echo '<td style="background-color: black; font-size: 12px; font-weight: 900; padding: 5px 5px 5px 5px; width: 10px;">';
  521. //    echo '<img src="img/close.png">';
  522.  
  523.     echo '</table>';
  524.  
  525. }
  526.  
  527. function htmlQuickStats($ajax = 0) {
  528.  
  529.     global $db;
  530.  
  531.     $dat1 = $db->quickquery("select count(id) as c from player");
  532.     $dat4 = $db->quickquery("
  533.  
  534.         select stats.*,
  535.         player.ename, player.id, player.totaltime,
  536.         yesterdaysbestplayer.ename as yesterdaysbestename, yesterdaysbestplayer.id as yesterdaysbestid
  537.  
  538.         from stats
  539.         left join player on player.id = stats.totaltimeid
  540.         left join player as yesterdaysbestplayer on yesterdaysbestplayer.id = stats.yesterdaysbestid
  541.  
  542.         ");
  543.  
  544.     $datOnline = $db->quickquery("select count(id) as c from session where " . (time() - 60 * 30) . " < time");
  545.     $datMembers = $db->quickquery('select count(id) as c from user where activated = 1 and lasttime > ' . (time() - 60*60*24*14));
  546.     $datVotes = $db->quickquery('select count(id) as c from playervote');
  547.     $datFriends = $db->quickquery('select count(userid) as c from friends');
  548.  
  549.     if ($ajax) {
  550.  
  551.         echo $dat1->c;
  552.         echo ',';
  553.         echo $dat4->onlinecount;
  554.         echo ',';
  555.         echo $datOnline->c;
  556.         echo ',';
  557.         echo $dat4->hits;
  558.         echo ',';
  559.         echo $dat4->searches;
  560.  
  561.     } else {
  562.  
  563.         echo "ACSSR has seen a total of <b id=\"qs0\">{$dat1->c}</b> players, <b id=\"qs1\">{$dat4->onlinecount}</b> of which are in an Australian server right now. ";
  564.         echo "There are currently <b id=\"qs2\">{$datOnline->c}</b> people browsing ACSSR. So far, there has been a total of <b id=\"qs3\">{$dat4->hits}</b> hits and <b id=\"qs4\">{$dat4->searches}</b> searches made since ACSSR opened <b>" . humanTime(time() - 1103634000, true). " ago</b>. ";
  565.  
  566.         echo "There are <b>{$datMembers->c}</b> members that have logged in recently and there has been a total of <b>{$datFriends->c}</b> friends made and <b>{$datVotes->c}</b> votes cast by members. ";
  567.  
  568.         echo "The player with the longest accumulated playing time in the last 14 days is <a href=\"playerdetails.php?id={$dat4->id}\">{$dat4->ename}</a> who has played for <b>".humanTime($dat4->totaltime, true)."</b> which is <b>".floor($dat4->totaltime / 1209600 * 100)."%</b> of the time. ";
  569.         echo "Yesterdays best player was <a href=\"playerdetails.php?id={$dat4->yesterdaysbestid}\">{$dat4->yesterdaysbestename}</a> who had <b>{$dat4->yesterdaysbestfrags} points</b> in <b>".humanTime($dat4->yesterdaysbesttime, true)."</b>.";
  570.         echo " Here is a daily <a href=\"friendmap/friendmap.png\">social network graph</a> of all ACSSR friends and voters (400KB).";
  571.     }
  572. }
  573.  
  574.  
  575.  
  576. function htmlTitle($a) {
  577.     echo "<b>$a</b>";
  578. }
  579.  
  580. function htmlArticleText($a) {
  581.     echo $a;
  582. }
  583.  
  584. function htmlArticle($a) {
  585.     htmlArticleStart();
  586.     htmlArticleText($a);
  587.     htmlArticleStop();
  588. }
  589.  
  590. function htmlArticleStart() {
  591.     echo '<div class="articlebody">';
  592. }
  593.  
  594. function htmlArticleStop() {
  595.     echo '</div>';
  596. }
  597.  
  598. function htmlFormTextLine($name, $value = "", $size = 0, $class = "") {
  599.     htmlFormText($name, $value, $size, $class);
  600.     echo '<br>';
  601. }
  602.  
  603. function htmlFormText($name, $value = "", $size = 0, $class = "") {
  604.     echo '<input type="text" value="'.$value.'"';
  605.     if ($size)
  606.         echo ' size="'.$size.'"';
  607.     if ($class != "")
  608.         echo ' class="'.$class.'"';
  609.     echo '>';
  610.  
  611. }
  612. function news($dat) {
  613.     $subject = $dat->topic_title;
  614.     $when = $dat->topic_time;
  615.     $body = $dat->post_text;
  616.  
  617.     global $db;
  618.     $d = $db->quickquery('select username from acssrforum.phpbb_users where user_id = ' . $dat->topic_poster);
  619.     $name = $d->username;
  620.     $d = $db->quickquery('select count(*) as replies from acssrforum.phpbb_posts where topic_id = ' . $dat->topic_id);
  621.     $comments = $d->replies - 1;
  622.  
  623.     echo "<div class=\"articlebody\">";
  624.     echo "<b>" . $subject . "</b><br>";
  625.     echo "<div class=\"articlesub\">";
  626.  
  627.     $ago = now() - $when;
  628.     if ($ago > 172800)
  629.         echo mylongdate($when);
  630.     else
  631.         echo "Posted " . humantime($ago) . " ago by $name";
  632.  
  633.     echo "</div>";
  634.     if ($comments == 1) $plural = ''; else $plural = 's';
  635.     $body = str_replace("\n", "<br>", $body);
  636.     echo $body;
  637.     echo '<div class="articlesub"><br><a href="/forum/viewtopic.php?t='.$dat->topic_id.'">'.$comments.' comment'.$plural.'</a> | ';
  638.     echo '<a href="/forum/viewforum.php?f=5">older news</a></div>';
  639.     #    echo '<div class="articlesub"><br><a href="/forum/posting.php?mode=reply&t=' . $dat->topic_id . '">post comment</a></div>';
  640.     echo "</div>";
  641. }
  642.  
  643.  
  644. ?>
  645.  
*************** Inc_error.php** *************** *
Expand|Select|Wrap|Line Numbers
  1. <?
  2.  
  3. #function error($message = "") {
  4. function errorhandler($errno, $errstr, $errfile, $errline) {
  5.  
  6.     global $nohtml;
  7.  
  8.     if (error_reporting() == 0) return;    
  9.     if ($errno == 2048) return;
  10.  
  11.     $message = "$errfile:$errline $errstr ($errno)";
  12.  
  13.     if (ob_get_length()) {
  14.         $html = ob_get_clean();
  15.  
  16.     } else {
  17.  
  18.         $html = "";
  19.  
  20.     }
  21.  
  22.     if (!isset($nohtml)) {
  23.  
  24.         $nohtml = 0;
  25.  
  26.     }
  27.  
  28.     if (1 || !$nohtml) {
  29.  
  30.         htmlStart();
  31.         homeHeading('OOPS!');
  32.         htmlArticleStart();
  33.  
  34.     ?>
  35.         There has been an error on this web site. It might be a little glitch... Refreshing may or may not help!<br><br>
  36.         Every error that happens on ACSSR is recorded so I can tell what went wrong, when and where.<br><br>
  37.         If this error keeps happening please try the page at a later time...
  38.  
  39.     <?
  40.         htmlArticleStop();
  41.         htmlStop(0);
  42.  
  43.     } else {
  44.  
  45.         echo $html;
  46.  
  47.     }
  48.  
  49.     $bt = debug_backtrace();
  50.  
  51.     $outt = "";
  52.     $outh = "<style>
  53.     body, td {
  54.         font-size: 10px;
  55.     }
  56.     </style>
  57.     ";
  58.  
  59.     $outt .= "\nERROR ERROR ERROR\n";
  60.  
  61.     $outh .= "\n<table class=\"error\">";
  62.     $outh .= "\n<tr><td>";
  63.  
  64.     $outt .= $message;
  65.     $outh .= $message;
  66.  
  67.     $i = 0;
  68.  
  69.     foreach($bt as $t) {
  70.  
  71.         $i++;
  72.         #        if ($i <= 2)
  73.         #    continue;
  74.  
  75.         $outt .= "\n";
  76.         $outh .= "\n<tr><td>";
  77.  
  78.         if (isset($t["file"]) && isset($t["line"])) {
  79.             $outt .= $t["file"] . ":" . $t["line"];
  80.             $outh .= $t["file"] . ":" . $t["line"];
  81.         }
  82.  
  83.         $outt .= "\t";
  84.         $outh .= "<td>";
  85.  
  86.         $outt .= $t["function"];
  87.         $outh .= $t["function"];
  88.  
  89.         $outt .= "\t";
  90.         $outh .= "<td>";
  91.  
  92.         foreach($t['args'] as $var) {
  93.             $outh .= $var.'<br>';
  94.         }
  95.  
  96.     }
  97.  
  98.     $outt .= "\n\n";
  99.     $outh .= "\n</table>";
  100.  
  101.     if ($nohtml)
  102.         $outh .= "<pre>";
  103.  
  104.         #    $outh .= $html;
  105.  
  106.     if ($nohtml)
  107.         $outh .= "</pre>";
  108.  
  109.     if ($nohtml) {
  110.         #        echo $outt;
  111.     }
  112.  
  113.     $headers  = "MIME-Version: 1.0\n";
  114.     $headers .= "Content-type: text/html; charset=utf-8\n";
  115.     $headers .= "From: ACSSR Error <gak@slowchop.com>\n";
  116.  
  117.     mail("gak@slowchop.com", $message, $outh, $headers);
  118.  
  119.     #    echo $outh;
  120.  
  121.     die();    
  122.  
  123. }
  124.  
  125. function _errorhandler($errno, $errstr, $errfile, $errline) {
  126.     global $_GET;
  127.     if ($errno == 2048) return;
  128.     error("$errfile:$errline $errstr ($errno)");
  129. }
  130.  
  131. ?>

----------------------------------------------------

Any help would be appriciated :)
Oct 13 '09 #1
4 6329
Markus
6,050 Recognized Expert Expert
The invalid argument warnings are telling you that the variable passed to foreach() is not an array or a traversable object.

The undefined index warning means that you are searching for an index in an array that doesn't exist - in this case, the index 'args'.
Oct 13 '09 #2
mattehz
3 New Member
I have no idea when it comes to PHP, I have 0 experience. I was trying to resurrect an old site but looks like the files have bugs :S
Oct 13 '09 #3
Markus
6,050 Recognized Expert Expert
@mattehz
It seems that way. You might hire a professional to help you.

Mark.
Oct 13 '09 #4
mattehz
3 New Member
Yeah, I might have to.

Thanks anyway
Oct 13 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3672
by: jerrygarciuh | last post by:
Hi all, I am iterating through a result set to generate a second set of queries but no matter what I do I get the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource even though if I echo the query to the browser and cut and paste it into the command line I get valid results.
2
1533
by: ASallade | last post by:
Hello, I've scoured my books and the web, but am still daunted, hopefully some of the users in this newsgroup will have advice for my problem. I am not an experienced javascript programmer, but have gotten my code to work well, without errors on IE, Opera and netscapes recent builds. While testing, I found that it doesnt execute on Netscape 4.7 In the head I have a script that creates a custom object/class for products,
5
1990
by: juglesh | last post by:
"$string = isset($xyz) ? $xyz : "something else";" Hello, someone gave code like this in another thread. I understand (by inference) what it does, but have not found any documentation on this type of syntax. Any one have links to this shortuct(?) syntax and other types of syntax? thanks
17
3318
by: Andreas Huber | last post by:
What follows is a discussion of my experience with .NET generics & the ..NET framework (as implemented in the Visual Studio 2005 Beta 1), which leads to questions as to why certain things are the way they are. ***** Summary & Questions ***** In a nutshell, the current .NET generics & .NET framework make it sometimes difficult or even impossible to write truly generic code. For example, it seems to be impossible to write a truly generic
1
1400
by: llevi | last post by:
Hi there, My aspnet_state.exe service is failing to start due to an invalid argument. Does anyone know what arguments are required/valid for this service. I am running XP pro, .NET Framework v 1.1.4322. Thanks
1
2293
by: Dave Kelly | last post by:
Reference the above thread: "Passing a HTML variable to a PHP file using include". One thing I've learned over the years is that an error doesn't always come from where the compiler/interperture says it does. Case in point maybe. I am getting this error: Notice: Undefined index: var1 in /var/www/vhosts/texasflyfishers.org/httpdocs/form.php on line 4
1
1349
by: guoxin | last post by:
Hi All, May i know how to rectify the following php error? Thanks folks Warning: Invalid argument supplied for foreach() in /home/alan/do_add-user.php on line 36 do_add-user.php.php on line 304: $project_array = $_POST;
1
1637
by: BryanA | last post by:
Something seems to be wrong with this function and I can't figure out why it is failing. The error that it gives is; Invalid argument supplied for foreach() . function transposition($words){ foreach($words as $word){ for($x=0;$x<strlen($word)-1;$x++){ $results = substr($word, 0, $x) . $word . $word . substr($word, $x+2, strlen($word));
14
3346
by: rashgang | last post by:
i have dynamically created checkbox which will like yahoo mail if check box selected it will highlight a row but deleteall function is not working plz chek it function doDeleteAll($objArray){ foreach($objArray as $strkey=>$strValue) { $strDeleteId = $strValue; doDelete($strDeleteId);
0
8666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9010
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8880
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.