[eluser]Medikal[/eluser]
For some reason, I've modified the base url for every possible scenario, my website works fine at domain.com/beta - as soon as I go to domain.com/beta/user/login and login as a user. I get redirected to the homepage and receive an internal server error, and it won't be changed until I clear my cache, and it works fine again until I login. My thoughts are it has to be in the login code? So I posted a bit of it below, nothing in my servers error logs either.
Controller:
Code:
function Login()
{
// Set where they're coming from to the BASE URL if it doesn't know
$referrer = ($this->agent->referrer()) ? $this->agent->referrer() : BASE_URL;
// Set it to flashdata
$this->session->set_flashdata("referrer", $referrer);
##-- Here's where we'll redirect if they're logged in
$this->auth->redirectIfLogged();
// Load up our validation library
$this->load->library("form_validation");
// Set parameters for login
$this->form_validation->set_rules("email", "E-mail Address", "required");
$this->form_validation->set_rules("password", "Password", "required|callback__validateCreds");
// If the form validation runs, or it hasn't been submitted yet
if ($this->form_validation->run() == FALSE)
{
$template['mainContent'] = "login";
$this->load->view(LAYOUT, $template);
} else {
$specificSalt = $this->db->get_where(USERS, array("email" => $this->input->post("email")), 1);
$specificSalt = $specificSalt->row_array();
$newToken = sha1($this->user->generateSalt());
// Set email to flashdata for _validateCreds
$this->session->set_flashdata("postEmail", $this->input->post("email"));
// Generate & update NEW Token
$this->db->update(USERS, array("token" => $newToken), array("password" => $this->user->saltPassword($this->input->post("password"), $specificSalt["salt"])));
$cookieString = $specificSalt["userID"]."|".$specificSalt["email"]."|".$newToken;
// Example:
// 5|[email protected]|9162822b3111887a6541a9ac59b2b020d38b6e4a
// uid|username|token
$cookieInformation = array(
"name" => "LoginInfo",
"value" => $cookieString,
"expire" => LOGIN_DURATION);
set_cookie($cookieInformation);
// Send user back to where they came from
redirect($this->session->flashdata("referrer"));
}
}
Obviously there's a lot more going on since it calls the user model and the auth library, but that's just the main code.