Ejemplo n.º 1
0
<?php

require "libs/DBCommon.php";
die(GetPHPSESID("Stoneface", "Stoneface"));
//die(LogOut("e3a728e3de56008b72100a5c785e1c4d"));
//die(CheckLogin("Stoneface"));
//die(Registration("Test", "Test", "10"));
//die(GetFriends(1));
//die(AddFriend(1, 0, "test"));
//die(DelFriend(1, "test"));
Ejemplo n.º 2
0
$req = json_decode(file_get_contents("php://input"));
if ($req === false) {
    SendDataAndDie(1, "");
}
if (!isset($req->command)) {
    SendDataAndDie(2, "");
}
if (!isset($req->data)) {
    SendDataAndDie(3, "");
}
$cmd = strtolower($req->command);
if ($cmd == "login") {
    if (!isset($req->data->login) || !isset($req->data->password)) {
        SendDataAndDie(4, "");
    }
    $res = GetPHPSESID($req->data->login, $req->data->password);
    if ($res === false) {
        SendDataAndDie(300, "");
    }
    SendDataAndDie(200, $res);
} else {
    if ($cmd == "logout") {
        if (!isset($req->phpsesid)) {
            SendDataAndDie(301, "");
        }
        $res = LogOut($req->phpsesid);
        if ($res === false) {
            SendDataAndDie(302, "");
        }
        SendDataAndDie(200, "");
    } else {