Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once "../core.php";
- if (isset($_SESSION['uname'])) {
- $sql = $_SQL->query("SELECT *, NULL as sodium, NULL as password from `users` WHERE `id` = '{$_USER['id']}'");
- $_LOGGED = $sql->fetch_assoc();
- if ($_LOGGED['hmail'] == 'y') { $_LOGGED['email']='hidden'; }
- if (!isImage($_LOGGED['avatar'])) { $_LOGGED['avatar'] = "//halovau.lt/css/images/grunt.png"; }
- $_LOGGED['hmail']='';
- $loggedSession = json_encode($_LOGGED, JSON_PRETTY_PRINT);
- $loggedSession = str_replace("\\/", "/", $loggedSession);
- $loggedSession = str_replace('"password": null,', '', $loggedSession);
- $loggedSession = str_replace('"sodium": null,', '', $loggedSession);
- $loggedSession = str_replace('"hmail": "",', '', $loggedSession);
- if(array_key_exists('callback', $_GET)){
- header('Content-Type: text/javascript; charset=utf8');
- header('Access-Control-Allow-Origin: *');
- header('Access-Control-Max-Age: 3628800');
- header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
- $callback = $_GET['callback'];
- echo $callback.'('.$loggedSession.');';
- } else {
- header('Content-type: application/json'); header("Access-Control-Allow-Origin: *");
- print_r($loggedSession);
- }
- } else echo "Unable to handle cross-origin request";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement