-
Notifications
You must be signed in to change notification settings - Fork 1
/
errMsg.php
38 lines (31 loc) · 1.05 KB
/
errMsg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
// clean session flg when get message back
function getSessErrMsg($errFlg) {
unset($_SESSION["errFlg"]);
return getErrMsg($errFlg);
}
// return error message by erro flg code
function getErrMsg($errFlg) {
if (isset($_SESSION["errMsg"])) {
$errMsg = $_SESSION["errMsg"];
} else {
$errMsg = "";
}
// Defination of Error Messages
$defaultMsg = "Error Code Wrong, Please contact the Administrator!";
$errMsgs = Array(
"001" => "Email address or Password is incorrect, please try again.",
"002" => "Update Faile, please try again later or continue to <a href='menu.php'>menu</a> page.",
"003" => "Unknown format selected, please choose another one and try again.",
"004" => "There is a necessary data not contained in the uploaded file.",
"005" => "There is a experiment with no treatment be selected.",
"DB" => $errMsg
);
// return message if code valid
if (isset($errMsgs[$errFlg])) {
return "[" . $errFlg . "] " . $errMsgs[$errFlg];
} else {
return "[" . $errFlg . "] " . $defaultMsg;
}
}
?>