function menuAuthorization($taskid, $userid) { $retVal = false; if (isDbConnect()) { $conn = pg_connect(getConnectionString()); $queryString = "\n select * \n from icrm.tr_applicationtaskrole a \n join icrm.tr_applicationuserrole b \n on a.roleid = b.roleid \n where a.taskid = {$taskid} \n and b.userid = {$userid} \n "; $recordset = pg_query($conn, $queryString); if (pg_num_rows($recordset) > 0) { $retVal = true; } } return $retVal; }
function isHasChild($parentid) { $isHasChild = false; if (isDbConnect()) { $conn = pg_connect(getConnectionString()); $queryString = ""; // XIBAR-OLD $queryString = "select count(1) as xcount "; $queryString .= queryString(); $queryString .= "and a.parentid = " . $parentid . " "; $recordset = pg_query($conn, $queryString); while ($row = pg_fetch_object($recordset)) { $isHasChild = $row->xcount > 0 ? true : false; } pg_close(getConnectionString()); } return $isHasChild; }
// 'watno'; // htmlspecialchars($_REQUEST['userName']); $userPassword = ''; // 'kopi'; // htmlspecialchars($_REQUEST['userPassword']); $userName = $_POST['userName']; $userPassword = $_POST['userPassword']; $result["State"] = -1; $result["Message"] = "User is invalid"; $items = array(); // CARA FAJAR $message = "error"; // "success" / "error" $_SESSION[$_SESSION["appname"] . "_" . "iduser"] = null; $_SESSION[$_SESSION["appname"] . "_" . "username"] = null; $_SESSION[$_SESSION["appname"] . "_" . "user_password"] = null; $_SESSION[$_SESSION["appname"] . "_" . "user_datetime_start"] = null; if (isDbConnect()) { $conn = pg_connect(getConnectionString()); $queryString = "\n select \n id, name, password \n from \n icrm.tr_membershipuser \n order by \n id \n "; $recordset = pg_query($conn, $queryString); while ($row = pg_fetch_object($recordset)) { if ($userName == $row->name && $userPassword == $row->password) { $userStructure = new UserStructure1(); $userStructure->userId = $row->id; $userStructure->userName = $row->name; $userStructure->userPassword = $row->password; array_push($items, $userStructure); $result["State"] = 0; $result["Message"] = ""; // CARA FAJAR $message = "success"; // "success" / "error"