<?php
/**********************************************************
* ______ ______ ___ _______ ___ ___ _______ *
* | _ \ | _ \ | | | _ || Y || _ | *
* |. | \|. | \|. | |. 1___||. || 1___| *
* |. | |. | |. |___ |. |___ |. \_/ ||____ | *
* |: 1 |: 1 |: 1 ||: 1 ||: | ||: 1 | *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . | *
* `------' `------' `-------'`-------'`--- ---'`-------' *
* _______ _______ *
* .--.--. | _ | | | *
* | | | |___| | __ |___| | *
* \___/ _(__ | |__| / ___/ *
* |: 1 | |: 1 \ *
* |::.. . | |::.. . | *
* `-------' `-------' *
* *
* Script: DDLCMS v3.2 *
* Author: Little Dragon *
* Email: hide@address.com *
* Website: http://www.ddlcms.com *
* *
* Please direct bug reports, suggestions or feedback *
* to the DDLCMS forums: *
* *
* http://www.ddlcms.com/forums *
* *
* DDLCMS is a commercial grade content management *
* system for DDL site owners. It is provided free *
* of charge, provided: *
* *
* 1. You keep the linkback to http://www.ddlcms.com *
* in the footer. *
* *
* 2. You keep the sponsored links to Sharingzone.net *
* on your site. *
* *
* By using this script, you agree that you will not *
* modify, remove, or replace any encoded parts of *
* this script. All encoded parts MUST remain intact *
* for your site to remain in good standing. *
* *
**********************************************************/
# go.php
define('WWWROOT', dirname(__FILE__) . '/');
define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
require(BASEDIR . 'funcs.inc');
require(BASEDIR . 'config.php');
$c = new config();
$c->open();
if(checkURLQuery('go.php', $_GET) === TRUE && $_GET['go'] == 'Download')
{
$downloadQuery = dbcom("SELECT * FROM downloads WHERE id = {$_GET['id']} LIMIT 1;");
if(mysql_num_rows($downloadQuery) > 0)
{
$row = mysql_fetch_assoc($downloadQuery);
$row['title'] = str_replace('#', '', $row['title']);
$row['title'] = str_replace("'", '', $row['title']);
$row['url'] = str_replace('#', '', $row['url']);
@dbcom("UPDATE downloads SET views=views+1 WHERE id = '{$row['id']}';");
echo("<html><head><title>Download: {$row['title']} $site_name: $description</title>
<meta name=\"robots\" content=\"index,follow\">
<meta name=\"description\" content=\"Download {$row['title']}, download provided by $site_name. $description\">
<meta name=\"keywords\" content=\"{$row['title']}, download {$row['title']}, $keywords\">
<FRAMESET FRAMEBORDER=0 FRAMESPACING=0 BORDER=0 ROWS=\"90,*\">
<FRAME SRC='$site_url/frame.php?d={$row['title']}&rowurl={$row['url']}&id={$row['id']}&providedbyurl={$row['surl']}&providedbysite={$row['sname']}&cat={$row['type']}'>
</FRAME>
<FRAME SRC=\"{$row['url']}\" name=\"{$row['title']}\" FRAMEBORDER=0 FRAMESPACING=0 MARGINHEIGHT=0 MARGINWIDTH=0>
</FRAMESET>
<NOFRAMES>
<BODY><H1>Download: {$row['title']}</H1><P>{$row['title']} download file<!-- Free full version download {$row['title']} -->
<A HREF=\"{$row['title']}\" TITLE=\"{$row['title']}\"><IMG SRC=\"{$row['title']}\" ALT=\"{$row['title']}\">{$row['title']} </A>
</NOFRAMES>");
# add to recent download
if(!@mysql_num_rows(dbcom("SELECT id FROM recents WHERE title = '{$row['title']}';")))
{
dbcom("INSERT INTO recents (id, type, title, date, views) VALUES ('{$row['id']}', '{$row['type']}','{$row['title']}', NOW(),'1');");
}
else
{
if($_GET['top'] == 0)
{
# Only update the views and date if not clicked from top 5 list
dbcom("UPDATE recents SET views = views+1 WHERE title = '{$row['title']}';");
dbcom("UPDATE recents SET date = NOW() WHERE title = '{$row['title']}';");
}
}
# end adding recent download
# Delete records older than 7 days (only go.php, not go2.php):
dbcom('DELETE FROM recents WHERE date < DATE_SUB(NOW(), INTERVAL 1 WEEK);');
}
else
{
$id = FALSE;
}
}
elseif(checkURLQuery('go.php_report', $_GET) === TRUE && $_GET['go'] == 'Report')
{
$get = @dbcom("SELECT * FROM downloads WHERE id = '{$_GET['id']}';");
if(mysql_num_rows($get) > 0)
{
echo "<html><head><title>Report Dead Link</title><link rel=\"stylesheet\" href=\"skins/$skin/stylesheet.css\" type=\"text/css\"></head><body style=\"margin:0\">\n\n";
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100%\">";
$row = mysql_fetch_array($get);
if(!(isset($_POST) && is_array($_POST) && count($_POST) > 0 && checkPostForm('reportDownload', $_POST) === TRUE))
{
echo "<form name=\"deadlink\" action=\"go.php?id={$row['id']}&go=Report\" method=\"post\">
<tr><td align=\"center\" valign=\"middle\" height=\"100%\" width=\"100%\" class=\"report\"><h2>Report Dead Link</h2><P>
<b>{$row['title']}</b><br>
<a href=\"{$row['url']}\" target=\"_blank\">{$row['url']}</a><br><br><small>Only click the button if the <u>download link</u> on the previous page is dead!<br><br>
<input type=\"Submit\" value=\"Report - {$row['title']}\" style=\"font-family:Verdana,Arial; font-size:10;\">
<input type=\"Hidden\" name=\"id\" value=\"{$row['id']}\">
</td></tr></form></table>";
# Delete IPs older than 60 seconds from Reporter's IP log
dbcom('DELETE FROM reportip WHERE time < DATE_SUB(NOW(), INTERVAL 1 MINUTE);');
}
else
{
$visitor_ip = $_SERVER['REMOTE_ADDR'];
# the ip address of the visitor
$ipQuery = dbcom("SELECT ip FROM reportip WHERE ip = '$visitor_ip' LIMIT 1;");
if(mysql_num_rows($ipQuery) > 0)
{
# visitor already reported a file within 60 seconds
echo "<tr><td align=\"center\" valign=\"middle\" height=\"100%\" width=\"100%\" class=\"report\"><P> You cannot report again so fast!<br><br>
<a href=\"javascript:window.close()\">Close Window</a></td></tr></table>\n";
echo "\n</body>\n</html>";
die();
}
# Store Reporter's IP
dbcom("INSERT INTO reportip (ip) VALUES ('$visitor_ip');");
# Increment Report Count
@dbcom("UPDATE downloads SET reports=reports+1 WHERE id = '{$row['id']}';");
echo "<tr><td align=\"center\" valign=\"middle\" height=\"100%\" width=\"100%\" class=\"report\"><h2>Thank you</h2><P> The Dead Link has been reported!<br><br>
<a href=\"javascript:window.close()\">Close Window</a></td></tr></table>\n";
# While we're here, check if the Reports > deadlink_threshold and if so, delete the link
dbcom("DELETE FROM downloads WHERE Reports > '$deadlink_threshold';");
dbcom('DELETE FROM downloads_ratings WHERE id = ' . $row['id'] . ';');
}
echo "\n</body>\n</html>";
}
else
{
$id = FALSE;
}
}
elseif(checkURLQuery('go.php_rate', $_GET) === TRUE && $_GET['go'] == 'Rate' && $_GET['rating'] >= 1 && $_GET['rating'] <= 5)
{
$downloadQuery = dbcom('SELECT * FROM downloads WHERE id = ' . $_GET['id'] . ';');
if(mysql_num_rows($downloadQuery) > 0)
{
echo '
<html>
<head>
<title>Rate this</title>
<link rel="stylesheet" href="skins/' . $skin . '/stylesheet.css" type="text/css" />
</head>
<body style="margin:0">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">' . "\n";
$downloadArray = mysql_fetch_assoc($downloadQuery);
# Delete IPs older than 90 seconds from Ratings IP log
dbcom('DELETE FROM rateip WHERE time < DATE_SUB(NOW(), INTERVAL 90 SECOND);');
# The IP address of the visitor
$visitor_ip = $_SERVER['REMOTE_ADDR'];
$ipQuery = dbcom("SELECT ip FROM rateip WHERE ip = '$visitor_ip' LIMIT 1;");
if(mysql_num_rows($ipQuery) > 0)
{
# Visitor already rated a download within 90 seconds
echo '<tr><td align="center" valign="middle" height="100%" width="100%" class="report"><p> You cannot rate again so fast!</p>
<a href="javascript:window.close()">Close Window</a></td></tr></table>' . "\n";
echo '</body>' . "\n" . '</html>';
die();
}
else
{
# Store Rater's IP
dbcom("INSERT INTO rateip (ip) VALUES ('$visitor_ip');");
# Increment Rate Count
dbcom('INSERT INTO downloads_ratings (id, rating) VALUES (' . $downloadArray['id'] . ', ' . $_GET['rating'] . ');');
dbcom('UPDATE downloads SET rating = (SELECT ROUND(AVG(rating), 0) FROM downloads_ratings WHERE id = ' . $downloadArray['id'] . ') WHERE id = ' . $downloadArray['id'] . ';');
echo '<tr><td align="center" valign="middle" height="100%" width="100%" class="report"><h2>Thank you</h2><p>Thanks for rating!<br /><br />
<a href="javascript:window.close()">Close Window</a></p></td></tr></table>' . "\n";
}
echo "\n</body>\n</html>";
}
else
{
$id = FALSE;
}
}
if(isset($id) && $id === FALSE)
{
header('Location: ' . $site_url);
}
$c->close();
?>