Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/autosubmitter/index.php
<?php
	session_start();
	define('AUTOSUBMITTERDIR', dirname(__FILE__) . '/');
	define('WWWROOT', substr(AUTOSUBMITTERDIR, 0 , -14));
	define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
	require(BASEDIR . 'funcs.inc');
	require(BASEDIR . 'config.php');
	include(WWWROOT . 'killthreat.php');
	require(WWWROOT . 'skins/' . $skin . '/header.php');
	if($publicAutoSubmitter == 0)
	{
?>
<!-- BEGIN BODY -->
	<table border="0" width="90%">
		<tr>
			<td align="left">
				<h2><?php echo $site_name; ?> Autosubmitter</h2>
				<p>
				<span style="color: #ff0000">Sorry, this feature is disabled.</span>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><b>Go back</b></a>.
				</p>
			</td>
		</tr>
	</table>
<!-- END BODY -->
<?php
		require(WWWROOT . 'skins/' . $skin . '/footer.php');
		die();
	}
	require(AUTOSUBMITTERDIR . 'ban.php');
	# User and IP Logging 
	$dt = date('F j Y - G:i a');
	$ip = $_SERVER['REMOTE_ADDR'];
	$theURL = testURL($_POST['surl']);
	if(strlen($theURL) > 0 && strlen($theURL) <= 255)
	{
		# Insert submitter's IP address into IP Log table
		dbcom("INSERT INTO iplog VALUES (NULL, '$theURL', NOW(), '$ip', NULL);");
	}
	# Delete IPs older than 1 month
	dbcom("DELETE FROM iplog WHERE date < DATE_SUB(NOW(), INTERVAL 1 MONTH);");
	$c = new config();
	$c->open();
	set_time_limit(0);
	if(isset($_POST) && is_array($_POST) && count($_POST) > 0 && array_key_exists('submit_to_site', $_POST) === TRUE && ($_POST['submit_to_site'] == 'katz' || $_POST['submit_to_site'] == 'phaze'))
	{
		if($_POST['submit_to_site'] == 'katz')
		{
			$urls = array
			(
				'http://katz.cd/submit.php',
				'http://katzporn.com/submit.php'
			);
		}
		elseif($_POST['submit_to_site'] == 'phaze')
		{
			$urls = array
			(
				'http://phazeddl.com/submit.php',
				'http://phazeporn.com/submit.php',
				'http://phazemp3.com/submit.php'
			);
		}
		$submitToSite = $_POST['submit_to_site'];
	}
	else
	{
		$get = dbcom('SELECT url FROM urls WHERE url != "";');
		if(mysql_num_rows($get) > 0)
		{
			while($row = mysql_fetch_array($get))
			{
				$urls[] = $row['url'];
			}
		}
		$submitToSite = '';
	}
?>
<!-- BEGIN BODY -->
	<table border="0" width="90%">
		<tr>
			<td align="left">

				<h2><?php echo $site_name; ?> Autosubmitter</h2>
				<span style="font-weight:bold">Submit up to 10 files at once to <?php echo count($urls); ?> DDL sites!</span>
				<br />
				<br />
<?php
	function submit($url, $query)
	{
		global $errno, $errstr, $failedSubmitURLtries, $site_url, $site_name, $admin_email;
		$uri = parse_url($url);
		if(!isset($uri['port']))
		{
			$uri['port'] = 80;
		}
		$req = "POST {$uri['path']} HTTP/1.1\r\n"
			. "Host: {$uri['host']}\r\n"
			. "Content-type: application/x-www-form-urlencoded\r\n"
			. "User-Agent: Mozilla 4.0\r\n"
			. "Content-length: " . strlen($query) . "\r\n"
			. "Connection: close\r\n\r\n"
			. $query;
		$errno = 0;
		$errstr = '';
		if(!$fp = @fsockopen($uri['host'], $uri['port'], $errno, $errstr, 3))
		{
			return false;
		}
		fputs($fp, $req);
		$buff = fread($fp, 1024);
		$ret = strpos($buff, '200 OK') ? true : false;
		fclose($fp);
		return $ret;
	}
	if(isset($_POST) && is_array($_POST) && count($_POST) > 0)
	{
		if(strlen($_POST['title'][0]) == 0 || strlen($_POST['url'][0]) == 0 || strpos($_POST['url'][0], 'http://') === FALSE || strlen($_POST['sname']) == 0 || strlen($theURL) == 0)
		{
			echo '<p>You did not fill in all required fields! Please <a href="javascript:history.go(-1)"><b>go back</b></a> and try again.</p>';
		}
		else
		{
			if(get_magic_quotes_gpc() === 1)
			{
				$title = array_map('stripslashes', $_POST['title']);
				$url = array_map('stripslashes', $_POST['url']);
				$type = array_map('stripslashes', $_POST['atype']);
				$theURL = stripslashes($theURL);
				$sname = stripslashes($_POST['sname']);
				$email = stripslashes($_POST['email']);
			}
        	echo 'This autosubmitter will automatically re-try failed submissions.<p>Auto-submitting...</p>';
			$compile = "sname={$_POST['sname']}&surl=$theURL&email={$_POST['email']}";
			if(!empty($submitToSite))
			{
				if($submitToSite == 'katz')
				{
					$katzAll = '';
					$katzPorn = '';
				}
				elseif($submitToSite == 'phaze')
				{
					$phazeAll = '';
					$phazeMusic = '';
					$phazePorn = '';
				}
			}
			$i = $x = 0;
			foreach($_POST['title'] as $key => $val)
			{
				# Kill any security threats with $HTTP_POST_VARS manually because foreach($HTTP_POST_VARS as $key=>val) doesn't work
				foreach ($disallowedtags as $tag)
				{
					if(preg_match('/<[^>]*' . $tag . '/i', $title[$i]) !== 0)
					{
				    	die("Sorry, you can't do that. Your IP has been logged.");
					}
					if(preg_match('/<[^>]*' . $tag . '/i', $url[$i]) !== 0)
					{
				    	die("Sorry, you can't do that. Your IP has been logged.");
					}
					if(preg_match('/<[^>]*' . $tag . '/i', $type[$i]) !== 0)
					{
				    	die("Sorry, you can't do that. Your IP has been logged.");
					}
    			}
				# Kill spam
				if($c->spamcheck($title[$i]))
				{
			    	die("Sorry, you can't do that. Your IP has been logged.");
				}
				if($val && $_POST['url'][$key] && strpos($_POST['url'][$key], 'http://') !== FALSE && $_POST['atype'][$key])
				{
					$_POST['url'][$key] = str_replace('&', '%26', $_POST['url'][$key]);
					$i++;
					if(!empty($submitToSite))
					{
						if($submitToSite == 'katz')
						{
							if($_POST['atype'][$key] == 'Xxx')
							{
								if(empty($katzPorn))
								{
									$katzPorn = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$katzPorn .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
							}
							else
							{
								if(empty($katzAll))
								{
									$katzAll = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$katzAll .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
							}
						}
						elseif($submitToSite == 'phaze')
						{
							if($_POST['atype'][$key] == 'Xxx')
							{
								if(empty($phazePorn))
								{
									$phazePorn = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$phazePorn .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
							}
							elseif($_POST['atype'][$key] == 'Music')
							{
								if(empty($phazeMusic))
								{
									$phazeMusic = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$phazeMusic .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								if(empty($phazeAll))
								{
									$phazeAll = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$phazeAll .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
							}
							else
							{
								if(empty($phazeAll))
								{
									$phazeAll = $compile . "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
								else
								{
									$phazeAll .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
								}
							}
						}
					}
					else
					{
						$compile .= "&title[]=$val&url[]={$_POST['url'][$key]}&type[]={$_POST['atype'][$key]}";
					}
				}
			}
			$urlIDtest = FALSE;
			if(array_key_exists('submit_to', $_POST))
			{
				$urlIDtestArray = array_unique(array_map('ctype_digit', $_POST['submit_to']));
				sort($urlIDtestArray);
				if(is_array($urlIDtestArray) && $urlIDtestArray[0] == TRUE)
				{
					$urlIDtest = TRUE;
				}
				else
				{
					$urlIDtest = FALSE;
				}
			}
			if($urlIDtest === TRUE)
			{
				foreach($_POST['submit_to'] as $line)
				{
					if(!empty($submitToSite))
					{
						if($submitToSite == 'katz')
						{
							if($urls[$line] == 'http://katz.cd/submit.php' && !empty($katzAll))
							{
								$result = submit($urls[$line], $katzAll);
							}
							elseif($urls[$line] == 'http://katzporn.com/submit.php' && !empty($katzPorn))
							{
								$result = submit($urls[$line], $katzPorn);
							}
							else
							{
								$result = FALSE;
							}
						}
						elseif($submitToSite == 'phaze')
						{
							if($urls[$line] == 'http://phazeddl.com/submit.php' && !empty($phazeAll))
							{
								$result = submit($urls[$line], $phazeAll);
							}
							elseif($urls[$line] == 'http://phazeddl.com/submit.php' && !empty($phazeMusic))
							{
								$result = submit($urls[$line], $phazeMusic);
							}
							elseif($urls[$line] == 'http://phazemp3.com/submit.php' && !empty($phazeMusic))
							{
								$result = submit($urls[$line], $phazeMusic);
							}
							elseif($urls[$line] == 'http://phazeporn.com/submit.php' && !empty($phazePorn))
							{
								$result = submit($urls[$line], $phazePorn);
							}
							else
							{
								$result = FALSE;
							}
						}
						else
						{
							$result = FALSE;
						}
					}
					else
					{
						$result = submit($urls[$line], $compile);
					}
					if($result === TRUE)
					{
						echo "<span style=\"color:green\">Submitted to {$urls[$line]}</span><br /><br /><br />";
						$x++;
					}
					else
					{
						$err = $errno ? ' (failed to connect to server)' : " (server is up but couldn't submit)";
						echo "<span style=\"color:red\">Failed to submit to {$urls[$line]} ($err)</span><br /><br />";
						$n++;
						$newline[$n] = $line;
						$failedURLquery = dbcom("SELECT fails FROM urls WHERE url = '{$urls[$line]}' LIMIT 1;");
						$failedURLarray = mysql_fetch_assoc($failedURLquery);
						if($failedURLarray['fails'] + 1 > $failedSubmitURLtries)
						{
							dbcom("DELETE FROM urls WHERE url = '{$urls[$line]}';");
							$headers = "From: $admin_email <$admin_email>\n";
							$headers .= "X-Mailer: PHP3\n\n";
							$body = $site_name . ' Admin Panel has reported that the following URL has been deleted from your "Submit To" URLs list, as it has reached the "Failed Submit URL Delete Threshold" set in the "Autosubmitter" section in Admin (currently set to ' . $failedSubmitURLtries . ').' . "\n\n" . $urls[$line] . "\n\n" . 'You can add this URL again, or change the "Failed Submit URL Delete Threshold" by logging into your Admin Panel and clicking on "Autosubmitter".' . "\n\n" . 'Admin Login:' . "\n" . $site_url . '/admin/' . "\n\n" . 'Regards,' . "\n" . $site_name . ' Admin Panel';
							mail($admin_email, 'Submit URL Deletion Notification', $body, $headers);
						}
						else
						{
							dbcom("UPDATE urls SET fails = fails + 1 WHERE url = '{$urls[$line]}';");
						}
					}
					# Update the submitted date of the files submitted
					dbcom('UPDATE news SET submitted = NOW() WHERE id = ' . $line . ';');
				}
			}
			else
			{
				echo "You didn't select any sites to submit to. <a href=\"javascript:history.go(-1)\"><b>Go back</b></a> and select some URLs and try again.";
			}
			echo "<br />Submitted $i download";
        	if($i != 1)
			{
				echo 's'; 
			}
        	echo " to $x site"; 
			if($x != 1)
			{
				echo 's';
			}
			echo '.';
			if($n)
			{
				echo '<br /><br />Retrying failed sites... stand by...<br /><br />';
				foreach($newline as $line)
				{
					if(submit($urls[$line], $compile))
					{
						echo "<span style=\"color:green\">Submitted to {$urls[$line]}</span><br /><br /><br />";
						$x++;
					}
					else
					{
						$err = $errno ? ' (failed to connect to server)' : " (server is up but couldn't submit)";
						echo "<span style=\"color:red\">Failed to submit to {$urls[$line]} ($err)</span><br /><br />";
					}
				}
				echo "<br />All done - submitted $i download";
            	if($i <> 1)
				{
					echo 's';
				}
            	echo " to $x site";
				if ($x <> 1)
				{
					echo 's';
				}
				echo '!';
			}
			echo '<p>Notes: <ul>';
			echo '<li> <span style="color:red">Failed Submits</span>: Can be due to the server being down (could not connect to server) or, because your site is on their blacklist, or even because your site is not on their whitelist (if the site uses an all-whitelist submission system).<br /><br /></li>';
			echo '<li> A <span style="color:green">successful submit</span> does NOT necessarily mean your downloads were successfully submitted! For example, if the DDL site uses <a href="http://www.ddlcms.com" target="_blank" title="DDL CMS Warez site script"><b>DDL CMS</b></a>, it will only allow 20 submissions per site per day (per 18 hour period), and it will allow the same URL submitted again only after 5 days -- <i>the rest are silently discarded!!!</i><br /><br /></li> <li> So always follow the rules!</li>';
			echo '</ul></p>';
		}
	}
	else
	{
		# show form
		echo '	<p><b>General Rules</b><br /><br /></p>
	<ul>
	<li> <span style="font-weight:bold">' . count($urls) . ' URLs</span> in submit-to list! (<a href="urls.php" target="_blank" style="font-size:9px">URLs</a>)<br /><br /></li>
	<li> <span style="font-weight:bold">Automatically re-submits your files</span> to any failed URLs! <br /><br /></li>
	<li> <span style="font-weight:bold">Failed URL submits are logged</span> and deleted if "fail" threshold is reached (this ensures the submit-to list is always fresh!). <br /><br /></li>
	<li> <span style="font-weight:bold">Full category list!</span><br /><br /></li>
	<li> Be sure to link to the DDL sites (below) on your download page.<br /><br /></li>
	<li> DO NOT submit any dead links, or you may get banned!  Be sure to check your links before submitting!<br /><br /></li>
	<li> DO NOT abuse this Autosubmitter -- your IP will get banned!<br /><br /></li>
	<li> Follow the general submit rules for all sites! <a href="../submit.php" title="DDL Submit Rules" target="_blank">Example: check our rules</a>.<br /><br /></li>
	<li> <a href="http://www.ddlcms.com" title="DDL CMS" target="_blank"><b>Use DDL CMS</b></a> to have all DDL sites linked to your download page automatically. You can also create and submit pages at the click of a button!<br /><br /></li>
	</ul>
	<p>
	<b>Submit-To DDL URLs</b> (<a href="urls.php" target="_blank" style="font-size:9px">URLs</a>)</p><br /><br />
	<form name="add" action="index.php" method="post">';
	?>
		<script type="text/javascript">
		<!-- Begin
		var checkflag = "true";
	
		function check(field) {
			if (checkflag == "false") {
				for (i = 0; i < field.length; i++) {
					field[i].checked = true;
				}
				checkflag = "true";
				return "Uncheck All"; 
			} else {
				for (i = 0; i < field.length; i++) {
					field[i].checked = false; 
				}
				checkflag = "false";
				return "Check All"; 
			}
		}
		//  End -->
		</script>
		<div style="height:300px; overflow-x:hidden; overflow-y:auto">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
		<?php
				$urlcount = 0;
				foreach($urls as $id => $url)
				{
					if(!$url)
					{
						continue;
					}
					else
					{
						$urlcount++;
		    			echo "<td width=\"50%\"><input type=\"checkbox\" name=\"submit_to[]\" value=\"$id\" checked=\"checked\" id=\"list\" />$url</td>\n";
						if(is_int($urlcount / 2))
						{
							echo '</tr><tr>';
						}
					}
				}
				echo '<td></td>
				</tr>
			</table>
		</div>
		<br />
	
		<p><input type="button" value="Uncheck All" class="form" onclick="this.value=check(this.form.list)"></input></p>
		<p><b>Autosubmit Form</b><br /><br /></p>
	    <table border="0" cellspacing="1" cellpadding="0">
			<tr>
				<td colspan="4" align="right">Change All:</td>
				<td>
					<select class="form" style="margin: 0; font-size: 10px;" id="lstChangeAll">
						<option>Game</option>
						<option>App</option>
						<option>Movie</option>
						<option>Stream</option>
						<option>TV</option>
						<option>Music</option>
						<option>eBook</option>
						<option>Template</option>
						<option>Script</option>
						<option>Mac</option>
						<option>Mobile</option>
						<option>Xxx</option>
						<option>Other</option>
					</select>
				</td>
			</tr>';
			for($i = 1; $i < 11; $i++)
			{
				echo '
			<tr>
				<td  align="right">' . ($i==1?'*':'') . 'Name&nbsp;' . $i . ': </td>
				<td> <input type="text" name="title[]" size="30" maxlength="38"></input></td>
				<td  align="right">' . ($i==1?'*':'') . 'URL&nbsp;' . $i . ':</td>
				<td><input type="text" name="url[]" size="30"></input></td>
				<td>
					<select name="atype[]">
						<option>Game</option>
						<option>App</option>
						<option>Movie</option>
						<option>Stream</option>
						<option>TV</option>
						<option>Music</option>
						<option>eBook</option>
						<option>Template</option>
						<option>Script</option>
						<option>Mac</option>
						<option>Mobile</option>
						<option>Xxx</option>
						<option>Other</option>
					</select>
				</td>
			</tr>';
			}
			echo '
			<tr><td colspan="5" height="10"></td></tr>
			<tr>
				<td align="right">*Site Name: </td>
				<td><input type="text" name="sname"  size="30"></input></td>
				<td align="right">*Site Url: </td>
				<td><input type="text" name="surl"  size="30"></input></td>
			</tr>
			<tr>
				<td align="right">E-mail: </td>
				<td><input type="text" name="email"  size="30"></input></td>
			</tr>
			<tr>
				<td></td>
				<td colspan="4" class="form2">
					<br />
					<input type="submit" value="Submit Download" ></input>
						&nbsp;&nbsp; Click Only Once! Submission May Take A While.
				</td>
			</tr>
		</table>
	</form>';
	}
?>
				<br />
				<br />
				<br />
			</td>
		</tr>
	</table>
<!-- END BODY -->
<?php
   	require(WWWROOT . 'skins/' . $skin . '/footer.php');
	$c->close();
?>
Return current item: DDL CMS