mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/ARCHIVED-IZYIM.git
synced 2026-08-19 12:24:06 +00:00
54 lines
1.7 KiB
PHP
Executable File
54 lines
1.7 KiB
PHP
Executable File
<?php
|
|
global $app;
|
|
global $hooks;
|
|
global $checkLicense;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
function newuser_title(){
|
|
echo "Terms & Conditions";
|
|
}
|
|
function newuser_js(){?>
|
|
<script type="text/javascript" src="/assets/js/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>
|
|
<script type="text/javascript" src="/assets/js/jquery.validate.min.js"></script>
|
|
<script src="/assets/js/newuser.js"></script>
|
|
<?php }
|
|
function has_pin(){
|
|
global $db;
|
|
$db->bind("username",$_SESSION["username"]);
|
|
$users = $db->query("SELECT * FROM users WHERE username= :username");
|
|
if($_SESSION['role'] == 0 || isset($_SESSION["godmode"]["status"])){
|
|
return true;
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
if(is_login() &&!has_pin() && $_SERVER["REQUEST_URI"]!='/newuser' && $_SERVER["REQUEST_URI"]!='/newuser/update'){
|
|
header('Location: /newuser');
|
|
}
|
|
$app->post('/newuser/update', function (Request $request) {
|
|
global $db;
|
|
$agree = $request->get('agree');
|
|
// Bind the data
|
|
$db->bind("user_id",$_SESSION["user_id"]);
|
|
$pinupdate = $db->query("UPDATE users SET agree = 1 WHERE user_id = :user_id");
|
|
if($pinupdate){
|
|
return new Response('Success', 200);
|
|
}else{
|
|
return new Response('Failed', 201);
|
|
}
|
|
});
|
|
$app->get('/newuser', function() {
|
|
global $app;
|
|
global $hooks;
|
|
if(has_pin()){
|
|
return $app->redirect('/dashboard');
|
|
}else{
|
|
$hooks->add_action('global_js','newuser_js');
|
|
$hooks->add_action('the_title',"newuser_title");
|
|
the_head();
|
|
require_once __DIR__.'/../tpl/newuser.php';
|
|
the_footer();
|
|
return "";
|
|
}
|
|
|
|
});
|