-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.php
More file actions
31 lines (29 loc) · 765 Bytes
/
session.php
File metadata and controls
31 lines (29 loc) · 765 Bytes
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
<?php
header("Access-Control-Allow-Origin: *");
session_start();
$type = $_POST["type"];
$action = $_POST["action"];
if ( $action !== "sessionToken" )
{
if ( $type == "set" ) {
$_SESSION[ $action ] = $_POST["value"];
}
else if ( $type == "get" ) {
if ( isset($_SESSION[ $action ]) )
echo $_SESSION[ $action ];
else
echo "";
}
}
else {
if ( $type == "set" ) {
$_SESSION["SessionToken"] = $_POST["value"];
}
else if ( $type == "get" ) {
if ( isset($_SESSION["SessionToken"]) )
echo $_SESSION["SessionToken"];
else
echo "";
}
}
?>