<?php 



$_SESSION['admin_userid'] = $_SESSION['userid'];
$userId = $_GET['resellerid'];



$re_users =  $obj->details_by_cond("_reseller_createuser", "UserId='$userId'" );

$reAccess = $obj->details_by_cond("_re_useraccess", "UserId='$userId'");


 if($_SESSION['admin_userid'] != null){
     
    $_SESSION["login"] = true;
    $_SESSION['userid'] = $re_users['UserId'];
    $_SESSION['username'] = $re_users['UserName'];
    $_SESSION['usertype'] = 'RE';
    $_SESSION['userfullname'] = $re_users['FullName'];
    $_SESSION['userimage'] = $re_users['PhotoPath'];

   $obj->resellerHistoryLog([
      're_id'        => isset($_SESSION['admin_userid']) ? $_SESSION['admin_userid'] : 0,
      'header'       => 'Login Admin to Reseller',
      'descriptions' => 'Admin Login Reseller Username "' . $re_users['UserName']. '"',
      'type'         => 'login',
  ]);
    header('Location: ?page=reseller-dashboard');
 }else{
    header('Location: ?page=dashboard');
 }
        