$sys_role_ob = new SystemRoleConrtoller(); /** * Action Declare * default action 0=add,1=edit,2=delete */ if (isset($_POST['submit'])) { if ($action == 0) { $resContent = $sys_user_ob->insertAction($_REQUEST); } if ($action == 1) { $resContent = $sys_user_ob->updateAction($_REQUEST); } } if (isset($_REQUEST['pk']) && $pk != "") { $action = 1; $tableDataRes = $sys_user_ob->selectAction("sys_user_id={$pk}"); $tableDatas = $tableDataRes[0]; } else { $pk = ""; $action = 0; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="">
<thead> <tr> <th width="5%">S.No</th> <th>System User</th> <th>System Role</th> <th>User Name</th> <th>Email</th> <th>Mobile</th> <th>Created At</th> <th width="5%">Action</th> </tr> </thead> <tbody> <?php $tableDataRes = $sys_user_ob->selectAction("flag=0"); for ($r = 0; $r < count($tableDataRes); $r++) { $pk = $tableDataRes[$r]['sys_user_id']; $sys_role = new SystemRoleConrtoller(); $sys_role_data = $sys_role->selectAction("sys_role_id=" . $tableDataRes[$r]['sys_role_id']); $sys_role_name = $sys_role_data[0]['sys_role']; ?> <tr> <td><?php echo $r + 1; ?> </td> <td><?php echo $tableDataRes[$r]['sys_name']; ?> </td>
public function loginAction($params) { $db = new connection(); $user_name = $params['user_name']; $tableName = $this->table_name; $password = $db->encodeData($params['password']); $rawQry = "SELECT * FROM `system_user` WHERE 1 and `flag`=0 and `user_name`='{$user_name}' and `password`='{$password}'"; $res = $db->rawQry($rawQry); if ($res == true) { $sys_user = new SystemUserConrtoller(); $user_data = $sys_user->selectAction($where = " `flag`=0 and `user_name`='{$user_name}' and `password`='{$password}'"); $_SESSION['sys_user_id'] = $user_data[0]['sys_user_id']; $_SESSION['sys_user_name'] = $user_data[0]['sys_name']; $_SESSION['sys_role_id'] = $user_data[0]['sys_role_id']; header("Location:index.php"); } else { $msg = "Invalid Username and Password!"; return $msg; } }