Today i did an new module to request whitelist for wcddl.
Cuz are a lack of good coders in warezcoders i hope find here some advise.
im not an very good coder so before release this are always better some help
V1.2
Credits:
JMZ and warezcoders team by create the WCDDL
http://www.wjunction.com/member.php?u=2851 Hx by provide there site Warezscene.net to develop
to humour who start this code on other topic
http://www.wjunction.com/member.php?u=5806
And to all members who give suggestions to improve, thanks.
the code
And Some images
Cuz are a lack of good coders in warezcoders i hope find here some advise.
im not an very good coder so before release this are always better some help
V1.2
Credits:
JMZ and warezcoders team by create the WCDDL
http://www.wjunction.com/member.php?u=2851 Hx by provide there site Warezscene.net to develop
to humour who start this code on other topic
http://www.wjunction.com/member.php?u=5806
And to all members who give suggestions to improve, thanks.
the code
PHP:
<?php
/*BEGIN_INFO
Request to be in whitelist!<br>
by jomasaco.
END_INFO*/
/* mysql_query("CREATE TABLE wcddl_wait (
`cemail` VARCHAR( 255 ) NOT NULL ,
`surl` VARCHAR( 255 ) NOT NULL ,
`email` VARCHAR( 255 ) NOT NULL ,
`title1` VARCHAR( 255 ) NOT NULL ,
`title2` VARCHAR( 255 ) NOT NULL ,
`title3` VARCHAR( 255 ) NOT NULL ,
`url1` VARCHAR( 255 ) NOT NULL ,
`url2` VARCHAR( 255 ) NOT NULL ,
`url3` VARCHAR( 255 ) NOT NULL ,
`type1` VARCHAR( 10 ) NOT NULL ,
`type2` VARCHAR( 10 ) NOT NULL ,
`type3` VARCHAR( 10 ) NOT NULL
)");
*/
if(!defined("WCDDL_GUTS"))
exit;
$modEnabled = true; //Change to false if don't use
if($modEnabled) {
$ururl = "katzddl.in";
function linkback($link, $ururl)
{
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.7.62 Version/11.01');
$page = curl_exec($ch);
curl_close($ch);
if (stripos($page,$ururl)===false) {
return false;
}
else
{
return true;
}
}
function sendemail($surl, $cemail, $edited) {
global $core;
$from = $core->adminemail;
$from_name = $core->sitename;
// subject
// message
if(!empty($edited)) {
$message = $edited;
$subject = $surl.' Rejected';
}
else
{
$subject = $surl.' Whitelisted';
$message = 'Hi, your site http://'.$surl.' are whitelisted
from now on the pages of your site will be accepted.
Submit page
'.$core->siteurl.'submit.php
Can also check your downloads here
'.$core->siteurl.'site/'.$surl.'
Thanks.';
}
// Mail it
$headers = 'From: '.$from.'' . "\r\n" .
'Reply-To: '.$from.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$mail_sent = @mail($cemail, $subject, $message, $headers);
echo $mail_sent ? '<br />Mail sent '.$cemail.'' : 'Mail failed '.$cemail;
}
if(isset($_POST['siteurl']) && !empty($_POST['siteurl']))
{
//jomasaco's code
$siteurl = $_POST['siteurl']; //need be in http
$cmail = $_POST['cemail'];
$email = $_POST['email'];
$titles = $_POST['title'];
$urls = $_POST['url'];
$types = $_POST['type'];
for($i=0;$i<=count($titles)-1;$i++) {
if(empty($titles[$i]) || empty($urls[$i]) || empty($types[$i]) && (!in_array(strtolower($types[$i]),$core->allowed_types) || !in_array($types[$i],$core->allowed_types))) {
$htmlsaida = '<br />Must Provide the samples '.($i + 1);
}
}
$surl = $siteurl;
if(!filter_var($cmail, FILTER_VALIDATE_EMAIL)) {
$htmlsaida .= '<br />Error: Contact email isn\'t valid. '.$cmail;
}
if(!filter_var($surl, FILTER_VALIDATE_URL)) {
$htmlsaida .= '<br />Error: Site Url isn\'t valid. '.$surl;
}
$surl = $core->purl(str_ireplace("www.","",$surl),"host"); //remove spaces split the url
$ipAddress = gethostbyname($surl);
if($ipAddress === $surl) {
$htmlsaida .= '<br />Error: Invalid Domain. '.$siteurl;
}
//jomasaco's code
if(empty($htmlsaida))
{
$x = mysql_query("select url from wcddl_whitelist where url = '".mysql_real_escape_string($surl)."' UNION
select url from wcddl_blacklist where url = '".mysql_real_escape_string($surl)."' UNION
select surl from wcddl_wait where surl = '".mysql_real_escape_string($surl)."'") or die('Can\'t Check this site: '.mysql_error());
$x = mysql_num_rows($x);
if ($x != 0)
{
$htmlsaida .= 'SORRY.<br/>'.$siteurl.'<br />Applied for/or in Whitelist or in Blacklist.
<br /> Contact the Admin.';
}
elseif($x < 1)
{
//curl_part to retrieve content from the said sitename & chk for link back
if(linkback($siteurl,$ururl)==true)
{
$add = mysql_query("INSERT INTO wcddl_wait (cemail, surl, email, title1, title2, title3, url1, url2, url3, type1, type2, type3)
VALUES ('".mysql_real_escape_string($cmail)."','".mysql_real_escape_string($surl)."','".mysql_real_escape_string($email)."',
'".mysql_real_escape_string($titles[0])."','".mysql_real_escape_string($titles[1])."','".mysql_real_escape_string($titles[2])."'
,'".mysql_real_escape_string($urls[0])."','".mysql_real_escape_string($urls[1])."','".mysql_real_escape_string($urls[2])."'
,'".mysql_real_escape_string($types[0])."','".mysql_real_escape_string($types[1])."','".mysql_real_escape_string($types[2])."')");
$htmlsaida .= "Thanks, your site will be review soon and added to whitelist.";
if (!$add) {
$htmlsaida .= 'An error ocures when add the site<br />Contact the admin send this info:<br /> ' . mysql_error();
}
}
else
{
$htmlsaida .= 'No Link Back';
}
}
}
} //end if isset
else //Show the form
{
$htmlsaida .= '
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<table width="100%" border="0">
<tr><td COLSPAN=3>Contact Email:(<small>Must be an valid email</small>) <input type="text" name="cemail" /></td></tr>
<tr><th COLSPAN=3>Provide some Sample of Downloads</th></tr>
<tr><td><small>Title</small></td><td><small>URL</small></td><td><small>Type</small></td></tr>';
for($i=1;$i<=3;$i++) {
$htmlsaida .= '<tr><td><small>Sample '.$i.'</small> <input type="text" name="title[]" /></td><td><input type="text" name="url[]" /></td><td><select name="type[]">';
foreach($core->allowed_types as $at) {
$htmlsaida .= '<option value="'.$at.'">'.$at.'</option>';
}
$htmlsaida .= '</select></td></tr>';
}
$htmlsaida .= ' <tr><td><small>Site Name</small></td><td><small>Email</small></td><td><small>Site URL</small></td></tr>
<tr><td><input type="text" name="sname" /></td><td><input type="text" name="email" /></td><td><input type="text" name="siteurl" /></td></tr>
<tr><td colspan="3" align="center"><input class="button" type="submit" name="submit"/></td></tr>
</table>
</form>';
$getlastsites = mysql_query("SELECT surl from wcddl_wait");
$a = mysql_num_rows($getlastsites);
if($a != 0) {
$htmlsaida .= '<br /> Sites waiting to be Checked/Add
<br />';
while($getlast = mysql_fetch_assoc($getlastsites)) {
$htmlsaida .= 'http://'.$getlast['surl'];
}
}
mysql_free_result($getlastsites);
}//end show form
/* entire credits to humour
http://www.wjunction.com/member.php?u=5806 */
$core->setTemplateVar("requestwhitelist", $htmlsaida);
//ADMIN AREA
$add = array('waitsites' => "Sites Waiting",);
$core->admin_links = array_merge($core->admin_links, $add);
function waitsites() {
global $core,$surl,$email;
$defaultext = 'Type your email message here.';
$getlastsites = mysql_query("SELECT * from wcddl_wait limit 0,1");
$a = mysql_num_rows($getlastsites);
if($a != 0) {
$htmlsaida = '<br /> Sites waiting to be Checked/Add<br />
<form action="" method="post"><table width="100%" border="1">';
while($getlast = mysql_fetch_assoc($getlastsites)) {
//check for HTML Hack
foreach($getlast as $key => $check) {
if($check != strip_tags($check) || $check != stripslashes($check)) {
$check = strip_tags($check);
$check = stripslashes($check);
$hack .= '<br /><font color="#ff0000">CHECK THIS OUT FOUND HACK </font> '.$key;
}
if(preg_match('/[&?]sid=[^&]{32}+/',$check) || preg_match('/\bs=[0-9a-z]{32}&\b/i' , $check)) {
$hack .= '<br /><font color="#ff8000">Found an Session on url</font>. '.$key;
}
}
//END check Hack
$htmlsaida .= $hack.'
<tr><td colspan=3>Site Url: <a href="http://'.$getlast['surl'].'" target="_blank">http://'.$getlast['surl'].'</a> <input type="checkbox" name="surl" value="'.$getlast['surl'].'" /></td></tr>
<tr><td colspan=3>Contact email:<input type="hidden" name="email" value="'.$getlast['cemail'].'"/> '.$getlast['cemail'].'</td></tr>
<tr><th colspan="3" align="center">Samples</th></tr>
<tr><th>Titles</th><th>Urls</th><th>Type</th></tr>
<tr><td>'.$getlast['title1'].'</td><td><a href="'.$getlast['url1'].'" target="_blank">'.$getlast['url1'].'</a></td><td>'.$getlast['type1'].'</td></tr>
<tr><td>'.$getlast['title2'].'</td><td><a href="'.$getlast['url2'].'" target="_blank">'.$getlast['url2'].'</a></td><td>'.$getlast['type2'].'</td></tr>
<tr><td>'.$getlast['title3'].'</td><td><a href="'.$getlast['url3'].'" target="_blank">'.$getlast['url3'].'</a></td><td>'.$getlast['type3'].'</td></tr>
<tr></tr>
';
}
$htmlsaida .= '<tr><td colspan="3" align="center"><textarea rows="10" cols="50" name="edited">'.$defaultext.'</textarea></td></tr>
<tr><td colspan="3" align="center">';
if(!$hack)$htmlsaida .= '<input class="button" type="submit" name="Accept" value="Accept '.$getlast['surl'].'"/>';
$htmlsaida .= '<input class="button" type="submit" name="Reject" value="Reject '.$getlast['surl'].'"/></td></tr>
</table>
</form>';
unset($hack);
}
else
{
$htmlsaida = 'NO SITES TO MANAGE';
}
$accept = $_POST['Accept'];
$reject = $_POST['Reject'];
$surl = $_POST['surl'];
$email= $_POST['email'];
$edited = $_POST['edited'];
if(isset($accept) && !empty($surl))
{
$add = mysql_query("INSERT INTO wcddl_whitelist (url,email,dat) VALUES ('".mysql_real_escape_string($surl)."','".mysql_real_escape_string($email)."','".time()."')");
if($add) {
$removed = mysql_query("DELETE from wcddl_wait where surl= '".mysql_real_escape_string($surl)."'");
if($removed)
{
sendemail($surl,$email,$edited="");
$htmlsaida = '<br />'.$surl.' Removed';
}
else
{
$htmlsaida = 'Don\'t now whay but fail to remove the '.$surl;
}
$htmlsaida .= '<br/>'.$surl.' Added to whitelist';
}
else
{
$htmlsaida = 'Don\'t now whay but fail when add the '.$surl;
}
} //end accept
if(isset($reject) && !empty($surl)) {
$remove = mysql_query("DELETE from wcddl_wait where surl= '".mysql_real_escape_string($surl)."'");
if(!$remove) {
$htmlsaida = '<b>Don\'t now whay but fail to remove the</b> '.$surl;
}
else
{
$htmlsaida = '<br />'.$surl.' Removed from wait list.<br />';
if(!empty($edited) && ($edited != $defaultext)) {
sendemail($surl,$email,$edited);
}
}
} //End Reject
elseif(isset($reject) || isset($accept) && empty($surl))
{
$htmlsaida = 'For security reasons must check the box after the Site Url';
}
echo $htmlsaida;
}
if($_GET['go']=='waitsites') $core->attachHook("adminFunctions","waitsites");
//END ADMIN AREA
}// end module enable
?>
Last edited: