Aureole Posted October 9, 2007 Share Posted October 9, 2007 I need to make a script that runs itself every Hour, how do I do this/is it possible? EDIT: I read about Cron Jobs/Tabs on Google.com and I see them in my CPanel but I don't know how to work it... well it says Command to run: What do I put there? An absolute url: http://www.site.com/script.php ? Quote Link to comment Share on other sites More sharing options...
haaglin Posted October 9, 2007 Share Posted October 9, 2007 i dont know how to set up a cron job, but the command would be (If on a unix server): wget -q -O /dev/null http://www.site.com/script.php Quote Link to comment Share on other sites More sharing options...
Aureole Posted October 9, 2007 Author Share Posted October 9, 2007 Nevermind I've got it working I think, now the question is would this work for a cron job/tab: <?php include('functions.swr3'); dbConnect(); $c_timestamp = date(); $query = "SELECT * FROM members WHERE mem_online='1'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result) { $mem_id = $row['mem_id']; $mem_last_action = $row['mem_last_action']; $inactivity = $c_timestamp - $mem_last_action; if($inactivity > 3600) { $query = "UPDATE members SET mem_online='0' WHERE mem_id='{$mem_id}'"; $result = mysql_query($query); } } ?> It needs to go through all online members and if their timestamp is more than an Hour old then sign them out automagically. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.