Jump to content

Archived

This topic is now archived and is closed to further replies.

localhost

will not include files?

Recommended Posts

i have a script, it must be dying somewhere before it gets to it but it wont include the three bottom includes! please help out if you can...

[code]
<?php
session_start();
$username = $_SESSION['username'];
echo "<center>";
include('inc/connect.php');
include('footer.php');
echo "<br><br>";

$admin = "10";

$sql = "SELECT * FROM users WHERE username = '$username' AND user_level = '$admin'";
$sqlr = mysql_query($sql) or die(mysql_error());
$nr = mysql_num_rows($sqlr);

if($nr==1)
{
echo "
<font size=1><a href=admin/>Administration Panel</a></font>";
} else {
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link href="default.css" type="text/css" rel="stylesheet" />
<style type="text/css">
<!--
.catbg {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
font-style: normal;
line-height: 24px;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #FFFFFF;
background-image: url(cat.jpg);
background-repeat: no-repeat;
background-position: center top;
width: 650px;

}

</style>
</head>
<center>
<Font face="arial" size="1">
<?php


/* ***** INCLUDE NECESSARY FILES ***** */
include('inc/connect.php');
include('inc/config.php');

$username = $_SESSION['username'];

/* ***** SELECT ALL CATEGORIES AND DEFINE THEIR TITLES ***** */
$query = "SELECT * FROM categories ORDER BY id ASC";
$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result))
{
$cat_name = $row['title'];

?>
<br><div class="catbg"> <?php echo "$cat_name"; ?></div>
<?php
/* ***** SHOW WHAT EACH COLUMN MEANS WITH BORDERLESS TABLE ***** */
  echo "<table width=\"650\" cellpadding=\"0\" border=\"0\">
  <tr>
    <td width=\"50\">&nbsp;</td>
    <td width=\"207\">Forum</td>
    <td width=\"229\">Latest Thread</td>
    <td width=\"66\">Threads</td>
    <td width=\"64\">Posts</td>
  </tr>
</table>";

/* ***** SELECT ALL FORUMS WITHIN THAT CATEGORY ***** */
$result2 = mysql_query("SELECT * FROM forums WHERE cat_name = '$cat_name'");


 
            for($v=0;$v<mysql_num_rows($result2);$v++)
          {
              $row2 = mysql_fetch_array($result2);
     
        $forum_id = $row2['id'];
        $forum_title = $row2['title'];
        $forum_description = $row2['description'];


/* ***** START OF QUERY FOR THREAD COUNT ***** */
$result3 = mysql_query("SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id'");
  if(mysql_num_rows($result3)>0)
              {
                    $nr3 = mysql_num_rows($result3);
              }
              else
              {
                    $nr3 = 0;
              }


/* ***** END OF THREAD COUNT SNIPPET ***** */

/* ***** QUERY TO SHOW POST COUNT FOR EACH INDIVIDUAL FORUM ***** */
$sql2 = "SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id'";
$sqlr2 = mysql_query($sql2) or die(mysql_error());

/* $sql3 = "SELECT * FROM posts WHERE  */
/* ***** START OF QUERY FOR LATEST THREAD ***** */
$result4 = mysql_query("SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id' ORDER BY id DESC limit 0,1");
$x = mysql_fetch_array($result4) or die(mysql_error());

$nrx = mysql_num_rows($result4) or die(mysql_error());

$latest_id = $x['id'];
$latest_title = $x['title'];
$latest_poster = $x['poster'];

/* ***** END OF LATEST THREAD SNIPPET ***** */

if($nrx!=0)
{
echo "
<table width=\"650\" height=\"57\" border=\"1\">
  <tr>
    <td width=\"50\" height=\"61\"><center>New!</center></td>
    <td width=\"207\"><A href=\"viewforum.php?fid=$forum_id\">$forum_title</a><br>
    <i></font><font face=arial size=1>$forum_description</font><font face=arial size=2></i></td>
    <td width=\"229\"><a href=\"viewthread.php?id=$latest_id\">$latest_title</a>
<Br>
by <a href=\"viewprofile.php?u=$latest_poster\">$latest_poster</a></td>
    <td width=\"66\"><center>$nr3</center></td>
    <td width=\"64\"><Center><a target=_blank href=ni.php>NI</a></center></td>
  </tr>
</table>";
} else {       
echo "
<table width=\"650\" height=\"57\" border=\"1\">
  <tr>
    <td width=\"50\" height=\"61\"><center>New!</center></td>
    <td width=\"207\"><A href=\"viewforum.php?fid=$forum_id\">$forum_title</a><br>
    <i></font><font face=arial size=1>$forum_description</font><font face=arial size=2></i></td>
    <td width=\"229\"><center>None</center></a>
<Br>
<a href=\"viewprofile.php?u=$latest_poster\">$latest_poster</a></td>
    <td width=\"66\"><center>None</center></td>
    <td width=\"64\"><Center><a target=_blank href=ni.php>NI</a></center></td>
  </tr>
</table>";


}
/* ***** END BOTH WHILE STATEMENTS ***** */
}

}

include('forumstats.php');
echo "<bR><Br><Br>";
include('footer.php');
echo "<br><br><br>";
include('poweredby.php');

?>
[/code]

Share this post


Link to post
Share on other sites
Have you tried echoing random characters at different points to find out which lines are being executed? Put on where your last comment is and see if it gets run.

Share this post


Link to post
Share on other sites
sometimes you have to put
./ before the file name, check hte php ini for the directory listing, then that is what is always required at the front of it.

Share this post


Link to post
Share on other sites
[code]
<?php
session_start();
$username = $_SESSION['username'];
echo "<center>";
include('inc/connect.php');
include('footer.php');
echo "<br><br>";

$admin = "10";

$sql = "SELECT * FROM users WHERE username = '$username' AND user_level = '$admin'";
$sqlr = mysql_query($sql) or die(mysql_error());
$nr = mysql_num_rows($sqlr);

if($nr==1)
{
echo "
<font size=1><a href=admin/>Administration Panel</a></font>";
} else {
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link href="default.css" type="text/css" rel="stylesheet" />
<style type="text/css">
<!--
.catbg {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
font-style: normal;
line-height: 24px;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #FFFFFF;
background-image: url(cat.jpg);
background-repeat: no-repeat;
background-position: center top;
width: 650px;

}

</style>
</head>
<center>
<Font face="arial" size="1">
<?php


/* ***** INCLUDE NECESSARY FILES ***** */
include('inc/connect.php');
include('inc/config.php');

$username = $_SESSION['username'];

/* ***** SELECT ALL CATEGORIES AND DEFINE THEIR TITLES ***** */
$query = "SELECT * FROM categories ORDER BY id ASC";
$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result))
{
$cat_name = $row['title'];

?>
<br><div class="catbg"> <?php echo "$cat_name"; ?></div>
<?php
/* ***** SHOW WHAT EACH COLUMN MEANS WITH BORDERLESS TABLE ***** */
  echo "<table width=\"650\" cellpadding=\"0\" border=\"0\">
  <tr>
    <td width=\"50\">&nbsp;</td>
    <td width=\"207\">Forum</td>
    <td width=\"229\">Latest Thread</td>
    <td width=\"66\">Threads</td>
    <td width=\"64\">Posts</td>
  </tr>
</table>";

/* ***** SELECT ALL FORUMS WITHIN THAT CATEGORY ***** */
$result2 = mysql_query("SELECT * FROM forums WHERE cat_name = '$cat_name'");


 
            for($v=0;$v<mysql_num_rows($result2);$v++)
          {
              $row2 = mysql_fetch_array($result2);
     
        $forum_id = $row2['id'];
        $forum_title = $row2['title'];
        $forum_description = $row2['description'];


/* ***** START OF QUERY FOR THREAD COUNT ***** */
$result3 = mysql_query("SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id'");
  if(mysql_num_rows($result3)>0)
              {
                    $nr3 = mysql_num_rows($result3);
              }
              else
              {
                    $nr3 = 0;
              }


/* ***** END OF THREAD COUNT SNIPPET ***** */

/* ***** QUERY TO SHOW POST COUNT FOR EACH INDIVIDUAL FORUM ***** */
$sql2 = "SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id'";
$sqlr2 = mysql_query($sql2) or die(mysql_error());

/* $sql3 = "SELECT * FROM posts WHERE  */
/* ***** START OF QUERY FOR LATEST THREAD ***** */
$result4 = mysql_query("SELECT * FROM posts WHERE type = '1' AND fid = '$forum_id' ORDER BY id DESC limit 0,1");
$x = mysql_fetch_array($result4) or die(mysql_error());

$nrx = mysql_num_rows($result4) or die(mysql_error());

$latest_id = $x['id'];
$latest_title = $x['title'];
$latest_poster = $x['poster'];

/* ***** END OF LATEST THREAD SNIPPET ***** */

if($nrx!=0)
{
echo "
<table width=\"650\" height=\"57\" border=\"1\">
  <tr>
    <td width=\"50\" height=\"61\"><center>New!</center></td>
    <td width=\"207\"><A href=\"viewforum.php?fid=$forum_id\">$forum_title</a><br>
    <i></font><font face=arial size=1>$forum_description</font><font face=arial size=2></i></td>
    <td width=\"229\"><a href=\"viewthread.php?id=$latest_id\">$latest_title</a>
<Br>
by <a href=\"viewprofile.php?u=$latest_poster\">$latest_poster</a></td>
    <td width=\"66\"><center>$nr3</center></td>
    <td width=\"64\"><Center><a target=_blank href=ni.php>NI</a></center></td>
  </tr>
</table>";
} else {       
echo "
<table width=\"650\" height=\"57\" border=\"1\">
  <tr>
    <td width=\"50\" height=\"61\"><center>New!</center></td>
    <td width=\"207\"><A href=\"viewforum.php?fid=$forum_id\">$forum_title</a><br>
    <i></font><font face=arial size=1>$forum_description</font><font face=arial size=2></i></td>
    <td width=\"229\"><center>None</center></a>
<Br>
<a href=\"viewprofile.php?u=$latest_poster\">$latest_poster</a></td>
    <td width=\"66\"><center>None</center></td>
    <td width=\"64\"><Center><a target=_blank href=ni.php>NI</a></center></td>
  </tr>
</table>";

include('forumstats.php');
echo "<bR><Br><Br>";
include('footer.php');
echo "<br><br><br>";
include('poweredby.php');
}
/* ***** END BOTH WHILE STATEMENTS ***** */
}

}


?>
[/code]maybe they need 2 be before the closed brackets}

Share this post


Link to post
Share on other sites

×

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.