eaglelegend Posted June 12, 2008 Share Posted June 12, 2008 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 More sharing options...
jonsjava Posted June 12, 2008 Share Posted June 12, 2008 the cron will "hit" a page on your site at the times specified. Obfuscate the filename as much as possible, then give it the link The page will run a set of scripts that you put in it when it gets viewed (or "hit"). Link to comment https://forums.phpfreaks.com/topic/109975-cron/#findComment-564326 Share on other sites More sharing options...
eaglelegend Posted June 12, 2008 Author Share Posted June 12, 2008 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 More sharing options...
DarkWater Posted June 12, 2008 Share Posted June 12, 2008 I tihnk the server isn't started. O_O Link to comment https://forums.phpfreaks.com/topic/109975-cron/#findComment-564384 Share on other sites More sharing options...
Cory94bailly Posted June 13, 2008 Share Posted June 13, 2008 Do you even connect to the mysql server..? Link to comment https://forums.phpfreaks.com/topic/109975-cron/#findComment-564420 Share on other sites More sharing options...
mushroom Posted June 13, 2008 Share Posted June 13, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.