This repository was archived by the owner on Feb 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XATEV
authored and
XATEV
committed
Oct 12, 2019
1 parent
a3864b5
commit b5d8528
Showing
5 changed files
with
125 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
|
||
class httpStatusCode extends SplEnum { | ||
const __default = self::OK; | ||
|
||
const SWITCHING_PROTOCOLS = 101; | ||
const OK = 200; | ||
const CREATED = 201; | ||
const ACCEPTED = 202; | ||
const NONAUTHORITATIVE_INFORMATION = 203; | ||
const NO_CONTENT = 204; | ||
const RESET_CONTENT = 205; | ||
const PARTIAL_CONTENT = 206; | ||
const MULTIPLE_CHOICES = 300; | ||
const MOVED_PERMANENTLY = 301; | ||
const MOVED_TEMPORARILY = 302; | ||
const SEE_OTHER = 303; | ||
const NOT_MODIFIED = 304; | ||
const USE_PROXY = 305; | ||
const BAD_REQUEST = 400; | ||
const UNAUTHORIZED = 401; | ||
const PAYMENT_REQUIRED = 402; | ||
const FORBIDDEN = 403; | ||
const NOT_FOUND = 404; | ||
const METHOD_NOT_ALLOWED = 405; | ||
const NOT_ACCEPTABLE = 406; | ||
const PROXY_AUTHENTICATION_REQUIRED = 407; | ||
const REQUEST_TIMEOUT = 408; | ||
const CONFLICT = 408; | ||
const GONE = 410; | ||
const LENGTH_REQUIRED = 411; | ||
const PRECONDITION_FAILED = 412; | ||
const REQUEST_ENTITY_TOO_LARGE = 413; | ||
const REQUESTURI_TOO_LARGE = 414; | ||
const UNSUPPORTED_MEDIA_TYPE = 415; | ||
const REQUESTED_RANGE_NOT_SATISFIABLE = 416; | ||
const EXPECTATION_FAILED = 417; | ||
const IM_A_TEAPOT = 418; | ||
const INTERNAL_SERVER_ERROR = 500; | ||
const NOT_IMPLEMENTED = 501; | ||
const BAD_GATEWAY = 502; | ||
const SERVICE_UNAVAILABLE = 503; | ||
const GATEWAY_TIMEOUT = 504; | ||
const HTTP_VERSION_NOT_SUPPORTED = 505; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
|
||
class utils_json | ||
{ | ||
public function success_login($player_id, $playername, $session_id) { | ||
|
||
$arr = array( | ||
'success' => true, | ||
'user' => array( | ||
'id' => $player_id, | ||
'name' => $playername | ||
), | ||
'token' => $session_id | ||
); | ||
|
||
echo json_encode($arr); | ||
http_response_code(new httpStatusCode(httpStatusCode::OK)); | ||
} | ||
|
||
public function fail_msg($message) { | ||
|
||
$arr = array( | ||
'success' => false, | ||
'message' => $message | ||
); | ||
|
||
echo json_encode($arr); | ||
http_response_code(new httpStatusCode(httpStatusCode::BAD_REQUEST)); | ||
} | ||
} |