Jump to content

Recommended Posts

Hi, you've all just seen my login script, but how do i set a cron in cPanel so that it checks every 10 minutes for an inactive user and resets their active bool? It updates the last active time each time a page loads with this:

 

$id = $_SESSION['userID'];

$lin = "UPDATE users SET llin = NOW() WHERE ID = '$id' ";
mysql_query($lin) or die('Error, query failed now');

 

I have a bool field called active where 0 would be inactive. How would I do this?

Link to comment
https://forums.phpfreaks.com/topic/86898-solved-how-to-do-a-cron/
Share on other sites

<?php
include 'dbs.php';
include 'bar.php';
$cnow = date("H:i:s") - date("H:10:s");
$lin = "UPDATE users SET active = '0' WHERE llin > NOW($cnow)";
mysql_query($lin) or die('Error, query failed now');
?>

 

Doesn't show any errors, but it doesn't work either.

i get:

 

/home2/tlscom/public_html/check.php: line 1: ?php: No such file or directory

/home2/tlscom/public_html/check.php: line 2: include: command not found

/home2/tlscom/public_html/check.php: line 3: include: command not found

/home2/tlscom/public_html/check.php: line 4: syntax error near unexpected token `('

/home2/tlscom/public_html/check.php: line 4: `// $cnow = date("H:i:s") - date("H:10:s");'

 

Thats from the output (from teh email)

Erm well you should only need read and execute permissions for the owner if your server's setup properly. If it's not then you might need to add execute permissions for group and/or others too. That's something only your hosts can dictate though.

 

r-xr--r-- = 544

r-xr-xr-x = 555

rwxr--r-- = 744 (probably what it should be ideally as presumably you still want to be able to write to it)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.