My redirect is not working, I can see no reason why it is not working thouhg, can anyone see a reason,
function createCookie() {
$this->load->helper('url')
// Function gets called when the user clicks yes on the firstTime menu.
// The purpose of this function is to create a cookie for the user.
// First we'll give them a unique ID
// Set an expiration time
$prefix = "bang";
$unique = uniqid($prefix);
$expireAt = time() + (60*60*24*30);
// With the unique ID now available we can set our cookie doing the same function as before
$_COOKIE[] = setcookie("bangUser", $unique, $expireAt, "/");
// Now that the cookie is set we can do a 100% check, check that cookie is set and if it is redirect to
// to the homepage
if(isset($_COOKIE['bangUser'])) {
// We need to save the cookie data to the database
// First let's load the model for the cookies
$this->load->model('cookieModel');
if($this->cookieModel->saveCookieRecord($_COOKIE['bangUser'], $expireAt)) {
redirect(base_url(), 'location');
} else {
die(var_dump($this->cookieModel->saveCookieRecord($_COOKIE['bangUser'], $expireAt)));
}
}
}
if I replace the redirect with die() however I get the die messege.
Any ideas?
If you are wanting to go 'home' to the base you establish in your route file just put:
If you want to actually go somewhere with your code only pass the URI segments:
GL, and let me know if that doesn't work.
Try replacing base_url() with uri_string(). From the User Guide: