问题描述
<?PHP
//redirect clients to invoice page if they are overdue. nothing else.
//provided by https://www.whmcs.guru
use Illuminate\Database\Capsule\Manager as Capsule;
function check_client_access($vars)
{
//what time is it?
$time = time();
//are we logged in? If not,then return
$uid = $_SESSION['uid'];
if (empty($uid))
{
return;
}
$filename = $vars['filename'];
$displayTitle = $vars['displayTitle'];
//do we have any unpaid invoices?
$rows = Capsule::table('tblinvoices')->select('id') ->WHERE ('userid','<=',$uid) ->where('status','=','Unpaid') ->count();
if (empty($rows))
{
//we have no unpaid invoices. Do not proceed any further
return;
}
if (!empty($rows))
{
//we have unpaid invoices. Are they overdue?
foreach (Capsule::table('tblinvoices')->select('duedate') ->WHERE ('userid','Unpaid')->get() as $unpaidinvoice) {
$invdue = $unpaidinvoice->duedate;
if (strtotime($invdue) < $time) {
//all those checks,we're finally where we need to be
header('Location: clientarea.PHP?action=invoices');
exit();
}
}
}
}
add_hook('ClientAreaPage',1,"check_client_access");
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)