Immediately to the point. After logging in, you get to the main page of the site (as it should be), but the site considers you not authorized. THe. E (just the button to register, etc.) What could be the problem?

<!-- Вход пользователя --> <div id="account">{if $user} <span id="username"> Здравствуйте, <a href="user">{$user->name}</a>{if $group->discount>0}, ваша скидка — {$group->discount}%{/if} </span> <a id="logout" href="user/logout">выйти</a> {else} <a id="register" href="user/register">Регистрация</a> <a id="login" href="user/login">Вход</a> или <script src="//ulogin.ru/js/ulogin.js"></script> <a href="#" id="uLogin" data-ulogin="display=window;fields=first_name,last_name;redirect_uri=http%3A%2F%2Fberi-dari.org"><img src="http://ulogin.ru/img/button.png" width=187 height=30 alt="МультиВход"/></a> {/if} </div> <!-- Вход пользователя (The End)--> // Вход через ULogin elseif(isset($_POST['token'])) { $s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']); $data = json_decode($s, true); if (isset($data['uid'])) { $name = $data['first_name'].' '.$data['last_name']; $email = $data['email']; $password = md5($data['uid'].'9d6e1c88e1c559e682b86a2713b15484');//пришлось свою сок добавить, так как у class Users private $salt //проверяем есть ли в БД такой емейл $this->db->query('SELECT count(*) as count, id FROM __users WHERE email=?', $email) $user_exists = $this->db->result(); if($user_id = $this->users->check_password($email, $password)) { $user = $this->users->get_user($email); if($user->enabled) { $_SESSION['user_id'] = $user_id; header('Location: '.$this->config->root_url); } else { $this->design->assign('error', 'user_disabled'); } } elseif($user_exists->count) { $_SESSION['user_id'] = $user_exists->id; header('Location: '.$this->config->root_url); } else { $user_id = $this->users->add_user( array('name'=>$name, 'email'=>$email, 'password'=>$password, 'enabled'=>1) ); $_SESSION['user_id'] = $user_id; header('Location: '.$this->config->root_url); } } } 

    1 answer 1

    print_r ($ _ SESSION); // See the session, are all parameters listed? If yes, then watch it on the main page and display the information hidden from guests to the user.

    • there is no user anywhere ... not in the session not in the bdumny people said they need to be fixed fields = first_name, last_name; fields = first_name, last_name, email; .... well, that is to add the soap as it is mandatory .... but this did not solve the problem. I understand nothing in $ user-> name is passed ..... but how to make the name transmitted. for example with VK - HoPkInS