Function isAuthenticated() on a non-object
Suprem
Messages postés
20
Date d'inscription
Statut
Membre
Dernière intervention
-
Suprem Messages postés 20 Date d'inscription Statut Membre Dernière intervention -
Suprem Messages postés 20 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai une erreur dans mon code php que je n'arrive pas à résoudre, pouvez-vous m'aider :
Call to a member function isAuthenticated() on a non-object
<?php
include_once("libraries/securimage/securimage.php");
require_once('application/libraries/PasswordHash.php');
class User extends CI_Controller
{
private $hashTool;
private $data = array();
public function __construct()
{
$this->hashTool = new PasswordHash(8, TRUE);
$this->usermanager =& get_instance();
}
public function check_password($pass, $hash){
return $this->hashTool->CheckPassword($pass, $hash);
}
public function index() {
if ($this->usermanager->isAuthenticated()) {
$this->profile();
} else {
$this->authenticate();
}
}
public function authenticate() {
if ($this->usermanager->isAuthenticated()) {
$this->profile();
return;
}
if ($this->input->post("nickname") || $this->input->post("password")) {
$name = $this->input->post("nickname");
$password = $this->input->post("password");
if ($this->usermanager->authenticate($name, $this->hashTool->CheckPassword($password, $stored_hash))) {
$this->data["goodError"] = "Bienvenue <strong>" . $name . "</strong> !";
$this->profile();
return;
} else {
$this->data["error"] = "Mauvais identifiant/mot de passe.";
}
}
$this->layout->view("user_authenticate", $this->data);
}
j'ai une erreur dans mon code php que je n'arrive pas à résoudre, pouvez-vous m'aider :
Call to a member function isAuthenticated() on a non-object
<?php
include_once("libraries/securimage/securimage.php");
require_once('application/libraries/PasswordHash.php');
class User extends CI_Controller
{
private $hashTool;
private $data = array();
public function __construct()
{
$this->hashTool = new PasswordHash(8, TRUE);
$this->usermanager =& get_instance();
}
public function check_password($pass, $hash){
return $this->hashTool->CheckPassword($pass, $hash);
}
public function index() {
if ($this->usermanager->isAuthenticated()) {
$this->profile();
} else {
$this->authenticate();
}
}
public function authenticate() {
if ($this->usermanager->isAuthenticated()) {
$this->profile();
return;
}
if ($this->input->post("nickname") || $this->input->post("password")) {
$name = $this->input->post("nickname");
$password = $this->input->post("password");
if ($this->usermanager->authenticate($name, $this->hashTool->CheckPassword($password, $stored_hash))) {
$this->data["goodError"] = "Bienvenue <strong>" . $name . "</strong> !";
$this->profile();
return;
} else {
$this->data["error"] = "Mauvais identifiant/mot de passe.";
}
}
$this->layout->view("user_authenticate", $this->data);
}
A voir également:
- (Function(){css.removeclass(document.body,%20'profile_two_columns'); tab_controller.changepage("photos");})()
- Partager des photos - Guide
- Toutes mes photos - Guide
- Google photos - Télécharger - Albums photo
- Telecharger fl studio 20 pour pc gratuit complet - Télécharger - Édition & Montage
- Doublons photos - Guide