54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class Auth extends BaseController
|
|
{
|
|
public function index(): string
|
|
{
|
|
return view('welcome_message');
|
|
}
|
|
|
|
|
|
public function AuthPromoAdmin(){
|
|
// echo 'Ameye Olusesan';
|
|
$out=[];
|
|
return view('promo_admin_home', $out);
|
|
}
|
|
|
|
public function AuthPromoLogin(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$data = $_POST; ///json_decode($raw_json, true);
|
|
$out=[];
|
|
|
|
// $data['username'] = $_GET['username']; // strtolower($this->input->get('email')); // '08174596144';
|
|
// $data['password'] = $_GET['password']; // $this->input->get('firstname'); //'7978';
|
|
|
|
$out = $this->APIcall('POST', $this->wrenchAdminApiServer(). 'auth',$data);
|
|
// var_dump( $out );
|
|
if (is_array($out) && isset($out['sessionid']) && isset($out['promo_admin_id'])){
|
|
|
|
$_SESSION['firstname'] = $out['firstname'];
|
|
$_SESSION['lastname'] = $out['lastname'];
|
|
$_SESSION['email'] = $out['email'];
|
|
$_SESSION['promo_admin_id'] =$out['promo_admin_id'];
|
|
$_SESSION['sessionid'] = $out['sessionid'];
|
|
$_SESSION['uid'] = $out['uid'];
|
|
$_SESSION['points'] =$out['points'];
|
|
|
|
$_SESSION['new_users'] = 0;
|
|
$_SESSION['pending_users'] = 0;
|
|
$_SESSION['active_users'] = 0;
|
|
$_SESSION['total_users'] = 0;
|
|
|
|
|
|
return view('admin/index', $out);
|
|
}
|
|
|
|
return view('promo_admin_home', $out);
|
|
}
|
|
|
|
|
|
|
|
}
|