PDA

View Full Version : Deleting guests


RichieBoy67
02-21-2020, 01:15 AM
Hey there,

Can anyone help me add guests to this? Basically I want to delete guests from my session table via cron. I just need to add guests to this line.


$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE (useragent like '%bot%')");


Thanks so much

RichieBoy67
02-24-2020, 02:09 PM
Bump please.

shka
02-24-2020, 02:59 PM
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE `userid` = 0;");


A registered but not logged in user will also be kicked. So its better to add lastactivity if someone is in login process.


$vbulletin->db->query_write("
DELETE FROM " . TABLE_PREFIX . "session
WHERE (`userid` = 0)
AND (`lastactivity` < UNIX_TIMESTAMP() - 3600);
");


Replace 3600 with your intervall in seconds

RichieBoy67
02-24-2020, 04:02 PM
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE `userid` = 0;");


A registered but not logged in user will also be kicked. So its better to add lastactivity if someone is in login process.


$vbulletin->db->query_write("
DELETE FROM " . TABLE_PREFIX . "session
WHERE (`userid` = 0)
AND (`lastactivity` < UNIX_TIMESTAMP() - 3600);
");


Replace 3600 with your intervall in seconds
That is perfect. Thank you so much