Jump to content

Cookie syntax error


Xtremer360

Recommended Posts

Trying to figure out where my syntax error is. Also to know I'm using code igniter but I don't think that changes anything.

 

if (isset(cookie('xtrcook')) AND (!empty(cookie('xtrcook'))) || trim(cookie('xtrcook') !== '') || (cookie('xtrcook') !== NULL) || (!is_numeric(cookie('xtrcook'))))

 

http://codeigniter.com/user_guide/helpers/cookie_helper.html

 

 

Link to comment
https://forums.phpfreaks.com/topic/257994-cookie-syntax-error/
Share on other sites

Well, unless you have defined a "cookie" function, I don't believe CodeIgniter has one for you. So cookie('xtrcook') may fail anyway.

 

You probably want something like this:

 

<?php
$cookie = trim($this->input->cookie('xtrcook'));

// Or with the cookie helper functions (not really necessary)
// $cookie = trim(get_cookie('xtrcook'));

if ( ! $cookie || ! is_numeric($cookie)) {
die('bad cookie');
}
?>

 

Otherwise, as creata.physics said, what is the exact error you are getting?

Link to comment
https://forums.phpfreaks.com/topic/257994-cookie-syntax-error/#findComment-1322429
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.