Reputation: 12163
($row->status == "Pass")
should be equaling to true, but for some it isn't. I'm guessing I have code error's. Does anybody know what I am doing wrong?
public function logsig() {
header('Content-type:application/json');
$postedUser = $this->input->post('username');
$password = $this->input->post('password');
$hashedPass = $this->encrypt->sha1($password);
$query = $this->db->query("SELECT * FROM users WHERE username = '{$postedUser}' AND password = '{$hashedPass}'");
if ($query->num_rows() > 0) {
$row = $query->row();
if ($row->status == "Pass") {
$this->session->set_userdata('logged', "1");
$this->session->set_userdata("username", "{$postedUser}");
echo json_encode(array('session_state' => true));
} elseif ($row->status == "Fail" || $row->status == "Pending") {
echo json_encode(array('session_state' => false));
}
}
}
Upvotes: 0
Views: 840
Reputation: 15802
Copied in from a comment so this doesn't keep showing up in unanswered for Henes :)
It's case-sensitive - is it definitely "Pass" in both places? The problem is almost certainly going to be a simple gotcha, so re-check your basics.
Upvotes: 3