<?php
function do_thing()
{
// In the future grab the settings from admincp
$groups_to_check = array_map('intval', explode(',','2,5'));
// This will check if groups to check setting is valid
if(is_array($groups_to_check) && count($groups_to_check))
{
// Implode to use in SQL query
$groups_to_check = implode(',',$groups_to_check);
}
else
{
return false;
}
var_dump($groups_to_check);
$a_week_ago = time() - 604800;
$prefix = 'mybb';
// This will select users that registed more than a week ago, belong to groups to check, lastpost and timeonline are zero and don't have any additional groups
// Why this?
// regdate check gives users a grace time to their first login
// timeonline check the last time they were online (0 is never)
// lastpost check the time they last posted (I do this for sanity, 0 is never)
// usergroup check ensures that only registered and awaiting activation are checked (groups 2 and 5, should be made configurable in the future)
// additionalgroups check ensures my custom edited users don't get checked
@sql_query("SELECT * FROM `{prefix}users` WHERE ((regdate < {$a_week_ago}) AND lastpost = 0 AND timeonline = 0 AND usergroup IN ({$groups_to_check}) AND additionalgroups = '');");
}
do_thing();
string(3) "2,5"
Fatal error: Uncaught Error: Call to undefined function sql_query() in /in/tZeE9:30
Stack trace:
#0 /in/tZeE9(33): do_thing()
#1 {main}
thrown in /in/tZeE9 on line 30
Process exited with code 255.