Status
Not open for further replies.

Chris2k

Banned
Banned
901
2009
17
0
here's the code:
PHP:
$subBacklink = 'href="http://warezrelease.org/"';

		function subBacklink($arr) {
			global $subBacklink;
			if(!$arr['status'])
				return $arr;
				$surl = $arr['site']['surl'];
				$get = @file_get_contents('http://'.$surl.'/');
				if(preg_match('#href=\"http://(www\.)?'.$subBacklink.'#i',$get))
					return $arr;
					else
					$arr['status'] = false;
					return $arr;
		}

any1 can tell me whats wrong, its forgetting:
PHP:
		if (subBacklink ($arr) == false) {
            mysql_query("INSERT INTO wcddl_blacklist (url,reason,dat,email) VALUES ('".mysql_real_escape_string($surl)."','".mysql_real_escape_string($reason1)."','".mysql_real_escape_string($date)."','".mysql_real_escape_string($email)."')");
            blacklistemail($email,$surl);
			mysql_query("DELETE FROM wcddl_blacklist WHERE url=''");
        }
 
13 comments
PHP:
$subBacklink = 'href="http://warezrelease.org/"';

should be:
PHP:
$subBacklink = 'href="warezrelease.org"';

as the preg_match adds the http , www
 
Edited:
try this
PHP:
$subBacklink = 'href="warezrelease.org"';

        function subBacklink($arr) {
            global $subBacklink;
            if(!$arr['status'])
                return $arr;
                $surl = $arr['site']['surl'];
                $get = @file_get_contents('http://'.$surl.'/');
                if(preg_match('#href=\"http://(www\.)?'.$subBacklink.'#i',$get))
                    //Move the code which accepts the submission here...
                    else
                    //put the code that blacklists the site here
                    return $arr;
        }
or try this:

PHP:
$subBacklink = 'href="warezrelease.org"';

        function subBacklink($arr) {
            global $subBacklink;
            if(!$arr['status'])
                return $arr;
                $surl = $arr['site']['surl'];
                $get = @file_get_contents('http://'.$surl.'/');
                if(preg_match('#href=\"http://(www\.)?'.$subBacklink.'#i',$get))
                    $BackCheck = true;
                    else
                    $BackCheck = false;
                return $arr;
        }
check in the submit.php

PHP:
if ($BackCheck == true)
//code that accepts the downloads

else
//code that blacklists the site
 
The first glitch that i noticed is in the regex

PHP:
$subBacklink = 'href="http://warezrelease.org/"'; 
preg_match('#href=\"http://(www\.)?'.$subBacklink.'#i',$get);
// above preg_match so equals:
preg_match('#href=\"http://(www\.)?href="http://warezrelease.org/"#i',$get);
Fix:
PHP:
$subBacklink = 'warezrelease\.org';
Your regex is already searching for href, http, www so no need to include that.
 
hmm, gave it another look. I'm not sure how arrays are evaluated against boolean in PHP. (thats what is happening in the if statement after the function). In Python, empty lists as treated as False. Nevertheless, shouldn't it be

PHP:
if(!subBacklink($arr)['status'])
 
Status
Not open for further replies.
Back
Top