
2.si file.php yani bu bölüm

şimdi soruna gelince burdaki sitename yi silmek istiyorum göz zevkini bozuyor ama dosyalarda nereden silineceğini bir türlü bulamadım :S
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="browsegamesbox">
<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 = $sitename." - ".$categoryname;
$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");
?>file.php<?php
session_start();
include ("includes/config.php");
$action = $_GET[action];
$fileId = $_GET[f];
if (!is_numeric($fileId)) {
header ("Location: ".$siteurl."/");
exit();
}
if ($action == 'addcomment') {
$fileComment = $_POST[message];
if ($commentson == '1' && !empty($fileComment) && !empty($fileId)) {
if ($commentwho == '2' && $userStatus == '1' || $commentwho == '1') {
if ($commentapproval == '0' || $commentapproval == '2' && $userStatus == '1') {
$comment_result = mysql_query( "INSERT INTO comments SET fileid = '$fileId', userid = '$userId', comment = '$fileComment', ip = '$ipaddress', date = now(), status = '1'");
} else {
$comment_result = mysql_query( "INSERT INTO comments SET fileid = '$fileId', userid = '$userId', comment = '$fileComment', ip = '$ipaddress', date = now(), status = '0'");
}
if ($userStatus == '1' && $userId > '0') {
$update_user = mysql_query("UPDATE users SET comments = comments + 1 WHERE userid = '$userId'");
}
header ("Location: ".$_SERVER['HTTP_REFERER']);
exit();
} else {
header ("Location: ".$_SERVER['HTTP_REFERER']);
exit();
}
} else {
header ("Location: ".$_SERVER['HTTP_REFERER']);
exit();
}
} elseif ($action == 'tellfriend') {
$yourname = $_POST[yourname];
$youremail = $_POST[youremail];
$friendemail = $_POST[friendemail];
$sql = mysql_query("SELECT title FROM files WHERE fileid = '$fileId' LIMIT 1");
if (mysql_num_rows($sql) > 0) {
$row = mysql_fetch_array($sql);
$fileTitle = $row['title'];
} else {
header ("Location: ".$siteurl."/");
exit();
}
if (!empty($yourname) && !empty($youremail) && !empty($friendemail)) {
if (preg_match(' /[\r\n,;\'"]/ ', $youremail) || preg_match(' /[\r\n,;\'"]/ ', $friendemail)) {
header ("Location: ".$siteurl."/file.php?f=".$fileId."&action=tellfriend");
exit();
}
$friendsession = $_SESSION['friendemail2'];
if ($friendsession != $friendemail) {
$to = $friendemail;
$subject = "Check out ".$fileTitle;
$headers = "Return-Path: ".$youremail."\r\n";
$headers .= "From: ".$yourname." <".$youremail.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html\r\n";
$msg = "Your friend ".$yourname." (".$youremail."; ".$ipaddress.") thought you might be interested in:<br />";
$msg .= fileurl($fileId,$fileTitle);
$msg .= "<br /><br />This message was sent from ".$siteurl;
@mail($to, $subject, $msg, $headers);
$_SESSION['friendemail2'] = $friendemail;
}
?>
<html>
<head>
<title><?php echo $sitename; ?> - Tell A Friend</title>
<link rel="stylesheet" type="text/css" href="<?php echo $siteurl; ?>/templates/default/style.css">
<?php if ($userNewpm == '1') { ?>
<script language="Javascript" type="text/javascript">
<!--
window.open('<?php echo $siteurl; ?>/privatemessages.php?a=newprivatemessage', '', 'HEIGHT=150,resizable=yes,WIDTH=400');
//-->
</script>
<?php } ?>
</head>
<body>
<div class="boxestext">
<center>
Oyun arkadasiniza gönderildi!<br />
<a href="javascript:window.close()">Kapat</a>
</center>
</div>
</body>
</html>
<?php
} else {
?>
<html>
<head>
<title><?php echo $sitename; ?> - Tell A Friend</title>
<link rel="stylesheet" type="text/css" href="<?php echo $siteurl; ?>/templates/default/style.css">
<?php if ($userNewpm == '1') { ?>
<script language="Javascript" type="text/javascript">
<!--
window.open('<?php echo $siteurl; ?>/index.php?action=newprivatemessage', '', 'HEIGHT=150,resizable=yes,WIDTH=400');
//-->
</script>
<?php } ?>
</head>
<body>
<div class="boxestext">
Fill out this form and we will send your friend an email with a link to <b><?php echo $fileTitle; ?></b>.<br /><br />
<form action="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=tellfriend" method="post">
<b>Your Name: </b><br />
<input name="yourname" type="text" value="<?php echo $userName; ?>" size="30" maxlength="50"><br />
<b>Your Email Address:</b><br />
<input name="youremail" type="text" value="<?php echo $userEmail; ?>" size="30" maxlength="50"><br />
<b>Your Friend's Email Address:</b><br />
<input name="friendemail" type="text" size="30" maxlength="50"><br />
<input name="Submit" type="submit" value="Send" >
</form>
</div>
</body>
</html>
<?php
}
} elseif ($action == 'makefavourite') {
if ($userStatus == '1' && $userId > '0') {
// Update favourite file
$update_favourite = mysql_query("UPDATE users SET favourite = '$fileId' WHERE userid = '$userId'");
// Redirect back
header("Location: ".$_SERVER['HTTP_REFERER']);
} else {
header ("Location: ".$siteurl."/");
exit();
}
} elseif ($action == 'rate') {
if ($ratewho == '2' && $userStatus != '1'){
header ("Location: ".$siteurl."/");
exit();
}
$rating = $_GET[rating];
?>
<html>
<head>
<title><?php echo $sitename; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $siteurl; ?>/templates/default/style.css">
<?php if ($userNewpm == '1') { ?>
<script language="Javascript" type="text/javascript">
<!--
window.open('<?php echo $siteurl; ?>/privatemessages.php?a=newprivatemessage', '', 'HEIGHT=150,resizable=yes,WIDTH=400');
//-->
</script>
<?php } ?>
</head>
<body>
<div class="boxestext"><center>
<?php
if (!empty($rating) && $rating >= '1' && $rating <= '5') {
$ratefile = $_SESSION['ratefile'];
if ($fileId != $ratefile) {
$update_rating = mysql_query("UPDATE files SET totalvotes = totalvotes + 1, totalvotepoints = totalvotepoints + '$rating', rating = totalvotepoints / totalvotes WHERE fileid = '$fileId'");
$_SESSION['ratefile'] = $fileId;
}
?>
Thank you for rating this game!<br>
<a href="javascript:window.close()">Close</a>
<?php
} else {
?>
Rate this game on a scale of 1 - 5 :<br>
<a href="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=rate&rating=1" target="_self">1</a> <a href="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=rate&rating=2" target="_self">2</a> <a href="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=rate&rating=3" target="_self">3</a> <a href="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=rate&rating=4" target="_self">4</a> <a href="<?php echo $siteurl; ?>/file.php?f=<?php echo $fileId; ?>&action=rate&rating=5" target="_self">5</a>
<?php
}
?>
</center></div>
</body>
</html>
<?php
} else {
$faction = $_GET[a];
$sql = mysql_query("SELECT * FROM files WHERE fileid = '$fileId' LIMIT 1");
if (mysql_num_rows($sql) > 0) {
$row = mysql_fetch_array($sql);
$filename = $row['file'];
$icon = $row['icon'];
$filelocation = $row['filelocation'];
$iconlocation = $row['iconlocation'];
$customcode = $row['customcode'];
$fileTitle = $row['title'];
$filedescription = $row['description'];
$filekeywords = $row['keywords'];
$filewidth = $row['width'];
$fileheight = $row['height'];
$filecategory = $row['category'];
$timesplayed = $row['timesplayed'];
$filestatus = $row['status'];
$filetype = $row['filetype'];
$filerating = $row['rating'];
$totalvotes = $row['totalvotes'];
$category_sql = mysql_query("SELECT name, permissions FROM categories WHERE catid = '$filecategory' LIMIT 1");
$category_row = mysql_fetch_array($category_sql);
$categoryname = $category_row['name'];
$categorypermissions = $category_row['permissions'];
$categoryurl = categoryurl($filecategory,$categoryname);
// Redirect to index page if game isn't working
if ($filestatus == '0') {
header("Location: ".$siteurl."/");
exit();
}
// Update stats
if ($categorypermissions == '2' && $userStatus == '1' || $categorypermissions == '1') {
if ($maxguestplays <= $guestPlayed && $userStatus == '0') {
} else {
$timesplayed = $timesplayed + 1;
$played_today = $played_today + 1;
$update = mysql_query("UPDATE files SET timesplayed = '$timesplayed' WHERE fileid = '$fileId'");
$update2 = mysql_query("UPDATE statistics SET playedtoday = '$played_today' WHERE datetoday = '$datetoday'");
if ($userStatus == '1') {
$userPlayed = $userPlayed + 1;
$update = mysql_query("UPDATE users SET played = '$userPlayed' WHERE userid = '$userId'");
} elseif ($userStatus == '0') {
if ($guestcredits == '1') {
$guestPlayed = $guestPlayed + 1;
$update = mysql_query("UPDATE online SET played = '$guestPlayed' WHERE ip = '$ipaddress' && status = '0'");
}
}
}
}
} else {
header("Location: ".$siteurl."/");
exit();
}
// Display file
function displayfile($filename,$filewidth,$fileheight,$filetype,$filelocation,$customcode) {
global $siteurl, $filesdir;
if ($filelocation == '1') {
$fileurl = $siteurl."/files/".$filesdir."/".$filename;
} else {
$fileurl = $filename;
}
if ($filetype == '1') {
?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="<?php echo $filewidth; ?>" height="<?php echo $fileheight; ?>">
<param name="movie" value="<?php echo $fileurl; ?>">
<param name="quality" value="high">
<param name="menu" value="false">
<embed src="<?php echo $fileurl; ?>" width="<?php echo $filewidth; ?>" height="<?php echo $fileheight; ?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>
</object>
<?php
} elseif ($filetype == '2') {
?>
<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://active.macromedia.com/director/cabs/sw.cab" width="<?php echo $filewidth; ?>" height="<?php echo $fileheight; ?>" name="shocked" id="swmovie1">
<param name="src" value="<?php echo $fileurl; ?>">
<embed src="<?php echo $fileurl; ?>" width="<?php echo $filewidth; ?>" height="<?php echo $fileheight; ?>">
</object>
<?php
} elseif ($filetype == '3') {
?>
<img src="<?php echo $fileurl; ?>" width="<?php echo $filewidth; ?>" height="<?php echo $fileheight; ?>" border="0">
<?php
} elseif ($filetype == '4') {
?>
<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/ en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" <?php if ($filewidth == '0' || $fileheight == '0') { echo 'AutoSize="true"'; } else { echo 'width="'.$filewidth.'" height="'.$fileheight.'"'; } ?>>
<param name="fileName" value="<?php echo $fileurl; ?>">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="Volume" value="-20">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="<?php echo $fileurl; ?>" name="MediaPlayer1" autostart="1" showcontrols="1" volume="-20" <?php if ($filewidth == '0' || $fileheight == '0') { echo 'AutoSize="true"'; } else { echo 'width="'.$filewidth.'" height="'.$fileheight.'"'; } ?>>
</object>
<?php
} elseif ($filetype == '5') {
echo $customcode;
}
}
// Display comments
function displaycomments($fileId) {
global $maxcomments;
$result = mysql_query("SELECT * FROM comments WHERE fileid = '$fileId' && status = '1' ORDER BY commentid DESC LIMIT $maxcomments");
if (mysql_num_rows($result)) {
while($row = mysql_fetch_array($result))
{
$cuserid = $row[userid];
$comment = nl2br(htmlentities($row[comment]));
$comment = bbcode($comment);
$cdate = $row[date];
if ($cuserid == '0') {
$cusername = "Guest";
} else {
$sql = mysql_query("SELECT username FROM users WHERE userid = '$cuserid' LIMIT 1");
$row2 = mysql_fetch_array($sql);
$cusername = htmlentities($row2[username]);
$cusername = "<a href=\"".profileurl($cuserid,$cusername)."\">".$cusername."</a>";
}
?>
<table border="0" width="98%" class="boxestext">
<tr>
<td width="50%" valign="top">
<b>Name:</b> <?php echo $cusername; ?>
</td>
<td width="50%" valign="top">
<b>Date:</b> <?php echo $cdate; ?>
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<?php echo $comment; ?>
</td>
</tr>
</table>
<?php
}
}
}
// Display related files
function relatedfiles($filecategory,$fileId) {
global $siteurl, $maxrelatedfiles;
$result = mysql_query("SELECT fileid, title, description, icon, iconlocation, timesplayed FROM files WHERE category = '$filecategory' && status ='1' && fileid != '$fileId' ORDER BY RAND() LIMIT $maxrelatedfiles");
while($row = mysql_fetch_array($result)) {
$rfileId = $row['fileid'];
$rfileTitle = $row['title'];
$rfileDescription = $row['description'];
$rfileIcon = $row['icon'];
$riconLocation = $row['iconlocation'];
$rtimesPlayed = number_format($row['timesplayed']);
if ($riconLocation == '1') {
$rimageUrl = $siteurl."/files/image/".$rfileIcon;
} else {
$rimageUrl = $rfileIcon;
}
if (strlen($rfileDescription) > '80') {
$rfileDescription = substr("$rfileDescription",0,77)."...";
}
?>
<tr>
<td width="71">
<a href="<?php echo fileurl($rfileId,$rfileTitle); ?>" target="_self"><img src="<?php echo $rimageUrl; ?>" width="70" height="59" title="<?php echo $rfileTitle; ?>" alt="<?php echo $rfileTitle; ?>" border="0"></a>
</td>
<td valign="top">
<a href="<?php echo fileurl($rfileId,$rfileTitle); ?>" target="_self" class="gamelink"><?php echo $rfileTitle; ?></a><br />
<?php echo $rfileDescription; ?><br />
<span class="played">(Played: <?php echo $rtimesPlayed; ?> times)</span>
</td>
</tr>
<?php
}
}
$sitename2 = $sitename." - ".$fileTitle;
$sitedescription = $filedescription;
$sitekeywords = $sitekeywords.", ".$filekeywords;
// Load template files
if ($filelocation == '3') {
if ($categorypermissions == '2' && $userStatus == '0' || $maxguestplays <= $guestPlayed && $userStatus == '0') {
include ("templates/".$template."/header.html");
include ("templates/".$template."/logintosee.html");
include ("templates/".$template."/footer.html");
} else {
include ("templates/".$template."/framefile.html");
}
} else {
if ($categorypermissions == '2' && $userStatus == '0' || $maxguestplays <= $guestPlayed && $userStatus == '0') {
include ("templates/".$template."/header.html");
include ("templates/".$template."/logintosee.html");
include ("templates/".$template."/footer.html");
} else {
if ($faction == 'popup') {
include ("templates/".$template."/popfile.html");
} else {
include ("templates/".$template."/header.html");
include ("templates/".$template."/file.html");
include ("templates/".$template."/footer.html");
}
}
}
}
?>hepsi bu kadar yardımcı olursanız çok makbule gerçecek teşekkürleer