php


setcookie does not work


I have a simple file called index.php. I need to pass it a querystring that will be stored inside a never-expiring cookie. The file looks exactly like this :
<?php
if (isset($_GET['referrer_id']))
{
$querystringWithJunk = $_GET['referrer_id'];
$querystringArray = explode('/', $querystringWithJunk);
setcookie("referrer_id", $querystringArray[0], time() + 60*60*24*365*100);
}?>
However, no cookie is set. What is inside referrer_id is a simple integer (in the tests I made, it's 1). Function setCoookie return true and everything seems to works fine but no cookie is set. Am I doing something wrong?
Time is bigger than int, so I think result is negative, and then cookie is set into past, what means, it is deleted. Set time to 3 years instead of 100.

Related Links

Why to use a Service on ZF2?
input value returns when form validation runs false
Yii, dual criteria in single relation
cur php to login to a site but is not working
PHP: phpdoc for elements of a class which extends ArrayObject
php function header() not working
SQL and php command error
PhpOffice/PhpWord Charts - Cant show Axis, Grids, Labels
.htaccess url changes when accessing from non www
Manually set save credential preferences in input
how to convert a json_encoded data to an associative array in php?
Mysql character set decoding from utf8_unicode_ci to shift jis
Managing Locale in Laravel 5.2, local not setting
Grab tag styling with php domxpath
Magento | Currency switcher not working when product is already in cart
Can php session_set_cookie_params and setcookie be used in different instances or does 1 override the other

Categories

HOME
events
dotnetnuke
schema.org
activex
foaf
hid
histogram
hyperledger
video-streaming
mailing-list
stack-overflow
log4j2
fasm
colors
circleci
phonegap-build
gravity
coroutine
significance
scheduled-tasks
pfobject
spring-shell
weex
multi-upload
mime-types
amazon-sns
acl
eclipse-emf
software-packaging
opentext
jstree
ccavenue
bonita
amazon-cloudtrail
es6-modules
listjs
xmlunit
restful-architecture
char-pointer
orchardcms-1.8
testlink
llvm-ir
assert
assemblies
reset
task-parallel-library
ol3-google-maps
head.js
lightning-workbench
ptvs
alertify
degrees
kendo-treeview
allegro
cefpython
metabase
mathjs
carmen
uibinder
maximize
exists
fdt
verisign
grinder
outlook.com
nette
sqlbase
google-gdk
org-babel
abstract-factory
flow-js
subfolder
mxe
producer
xcode6.3.1
code-complexity
strdup
particle-swarm
django-settings
insertonsubmit
quickgraph
mongo-jackson-mapper
donut-chart
handshake
cgrectmake
daap
story
live-wallpaper
gamesalad
prototypal-inheritance
airprint
ninject-interception
aspbutton
eventaggregator
twitter-feed
gui-designer
rootkit

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App