<?php
include '../config/index.php';
include '../module/index.php';
 
$data = new Database;

$con  = $data->connect();

$user = new User($con);

$post = filter_var_array($_POST,FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$id       = $_GET['id'];
$type     = $_GET['type'];

if($type == 'otp'){
   if($user->getUserNameById($_GET['id'])->otp == true){
      echo $user->updateUser('otp',0,$id);
   }else{
      echo $user->updateUser('otp',1,$id);
   }
}else if($type == 'status'){
   if($user->getUserNameById($_GET['id'])->status == 'active'){
     echo $user->updateUser('status','inactive',$id);
   }else{
      echo $user->updateUser('status','active',$id);
   }
}else if($type == 'cot'){
   $ran = rand(00000,99999);
   echo $user->updateUser('cot',$ran,$id);

}else if($type == 'auth'){
   $ran = rand(00000,99999);
   echo $user->updateUser('auth',$ran,$id);

}else if($type == 'vat'){
   $ran = rand(00000,99999);
   echo $user->updateUser('vat',$ran,$id);
}else{

   if($user->getUserNameById($_GET['id'])->transfer == true){
      echo $user->updateUser('transfer',0,$id);
   }else{
      echo $user->updateUser('transfer',1,$id);
   }
}
$_SESSION['t_error_c']  = 'user payment setting updated ';
echo $data->redirect("../account/../index?setting=$id");


?>