3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MonsterTalk { const VERSION = "1.0.1"; protected $namespace = "MonsterTalk"; public function __construct($userId, $domainKey, $salt) { $this->userId = $userId; $this->domainKey = $domainKey; $this->salt = $salt; $this->token; $this->authorize(); } public function authorize() { if (!isset($_COOKIE["__dugalu_token"])){ $token = sha1($this->userId . "@" . $this->salt); $data = base64_encode('userId=' . $this->userId . "&domainKey=" . $this->domainKey . "&token=" . $token); echo $data; setcookie("__dugalu_auth", $data, time()+(60*60*24*30)); } else{ echo 'Existe el cookie'; } // $cookie = $this->genCookie(); } public function genCookie() { $token = sha1($this->userId . "@" . $this->privateKey); return $this->$name; } }

preferences:
34.34 ms | 402 KiB | 5 Q