MINI Sh3ll
<?
$formtype = isset($_REQUEST['formtype']) ? $_REQUEST['formtype'] : '';
if($formtype != '')
{
switch($formtype)
{
case "login":
$user = $_REQUEST['user'];
// print_r($user); die();
$luser = $objUser->validateUser($user['loginid'], $user['password']);
if($luser)
{
$session_id = uniqid();
$ip_address = $_SERVER['REMOTE_ADDR'];
$objUser->createLoginSession($luser['id'], $session_id, $ip_address);
$_SESSION['sid'] = encrypt_decrypt('encrypt',''.$session_id);
header("Location:".SITE_ROOT_URL."home/");
die;
}
else
{
$_SESSION['notify_error'] = "Invalid Login ID or Password";
}
break;
case "register":
$request = $_REQUEST;
$user = $_REQUEST['user'];
$c = $objCompany->getCompanyIdByName($user['company']);
if(!$c){
$company['name'] = $user['company'];
$res = $objCompany->addCompany($company);
$user['company_id'] = $res;
}else{
$user['company_id'] = $c['id'];
}
$u = $objUser->getUserDetailsByEmail($user['email']);
if(!$u){
$ip_address = $_SERVER['REMOTE_ADDR'];
$user['ipaddress'] = $ip_address;
$user['usertype'] = 'CADMIN';
$user['password'] = md5($user['password']);
$user['reference_id'] = bin2hex(random_bytes(8));
$user['id'] = $objUser->addUser($user);
if($user['id'] > 0){
$_SESSION['notify_success'] = "User is added successfully.";
header("Location:".SITE_ROOT_URL);
die;
}
else {
$_SESSION['notify_error'] = "Unable to add user.";
}
}
else
$_SESSION['notify_error'] = "User already exists.";
header("Location:".SITE_ROOT_URL);
die;
break;
}
}
?>
OHA YOOOO