You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Login.php and admin_model do not show errors on incorrect login or lockout after incorrect activations.
Fixes bellow.
LOGIN CONTROLLER
public function index()
{
/*
Error List:
0 - No Error
1 - Too Many Login Attempts
2 - Bad Credentials
*/
$data["error"] = 0;
if ($this->input->post())
{
Login.php and admin_model do not show errors on incorrect login or lockout after incorrect activations.
Fixes bellow.
LOGIN CONTROLLER
public function index()
{
/*
Error List:
0 - No Error
1 - Too Many Login Attempts
2 - Bad Credentials
*/
$data["error"] = 0;
if ($this->input->post())
{
###ADMIN_MODLE
public function adminLogin($postData) {
if (!isset($postData["username"])) { return 2; }
if (!isset($postData["password"])) { return 2; }
$salt = $this->generateSalt();
$username = $this->db->escape(strip_tags($postData["username"]));
$password = $this->db->escape(strip_tags(md5($salt.$postData["password"])));
$sql = "SELECT * FROM admin WHERE username = ".$username." AND password = ".$password;
$query = $this->db->query($sql);
if ($query->num_rows() > 0) {
$q = $query->row();
$this->session->set_userdata("username",$q->username);
$this->session->set_userdata("verification_key",$q->verification_key);
$this->session->set_userdata("admin_id", $q->id);
$this->session->set_userdata("loggedin",1);
$ip = $this->getUserIP();
$sql2 = "UPDATE admin SET last_signin = NOW(), ip = ".$this->db->escape($ip)." WHERE id = ".$q->id;
$this->db->query($sql2);
return 0;
} else {
return 2;
}
}
The text was updated successfully, but these errors were encountered: