Page 1 of 1

alternative code for includes tag?

Posted: Wed Feb 17, 2010 12:38 pm
by gaogier

Code: Select all

</td>
            <td width="178"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr align="left" valign="top">
                          <td width="8" height="29"><img src="image/rightcol-th-01.jpg" width="8" height="30"></td>
                          <td valign="top" class="right-col-th-bg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td height="30" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr align="left" valign="top">
                                  <td width="30" height="29" align="center" valign="middle"><img src="image/arrow.jpg" width="17" height="9"></td>
                                  <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                                  <td valign="middle" class="th_text">Recent Posts</td>
                                </tr>
                              </table></td>
                            </tr>
                          </table></td>
                          <td width="8"><img src="image/rightcol-th-02.jpg" width="8" height="30"></td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td height="20" align="left" valign="top" class="rightcol-bg"><table width="100%"  border="0" cellspacing="8" cellpadding="0">
                      <tr>
                        <td align="left" valign="top" class="normal_text01"><p><center><marquee scrollamount="2" direction="up" height="200" scrolldelay="1" onMouseOver="this.stop()" onMouseOut="this.start()">             <?php
require_once ('../mysql_connect1.php');//connect to db
   
$forumQ=mysql_query("SELECT p.topic_id, p.forum_id, p.post_subject, u.user_id, u.username_clean, u.user_colour
FROM phpbb_posts AS p
INNER JOIN phpbb_users AS u
ON p.poster_id = u.user_id
WHERE p.post_approved=1
ORDER BY p.topic_id DESC
LIMIT 20");
while($forumRow = mysql_fetch_assoc($forumQ)){
echo " <a href=forums/viewtopic.php?f=".$forumRow['forum_id']."&t=".$forumRow['topic_id'].">".$forumRow['post_subject']."</a><br>&nbsp;&nbsp;&nbsp;Author: <a href='./memberlist.php?mode=viewprofile&u=".$forumRow['user_id']."' style='color: ".$forumRow['user_colour'].";'>".$forumRow['username_clean']."</a><br><br>
";
}
 
?>
<br /><br />
 
<a href="/forums/">RuneHints<br />
The Solution to all your RuneScape Problems</a></marquee></center>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr align="left" valign="top">
                          <td width="10"><img src="image/leftcol-box1-bot-left.jpg" width="10" height="16"></td>
                          <td class="leftcol-bot-mid-bg">&nbsp;</td>
                          <td width="10"><img src="image/leftcol-box1-bot-right.jpg" width="10" height="16"></td>
                        </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="5" align="left" valign="top"><img src="image/specer.png" width="1" height="1"></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="8" height="29"><img src="image/rightcol-th-01.jpg" width="8" height="30"></td>
                            <td valign="top" class="right-col-th-bg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td height="30" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr align="left" valign="top">
                                        <td width="30" height="29" align="center" valign="middle"><img src="image/arrow.jpg" width="17" height="9"></td>
                                        <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                                        <td valign="middle" class="th_text">Forum Stats</td>
                                      </tr>
                                  </table></td>
                                </tr>
                            </table></td>
                            <td width="8"><img src="image/rightcol-th-02.jpg" width="8" height="30"></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td height="20" align="left" valign="top" class="rightcol-bg"><table width="100%"  border="0" cellspacing="8" cellpadding="0">
                          <tr>
                            <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td height="20" align="left" valign="middle" class="normal_text01"><?php include_once('fostats.php') ?></td>
                              </tr>
                              <tr>
                                <td align="left" valign="top">&nbsp;</td>
                              </tr>
                            </table></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="10"><img src="image/leftcol-box1-bot-left.jpg" width="10" height="16"></td>
                            <td class="leftcol-bot-mid-bg">&nbsp;</td>
                            <td width="10"><img src="image/leftcol-box1-bot-right.jpg" width="10" height="16"></td>
                          </tr>
                      </table></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td height="5" align="left" valign="top"><img src="image/specer.png" width="1" height="1"></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="8" height="29"><img src="image/rightcol-th-01.jpg" width="8" height="30"></td>
                            <td valign="top" class="right-col-th-bg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td height="30" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr align="left" valign="top">
                                        <td width="30" height="29" align="center" valign="middle"><img src="image/arrow.jpg" width="17" height="9"></td>
                                        <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                                        <td valign="middle" class="th_text">Site Stats</td>
                                      </tr>
                                  </table></td>
                                </tr>
                            </table></td>
                            <td width="8"><img src="image/rightcol-th-02.jpg" width="8" height="30"></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td height="20" align="left" valign="top" class="rightcol-bg"><table width="100%"  border="0" cellspacing="8" cellpadding="0">
                          <tr>
                            <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td height="20" align="left" valign="middle" class="normal_text01"><?php include_once('aguestonline.php') ?><br><?php include('totals.inc'); ?></td>
                              </tr>
                              <tr>
                                <td align="left" valign="top">&nbsp;</td>
                              </tr>
                            </table></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="10"><img src="image/leftcol-box1-bot-left.jpg" width="10" height="16"></td>
                            <td class="leftcol-bot-mid-bg">&nbsp;</td>
                            <td width="10"><img src="image/leftcol-box1-bot-right.jpg" width="10" height="16"></td>
                          </tr>
                      </table></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td height="5" align="left" valign="top"><img src="image/specer.png" width="1" height="1"></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="8" height="29"><img src="image/rightcol-th-01.jpg" width="8" height="30"></td>
                            <td valign="top" class="right-col-th-bg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td height="30" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr align="left" valign="top">
                                        <td width="30" height="29" align="center" valign="middle"><img src="image/arrow.jpg" width="17" height="9"></td>
                                        <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                                        <td valign="middle" class="th_text">Poll</td>
                                      </tr>
                                  </table></td>
                                </tr>
                            </table></td>
                            <td width="8"><img src="image/rightcol-th-02.jpg" width="8" height="30"></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td height="20" align="left" valign="top" class="rightcol-bg"><table width="100%"  border="0" cellspacing="8" cellpadding="0">
                          <tr>
                            <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td height="20" align="left" valign="middle" class="normal_text01"><?php
require_once ('mysql_connect.php');//connect to db
    $current_query = "SELECT * FROM poll_current";
    if ($current_result = mysql_query($current_query)) {
      $current_row = mysql_fetch_array($current_result);
      $current = $current_row['poll_num'];
    }
    
    if(isset($_POST['submit']) && ctype_digit($_POST['vote'])) {
      $query = 'UPDATE poll_answers SET votes=votes+1 WHERE choice=' . $_POST['vote'] .' && poll_num='.$current;
      $result = mysql_query($query);
      ob_end_clean();
      setcookie ('vote', 'voted', time()+1209600, '/', 'runehints.com', '0');
      ob_end_clean();
      header("Location: http://runehints.com/");
      require_once ('../mysql_connect.php');//connect to db
    }
    
    if (isset($_COOKIE['vote']))  
{   
    $question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
    if($question_result = mysql_query($question_query)) {
        $question_row = mysql_fetch_array($question_result);
        $question = $question_row['question'];
 
    $num_votes_query = 'SELECT SUM(votes) AS sumvotes
    FROM poll_answers WHERE poll_num='.$current;
 
    if ($result = mysql_query($num_votes_query)) {
      $row = mysql_fetch_array($result);
      $sum = $row['sumvotes'];
    }
    $totals_query = 'SELECT activity, votes FROM poll_answers WHERE poll_num='.$current.' ORDER BY choice ASC';
    if ($result = mysql_query($totals_query)) {
    echo '<font class="small2">'.$question.'<br /><br />';
    echo '<table width="100%" cellpadding="1" cellspacing="0" border="0" style="font-family: Verdana; font-size: 9px; color: #efefef">';
        
      while($row = mysql_fetch_array($result)) {
        $percent = round($row['votes'] * 100 / $sum);
        echo '<tr><td width="3"></td><td width="100%" colspan="3">'. $row['activity'];
        echo '</td><td width="3"></td></tr><tr><td width="3"></td><td width="100%"><table width="100%"><tr><td height="9" width="'. $percent .'" background="http://www.runehints.com/images/bar.png"></td><td></td></tr></table></td><td width="3"></td><td width="0" align="right">'. $row['votes'] .'</td><td width="3"></td></tr>';
      }
      echo '<table cellpadding="0" cellspacing="0" border="0"><tr><td height="3"></td></tr></table><font style="font-size: 9px"><center><i>Votes:&nbsp;'.$sum.'</i></center></font>'; 
      
    }else{
    echo '<font class="small2">Sorry no polls are currently active</font>';
    }
}   
    
}else{
    $question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
    if($question_result = mysql_query($question_query)) {
        $question_row = mysql_fetch_array($question_result);
        $question = $question_row['question'];
        
        
          
        $form_query = 'SELECT * FROM poll_answers WHERE poll_num='.$current;
        if($result = mysql_query($form_query)) {
            echo '<form action='.$_SERVER['PHP_SELF'].' method="post">';
            echo '<font class="small2">'.$question.'<br />';
            while($row = mysql_fetch_array($result)) {
           
                echo '<input type="radio" name="vote" value=' . $row['choice'] . '>'. $row['activity'] . '<br />';
             }
                echo '<center><input name="submit" type="submit" value="Vote!"></form></center>';
            
        }
 
    }else{
        echo '<font class="small2">Sorry no polls are currently active </font>'; 
    }
 
}
?></td>
                                </tr>
                            </table></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="10"><img src="image/leftcol-box1-bot-left.jpg" width="10" height="16"></td>
                            <td class="leftcol-bot-mid-bg">&nbsp;</td>
                            <td width="10"><img src="image/leftcol-box1-bot-right.jpg" width="10" height="16"></td>
                          </tr>
                      </table></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr align="left" valign="top">
            <td width="10"><img src="image/footer_left-bg.jpg" width="10" height="90"></td>
            <td class="footer_bg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="30" align="center" valign="bottom">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="link_text02">Home</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" class="link_text02">Forums</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="link_text02">Desktop</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" class="link_text02">Dragon Knight RPG</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" class="link_text02">Contact Us</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" class="link_text02">Staff Info</a> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" class="link_text02">Top Sites</a></td>
              </tr>
              <tr>
                <td align="center" valign="top" class="normal_text01">Copyright &copy; 2004-2009 RuneHints.com. All Rights Reserved.<br>This site is not official and is in no ways affiliated with RuneScape. <br>All images related to Runescape are the property of Jagex Ltd.<br>Runescapeô is a trademark of Jagex Software © 1999-2009 Andrew Gower and JagexÆ, Ltd.</td>
              </tr>
            </table></td>
            <td width="10"><img src="image/footer_right-bg.jpg" width="10" height="90"></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
 
<?php ob_flush(); ?>
If I remove, this tag <?php include('totals.inc'); ?> the right hand column will continue, however the footer is on other pages, but it works.


Check out here, http://runehints.com
http://runehints.com/quest.php - dose not work correctly.

Re: alternative code for includes tag?

Posted: Wed Feb 17, 2010 12:59 pm
by JNettles
When you post 300+ lines of code, you should probably tell what line to look at. What's your question? I don't understand.