I am using a very poor but unique encryption method for encrypting usernames on my website and every time I go to get the username from the cookie it didn't work, so I tried to echo it out and started getting an error.
Setting cookie:
setcookie(encrypt("username", $salt), encrypt("null", $salt), time()+3600, '/');
Getting cookie:
echo $_COOKIE[encrypt("username",$salt)];
error:
Notice: Undefined index: '8up_ibR[P'
cookie value:
Name: 8up_ibR[P
Value: 4nrfc
Domain: localhost
Path: /
Expires: Thu, 12 Dec 2013 01:42:04 GMT
Size: 14
EDIT: Upon further investigation using echo print_r($_COOKIE);
I found out that the 2nd to last symbol([) turns into _ in the print out. I'm assuming symbols are not allowed in cookies and that should resolve my issue?