Esempio n. 1
0
 public static function TryStartSession($username, $password)
 {
     if (!($habbo = Habbo::GetHabboByName($username))) {
         return "Error #1";
         //User not exists
     }
     if (!Habbo::CheckAuth($habbo, $password)) {
         return "Error #2";
         //Wrong Pass
     }
     CookieManager::SetCookie(CMS_COOKIE_LOGIN_NAME, json_encode(["username" => $username, "password" => $password]), 'json', time() + CMS_COOKIE_LOGIN_DURATION, Loc::GetHTTPHost(), Loc::GetMyIP());
 }
<?php

require_once '../FastInit.php';
//header("Content-Type: text/json");
use habbo\Session\HabboCookie as HC;
use habbo\Articles\ArticleManager as AM;
use api\Requests\Requests as Req;
use habbo\Users\HabboUserManager as Habbo;
$articleid = Req::Php("article_id");
$positive = Req::Php("positive");
$err = ["error" => true, "message" => "UNKOWN_ERROR"];
function goerror($str)
{
    die(json_encode(["error" => true, "message" => $str]));
}
if (!HC::HasSession()) {
    goerror("ERROR_SESSION_NOT_FOUND");
}
$session = json_decode(HC::GetSessionData()->value);
$habbo = Habbo::GetHabboByName($session->username);
if (!$habbo) {
    goerror("ERROR_SESSION_USER_NOT_FOUND");
}
if (!$articleid || !$positive) {
    goerror("ERROR_MISS_ARGS");
}
$article = AM::GetNotice($articleid);
if (!$article->Success) {
    goerror("ERROR_ARTICLE_NOT_FOUND");
}
$article->Vote->AddVote($habbo->id, $positive == "true");
Esempio n. 3
0
<?php

//FIXAR ISSO URGENTEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE//
//session_start();
require_once "../library/Init.php";
use Database\DatabaseManager as DB;
use habbo\Session\HabboCookie as Session;
use habbo\Users\HabboUserManager as Habbo;
if (!Session::HasSession()) {
    die("");
}
$usercookie = json_decode(Session::GetSessionData()->value);
$user = Habbo::GetHabboByName($usercookie->username);
$user->GenerateNewTicket();
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-Equiv="Cache-Control" Content="no-cache" />
    <meta http-Equiv="Pragma" Content="no-cache" />
    <meta http-Equiv="Expires" Content="0" />
	<script type="text/javascript">
		var andSoItBegins = (new Date()).getTime();
	</script>
	<link rel="shortcut icon" href="<?php 
echo WEB_URL;
?>
/web-gallery/v2/images/favicon.ico" type="image/vnd.microsoft.icon" />

	<script src="<?php 
echo WEB_URL;
Esempio n. 4
0
use habbo\Users\HabboUserManager as Habbo;
use api\Requests\Requests;
use api\Helper\_Array as Arr;
use habbo\Session\HabboCookie as CM;
use api\Helper\Localization as Loc;
header("Content-Type: text/json");
//echo file_get_contents('php://input');
$userdata = ["error" => true, "message" => "Erro desconhecido"];
if (!Arr::ContainsAll(Requests::$PhpInput, ["username", "password"])) {
    $userdata["error"] = true;
    $userdata["message"] = "Preencha com Nome e Senha!";
    goto end;
}
$username = Requests::Php("username");
$password = Requests::Php("password");
$user = Habbo::GetHabboByName($username);
if (!$user) {
    $userdata["error"] = true;
    $userdata["message"] = "Este usuário não existe!";
    goto end;
}
if (!Arr::ContainsAll(Requests::$PhpInput, ["username", "password"])) {
    $userdata["error"] = true;
    $userdata["message"] = "Preencha com Nome e Senha!";
    goto end;
}
if (!Habbo::CheckAuth($user, $password)) {
    $userdata["error"] = true;
    $userdata["message"] = "Senha Incorreta!";
    goto end;
}
Esempio n. 5
0
<?php

require_once '../FastInit.php';
use habbo\Session\HabboCookie as C;
use habbo\Users\HabboUserManager as Habbo;
header("Content-Type: text/json");
$sessiondata = null;
$userdata = null;
if (C::HasSession()) {
    $sessiondata = C::GetSessionData();
    $userdata = json_decode($sessiondata->value);
}
$data = ["has_session" => C::HasSession(), "userdata" => null, "cookie_data" => null];
if (C::HasSession()) {
    if ($habbo = Habbo::GetHabboByName($userdata->username)) {
        if (Habbo::CheckAuth($habbo, $userdata->password)) {
            $data["userdata"] = $habbo->PrivateInfo();
            $data["cookie_data"] = ["expire" => $sessiondata->expire, "now" => time(), "reaming_time" => $sessiondata->expire - time()];
        }
    }
}
echo json_encode($data);