Jump to content

Cron


eaglelegend

Recommended Posts

Hey, I am a little bit confused, I am needing cron for my site's scripts. now, my host dont support cron, but they reffered me to a cron provider that obviously works, but they say to point it at "some file", could someone explain to me please? how does it work and what filesa am I supposed to forward it to? much help is appreciated. thanks!

Link to comment
https://forums.phpfreaks.com/topic/109975-cron/
Share on other sites

Hi, I just tried it, it is no fault of the cron provider, but this is what I get when I access the file (I noticed it wasnt working)

 

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /misc/39/000/171/334/2/user/web/elv3.eaglelegend.com/admin/cron/clear_forums.php on line 3

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /misc/39/000/171/334/2/user/web/elv3.eaglelegend.com/admin/cron/clear_forums.php on line 3

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /misc/39/000/171/334/2/user/web/elv3.eaglelegend.com/admin/cron/clear_forums.php on line 4

 

Code below:

<?php



$findOld = mysql_query("SELECT id FROM forum_subjects2 WHERE last_post_at <= '$timestamp - 1209600'");

while ($getOld = mysql_fetch_array($findOld))

{

mysql_query("DELETE FROM forum_topics2 WHERE id = '$getOld[id]'");

$topics += mysql_affected_rows();

mysql_query("DELETE FROM forum_subjects2 WHERE id = '$getOld[id]'");

$subjects += mysql_affected_rows();

mysql_query("DELETE FROM forum_replies2 WHERE thread = '$getOld[id]'");

$replies += mysql_affected_rows();

}



$text = "$topics topics were deleted.<br>$subjects subjects were deleted.<br>$replies replies were deleted.<br>";



?>

 

 

Could it be a "security breach" that my host is trying to stop or something?? (host = bravenet)

Link to comment
https://forums.phpfreaks.com/topic/109975-cron/#findComment-564369
Share on other sites

There is no need to hide your page if you do it like this

<?php
$allowed[]="xxx.xx.xx.xx";		# authorized ip's 1 per line
# $allowed[]="xxx.xx.xx.xx";		# uncomment and/or add as many as you like

$raddr=$_SERVER["REMOTE_ADDR"];
if (in_array($raddr,$allowed))
{					# your code here



				# insert e-mail code if you need conformation
}
else {
$myself="http://your_main_index.page"; 			# redirect page for all others
header("Location: $myself");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/109975-cron/#findComment-564476
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.