Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

I am having some cron error problem


  • Please log in to reply
2 replies to this topic

#1 midnightrose2008

midnightrose2008

    CC Newcomer

  • Just Joined
  • PipPip
  • 16 posts

Posted 07 January 2009 - 12:31 PM

I have an script that was an folder in it. Everything seems to work in the script but they are errors in the cron php files. I followed every instruction that the install read me file to no prevail even run the cron file to run ever hour. Here's the errors i get.

"/usr/bin/php
Warning: exec() has been disabled for security reasons in /home/wildprox/public_html/search4rapid/cron/checker.php on line 12
can't clean run-c.flag"

checker.php script:
#!/usr/bin/php
<?php
chdir("/hsphere/local/home/goldenbiz2003/download-123.com/ezfilesearch/cron/");
set_time_limit(1000);
ignore_user_abort(true);
include "./../functions.php";
include "./../config.php";


if(file_exists("run-c.flag"))
{
exec("rm run-c.flag");
sleep(1);
if(file_exists("run-c.flag")) exit("can't clean run-c.flag");
sleep(60);
}
exec("rm log-c.txt");
logstr("log-c.txt","[start]".date("Y-m-d H:i:s")."[/start] \n");
touch("run-c.flag");

print "<pre>\n";

//mysql_query("UPDATE `v2links` SET checked=0");
$query=mysql_query("SELECT `id`,`url`,`type` FROM `v2links` WHERE `checked`>=0 ORDER BY `lastcheck`,RAND() LIMIT 10000");
print mysql_error();
$counter=0;
while($row=mysql_fetch_row($query))
{
if(!trim($row[1])) continue;
// delay if type the same
if($prevtype==$row[2]) sleep(mt_rand(1,2));
$prevtype=$row[2];

print "[".$counter++."] ".$row[1]."\n";
logstr("log-c.txt","[$counter] ".$row[1]."\n");
if($row[2]==1) // rapidshare check
{
$index=getpage($row[1]);
if(strpos($index,"<p><script>alert(\"File not found.\")</script>File not found.</p>")===false && strpos($index,"This file has been deleted.")===false)
{
preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match);
//print $index;
if($match[1])
{
$fpath=$match[1];
$index=getpage($fpath,"dl.start=Free",$row[1]);
preg_match("/<\/font> \(([^\(]+)\)\.<\/p>/",$index,$match);
$fsize=0;
if($match[1]) $fsize=mysql_real_escape_string(strip_tags($match[1]));
print $fsize."\n";
logstr("log-c.txt",$fsize."\n");
mysql_query("UPDATE `v2links` SET `checked`='1',`fsize`='$fsize',`lastcheck`=NOW() WHERE `id`=".$row[0]);
if(mysql_errno()) print mysql_error()."\n";
}
else
{
print "bad link\n";
logstr("log-c.txt","bad link\n");
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
if(mysql_errno()) print mysql_error()."\n";
}
}
else
{
print "bad link\n";
logstr("log-c.txt","bad link\n");
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
if(mysql_errno()) print mysql_error()."\n";
}
}
if($row[2]==2) // badongo check
{
$row[1]="http://www.".$row[1];
//print "<a href=\"".$row[1]."\">".$row[1]."</a>\n";
//print_r($row);
$index=getpage($row[1]);
preg_match_all("/<td> ([^<]+)<\/td>/",$index,$match);
if(strpos($index,"This file has been deleted because it has been inactive for over 30 days")!==false ||
strpos($index,"This file has been removed due to copyright infrigment")!==false ||
strpos($index,"File deactivated!")!==false || !$match[1])
{
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
print "bad link\n";
logstr("log-c.txt","bad link\n");
}
else
{
//print_r($match[1]);
if(strlen($match[1][0])>strlen($match[1][3]))
{
$words=trim($match[1][0]);
$words=preg_split("/[_\.\-\s]/",$words);
$lastword=array_pop($words);
if($lastword=="html") array_pop($words);
$words=implode(" ",$words);
$words=preg_replace("/\s{2,}/"," ",$words);
$caption=mysql_real_escape_string($words);
unset($words);
}
else
{
$words=$match[1][3];
$words=preg_split("/[_\.\-\s]/",$words);
$words=implode(" ",$words);
$words=preg_replace("/\s{2,}/"," ",$words);
$caption=mysql_real_escape_string($words);
unset($words);
}
print "$caption :: ".$match[1][1]."\n";
logstr("log-c.txt","$caption :: ".$match[1][1]."\n");
mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='".$match[1][1]."',`caption`='$caption' WHERE `id`=".$row[0]);
unset($match);
if(mysql_errno()) print mysql_error()."\n";
}
}
if($row[2]==3) // mediafire check
{
$row[1]="http://www.".$row[1];
$index=getpage($row[1]);
//print "<a href=\"".$row[1]."\">".$row[1]."</a>\n";
preg_match("/You requested ([^\(]+)\(([^\)]+)\)<\/span>/",$index,$match);
if(strpos($index,"This file has been virus scanned for your protection")===false || !$match[1])
{
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
print "bad link\n";
logstr("log-c.txt","bad link\n");
}
else
{
$words=trim($match[1]);
$words=preg_split("/[_\.\-\s]/",$words);
$lastword=array_pop($words);
$words=implode(" ",$words);
$words=preg_replace("/\s{2,}/"," ",$words);
$caption=mysql_real_escape_string($words);
unset($words);
print "$caption :: ".$match[2]."\n";
logstr("log-c.txt","$caption :: ".$match[2]."\n");
mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='".$match[2]."',`caption`='$caption' WHERE `id`=".$row[0]);
unset($match);
if(mysql_errno()) print mysql_error()."\n";
}
}
if($row[2]==4) // sendspace check
{
$row[1]="http://www.".$row[1];
//print "<a href=\"".$row[1]."\">".$row[1]."</a>\n";

$index=getpage($row[1]);
preg_match_all("/<b>(\w+)\:<\/b>([^<]+)<br>/",$index,$match);
$desc=array();
for($i=0;$i<3;$i++) if(isset($match[1][$i])) $desc[$match[1][$i]]=trim($match[2][$i]);
unset($match);
if(strpos($index,"The download link is located below")===false || !$desc)
{
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
print "bad link\n";
logstr("log-c.txt","bad link\n");
}
else
{
$words=trim($desc['Name']);
$words=preg_split("/[_\.\-\s]/",$words);
$lastword=array_pop($words);
$words=implode(" ",$words);
$words=preg_replace("/\s{2,}/"," ",$words);
$caption=mysql_real_escape_string($words);
unset($words);
print "$caption :: ".$desc['Size']."\n";
logstr("log-c.txt","$caption :: ".$desc['Size']."\n");
mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='".$desc['Size']."',`caption`='$caption' WHERE `id`=".$row[0]);
unset($desc);
if(mysql_errno()) print mysql_error()."\n";
}
}
if($row[2]==5) // 4shared check
{
$row[1]="http://www.".$row[1];
$index=getpage($row[1]);
preg_match("/Download ([^<]+)<\/div>/",$index,$match);
if(strpos($index,"The file is shared for public access and download.")===false || !$match)
{
mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
print "bad link\n";
logstr("log-c.txt","bad link\n");
}
else
{
$words=trim($match[1]);
$words=preg_split("/[_\.\-\s]/",$words);
$lastword=array_pop($words);
$words=implode(" ",$words);
$words=preg_replace("/\s{2,}/"," ",$words);
$caption=mysql_real_escape_string($words);
unset($words);
unset($match);
preg_match("/<td>Size\:<\/td><td>([^<]+)<\/td>/",$index,$match);
$fsize=$match[1];
unset($match);
print "$caption :: $fsize\n";
logstr("log-c.txt","$caption :: $fsize\n");
mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]);
if(mysql_errno()) print mysql_error()."\n";
}
}
if(!file_exists("run-c.flag")) exit("run-c.flag was deleted\n");
}
print "</pre>\n";
exec("rm run-c.flag");
logstr("log-c.txt","[end]".date("Y-m-d H:i:s")."[/end] \n");
?>

________________________________________________
#!/usr/bin/php
Warning: exec() has been disabled for security reasons in /home/wildprox/public_html/search4rapid/cron/parser.php on line 8
can't clean run-p.flag

parser.php
#!/usr/bin/php
<?php
include "./../functions.php";
include "./../config.php";
chdir("/hsphere/local/home/goldenbiz2003/download-123.com/ezfilesearch/cron");
if(file_exists("run-p.flag"))
{
exec("rm run-p.flag");
sleep(1);
if(file_exists("run-p.flag")) exit("can't clean run-p.flag");
sleep(60);
}
exec("rm log-p.txt");
touch("run-p.flag");
if(mt_rand(1,300)==27)
{
include "./tagcloud.php";
exec("rm run-p.flag");
logstr("log-p.txt","[end]".date("Y-m-d H:i:s")."[/end] \n");
exit();
}


set_time_limit(1000);
ignore_user_abort(true);
logstr("log-p.txt","[start]".date("Y-m-d H:i:s")."[/start] \n");
print "<pre>\n";

$query=mysql_query("SELECT `id`,`keyword` FROM `v2keywords` ORDER BY `lastcheck`,RAND() LIMIT 4");
while($row=mysql_fetch_row($query))
{
get_urls_by_kwd("\"rapidshare.com/files\" ".$row[1],"/rapidshare\.com\/files\/(\d+)\/([^\'^\"^\s^>^<^\\^\/]+)/",1);
get_urls_by_kwd("\"badongo.com/file\" ".$row[1],"/badongo\.com\/file\/(\d+)/",2);
get_urls_by_kwd("\"mediafire.com/?\" ".$row[1],"/mediafire\.com\/\?(\w+)/",3);
get_urls_by_kwd("\"sendspace.com/file\" ".$row[1],"/sendspace\.com\/file\/(\w+)/",4);
get_urls_by_kwd("\"4shared.com/file\" ".$row[1],"/4shared\.com\/file\/(\d+)\/(\w+)\/([^\'^\"^\s^>^<^\\^\/]+)/",5);

mysql_query("UPDATE `v2keywords` SET `lastcheck`=NOW() WHERE `id`='".$row[0]."'");
if(mysql_errno()) print mysql_error()."\n";
}
print "</pre>";
exec("rm run-p.flag");
logstr("log-p.txt","[end]".date("Y-m-d H:i:s")."[/end] \n");
?>


________________________________________________
Can you guys please tell me how to repair these errors I done everything I know to do any help appreciated. Do i change the script somehow or do i put an special debug in the php.ini file thanks
midnightrose2008
  • 0

#2 Guest_Jaan_*

Guest_Jaan_*
  • Guest

Posted 07 January 2009 - 12:52 PM

Your host doesn't allow exec() function. Just contact your hosting provider and tell to them about your problem.. I believe they can help you more than we can :)
  • 0

#3 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 07 January 2009 - 01:57 PM

I believe that unlink might work instead of a system call to rm
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download