İndex Php Subcategories olduğu için gösteriyor..
İndex Php Kodları:
<?php
session_start();
include ("includes/config.php");
// Display files and categories on index page
function displaygamesindex($userStatus) {
global $siteurl, $maxindexpage, $sefriendly;
$cell = "1";
// Get categories
if ($userStatus == '1') {
$result = mysql_query("SELECT * FROM categories WHERE status = '1' && parentcategory = '0' ORDER BY catorder, name");
} else {
$result = mysql_query("SELECT * FROM categories WHERE status = '1' && permissions = '1' && parentcategory = '0' ORDER BY catorder, name");
}
if (mysql_num_rows($result)) {
while($row = mysql_fetch_array($result)) {
$categoryname = $row['name'];
$categoryid = $row['catid'];
if ($userStatus == '1') {
$subresult = mysql_query("SELECT catid FROM categories WHERE status = '1' && parentcategory = '$categoryid' ORDER BY catorder, name");
} else {
$subresult = mysql_query("SELECT catid FROM categories WHERE status = '1' && permissions = '1' && parentcategory = '$categoryid' ORDER BY catorder, name");
}
if (mysql_num_rows($subresult)) {
$sid = '1';
while($subrow = mysql_fetch_array($subresult)) {
$subcategoryid = $subrow['catid'];
$subcategories[$sid] = $subcategoryid;
$sid++;
}
}
// Get files in this category
$sql = "SELECT title, icon, iconlocation, fileid, description, timesplayed FROM files WHERE category = '$categoryid' && status = '1'";
if (isset($subcategories)) {
foreach ($subcategories as $sub) {
$sql .= " or category = '$sub' && status = '1'";
}
}
$sql .= "ORDER BY fileid DESC LIMIT $maxindexpage";
$result2 = mysql_query($sql);
unset ($subcategories);
if ($cell == '1') {
?>
<tr>
<td width="50%" valign="top" style="padding-right: 3px">
<div class="filebox">
<div class="fileboxheader">
<?php echo $categoryname; ?>
</div>
<div class="boxestext">
<table class="boxestext" border="0" width="100%">
<?php
if (mysql_num_rows($result2)) {
while($file = mysql_fetch_array($result2)) {
$filetitle = $file['title'];
$fileicon = $file['icon'];
$iconlocation = $file['iconlocation'];
$fileid = $file['fileid'];
$timesplayed = number_format($file['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $siteurl."/files/image/".$fileicon;
} else {
$imageurl = $fileicon;
}
$filedescription = $file['description'];
if (strlen($filedescription) > '80') {
$filedescription = substr("$filedescription",0,77)."...";
}
?>
<tr>
<td width="71" valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self"><img src="<?php echo $imageurl; ?>" width="70" height="59" title="<?php echo $filetitle; ?>" alt="<?php echo $filetitle; ?>" border="0"></a>
</td>
<td valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self" class="gamelink"><?php echo $filetitle; ?></a><br />
<?php echo $filedescription; ?><br />
<span class="played">(Oynandı: <?php echo $timesplayed; ?> Kere)</span>
</td>
</tr>
<?php
}
}
?>
<tr>
<td colspan="2" align="right">
<a href="<?php echo categoryurl($categoryid,$categoryname); ?>" target="_self">Tümünü Göster ></a>
</td>
</tr>
</table>
</div>
</div>
</td>
<?php
$cell = "2";
} elseif ($cell == '2') {
?>
<td width="50%" valign="top" style="padding-left: 3px">
<div class="filebox">
<div class="fileboxheader">
<?php echo $categoryname; ?>
</div>
<div class="boxestext">
<table class="boxestext" border="0" width="100%">
<?php
if (mysql_num_rows($result2)) {
while($file = mysql_fetch_array($result2)) {
$filetitle = $file['title'];
$fileicon = $file['icon'];
$iconlocation = $file['iconlocation'];
$fileid = $file['fileid'];
$timesplayed = number_format($file['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $siteurl."/files/image/".$fileicon;
} else {
$imageurl = $fileicon;
}
$filedescription = $file[description];
if (strlen($filedescription) > '80') {
$filedescription = substr("$filedescription",0,77)."...";
}
?>
<tr>
<td width="71" valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self"><img src="<?php echo $imageurl; ?>" width="70" height="59" title="<?php echo $filetitle; ?>" alt="<?php echo $filetitle; ?>" border="0"></a>
</td>
<td valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self" class="gamelink"><?php echo $filetitle; ?></a><br />
<?php echo $filedescription; ?><br />
<span class="played">(Oynandı: <?php echo $timesplayed; ?> Kere)</span>
</td>
</tr>
<?php
}
}
?>
<tr>
<td colspan="2" align="right">
<a href="<?php echo categoryurl($categoryid,$categoryname); ?>" target="_self">Tümünü Göster ></a>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
<?php
$cell = "1";
}
}
if ($cell == '2') {
echo "<td></td></tr>";
}
}
}
// Display news
function displaynews() {
global $maxnews;
$news_result = mysql_query("SELECT * FROM news ORDER BY newsid DESC LIMIT $maxnews");
$numbernews = mysql_num_rows($news_result);
if ($numbernews) {
$newsnumber = "1";
while($news_row = mysql_fetch_array($news_result)) {
$newsTitle = $news_row['title'];
$newsMessage = nl2br($news_row['message']);
$newsMessage = bbcode($newsMessage);
if ($numbernews > '1' && $newsnumber < $numbernews) {
echo "<div class=\"newsline\">";
} else {
echo "<div>";
}
echo "<b>".$newsTitle."</b><br />";
echo $newsMessage."<br />";
echo "</div>";
$newsnumber++;
}
} else {
echo "No news";
}
}
$sitename2 = $sitename;
// Load template files
include ("templates/".$template."/header.html");
include ("templates/".$template."/indexpage.html");
include ("templates/".$template."/footer.html");
?>Yanlız Browse phpde ben ana sayfadaki kategoriyi görmek istediğimde alt kategorideki oyunalrda görünsün istşyorum bunun icin browse php ye tam olarak kodu nerden nereye kdr eklemem gerekiyor acaba?Browse Php:
<?php
session_start();
include ("includes/config.php");
$page = $_GET[page];
if (empty($page) || !is_numeric($page)) {
$page = "1";
}
$categoryId = $_GET[c];
if (!is_numeric($categoryId)){
header("Location: ".$siteurl."/");
exit();
}
$sql = mysql_query("SELECT name, description, keywords, permissions, parentcategory FROM categories WHERE catid = '$categoryId' && status = '1'");
if (mysql_num_rows($sql)) {
$row = mysql_fetch_array($sql);
$categoryname = $row['name'];
$categorydescription = $row['description'];
$categorykeywords = $row['keywords'];
$cpermissions = $row['permissions'];
$cparentcategory = $row['parentcategory'];
if ($cparentcategory != '0') {
$category_sql = mysql_query("SELECT name FROM categories WHERE catid = '$cparentcategory'");
$category_row = mysql_fetch_array($category_sql);
$cparentcategoryname = $category_row['name'];
$cparentcategoryname = "<a href=\"".categoryurl($cparentcategory,$cparentcategoryname)."\" class=\"contentheaderlink\">".$cparentcategoryname."</a> > ";
} else {
$cparentcategoryname = "";
}
} else {
header("Location: ".$siteurl."/");
exit();
}
// Display games
function displaygames($categoryId,$page,$categoryname) {
global $siteurl,$filesperpage,$sefriendly;
$result = mysql_query("SELECT title, icon, iconlocation, fileid, description, timesplayed FROM files WHERE category = '$categoryId' && status ='1'");
if (mysql_num_rows($result) == '0') {
echo "There are no files in this category";
} else {
// Get number of pages
$numrows = mysql_num_rows($result);
$offset = ($page - 1) * $filesperpage;
$pagescount = ceil($numrows/$filesperpage);
for ($pagen = 1; $pagen <= $pagescount; $pagen++) {
if ($pagen == $page) {
$nav .= " <b>$pagen</b>";
} else {
if ($pagen >= $page - 5 && $pagen <= $page + 5) {
if ($sefriendly == '1') {
$nav .= " <a href=\"".categoryurl($categoryId,$categoryname)."/".$pagen.".html\">".$pagen."</a>";
} else {
$nav .= " <a href=\"".categoryurl($categoryId,$categoryname)."&page=".$pagen."\">".$pagen."</a>";
}
}
}
}
if ($page > 1) {
$pagen = $page - 1;
if ($sefriendly == '1') {
$prev = "<a href=\"".categoryurl($categoryId,$categoryname)."/1.html\"><<</a> <a href=\"".categoryurl($categoryId,$categoryname)."/".$pagen.".html\"><</a>";
} else {
$prev = "<a href=\"".categoryurl($categoryId,$categoryname)."&page=1\"><<</a> <a href=\"".categoryurl($categoryId,$categoryname)."&page=".$pagen."\"><</a>";
}
} else {
$prev = "";
}
if ($page < $pagescount) {
$pagen = $page + 1;
if ($sefriendly == '1') {
$next = " <a href=\"".categoryurl($categoryId,$categoryname)."/".$pagen.".html\">></a> <a href=\"".categoryurl($categoryId,$categoryname)."/".$pagescount.".html\">>></a>";
} else {
$next = " <a href=\"".categoryurl($categoryId,$categoryname)."&page=".$pagen."\">></a> <a href=\"".categoryurl($categoryId,$categoryname)."&page=".$pagescount."\">>></a>";
}
} else {
$next = "";
}
// Display page numbers
if ($pagescount > '1') {
echo "<tr><td colspan='3' class='pagenumbers'>".$prev.$nav.$next."</td></tr>";
}
$result2 = mysql_query("SELECT fileid, title, description, icon, iconlocation, timesplayed FROM files WHERE category = '$categoryId' && status ='1' ORDER BY title LIMIT $offset, $filesperpage");
$fileinrow="1";
while($row = mysql_fetch_array($result2)) {
$fileid = $row['fileid'];
$filetitle = $row['title'];
$filedescription = $row['description'];
$fileicon = $row['icon'];
$iconlocation = $row['iconlocation'];
$timesplayed = number_format($row['timesplayed']);
if ($iconlocation == '1') {
$imageurl = $siteurl."/files/image/".$fileicon;
} else {
$imageurl = $fileicon;
}
if (strlen($filedescription) > '40') {
$filedescription = substr("$filedescription",0,37)."...";
}
if ($fileinrow == '1') {
echo "<tr>";
}
?>
<td width="33%" valign="top">
<table class="main">
<tr>
<td width="71">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self"><img src="<?php echo $imageurl; ?>" width="70" height="59" title="<?php echo $filetitle; ?>" alt="<?php echo $filetitle; ?>" border="0"></a>
</td>
<td valign="top">
<a href="<?php echo fileurl($fileid,$filetitle); ?>" target="_self" class="gamelink"><?php echo $filetitle; ?></a><br />
<?php echo $filedescription; ?><br />
<span class="played">(Oynandi: <?php echo $timesplayed; ?> Kere)</span>
</td>
</tr>
</table>
</td>
<?php
if ($fileinrow == '3') {
echo "</tr>";
$fileinrow = "0";
}
$fileinrow++;
}
if ($fileinrow == '2') {
echo "<td width=\"33%\"></td><td width=\"33%\"></td></tr>";
} elseif ($fileinrow == '3') {
echo "<td width=\"33%\"></td></tr>";
}
// Display page numbers
if ($pagescount > '1') {
echo "<tr><td colspan='3' class='pagenumbers'>".$prev.$nav.$next."</td></tr>";
}
}
}
function subcategories($categoryId,$userStatus) {
global $siteurl;
if ($userStatus == '1') {
$result = mysql_query("SELECT name, catid FROM categories WHERE status = '1' && parentcategory = '$categoryId' ORDER BY catorder, name");
} else {
$result = mysql_query("SELECT name, catid FROM categories WHERE status = '1' && permissions = '1' && parentcategory = '$categoryId' ORDER BY catorder, name");
}
if (mysql_num_rows($result)) {
?>
<div class="contentbox">
<div class="contentheader">
Alt Kategoriler
</div>
<div class="boxestext">
<?php
while($row = mysql_fetch_array($result)) {
$categoryName = $row['name'];
$catId = $row['catid'];
?>
<img src="<?php echo $siteurl; ?>/images/category.gif" with="16" height="16" title="<?php echo $categoryName; ?>" alt="<?php echo $categoryName; ?>" border="0"/> <a href="<?php echo categoryurl($catId,$categoryName); ?>" target="_self"><?php echo $categoryName; ?></a><br />
<?php
}
?>
</div>
</div>
<?php
}
}
$sitename2 = $categoryname." - ".$sitename;
$sitedescription = $categorydescription;
$sitekeywords = $sitekeywords.", ".$categorykeywords;
// Load template files
include ("templates/".$template."/header.html");
if ($cpermissions == '2' && $userStatus == '0') {
include ("templates/".$template."/logintosee.html");
} else {
include ("templates/".$template."/browse.html");
}
include ("templates/".$template."/footer.html");
?>