hi
i look for a script that makes a link on an introducing page and by clicking the link cookies are set for this user and when he visits this page again he will be redirected to other url,
so he doesnt need always to visit this page
thx for help
need codes to set cookies
Moderator: General Moderators
You will need to set a cookie:
Think this is a day in time.
Then just make a redirection script thing:
Tha should be a start.
Code: Select all
setcookie('cookie_name', 'Cookie value', time()+86400);Then just make a redirection script thing:
Code: Select all
<?PHP
ob_start();
if($_GET['$Cookie_name'] != ""){
header("Location: URL.com"); exit();
}
...
...
?>hi
thx i tried this but unfortunately it doesnt work
the setcookie was on the very 1 line
thx i tried this but unfortunately it doesnt work
Code: Select all
<?
setcookie('nomoremovie', 'Cookie value', time()+86400);
?>
<?PHP
ob_start();
if($_GET['$nomoremovie'] != ""){
header("Location: http://www.mysite.com/index.php?crash=start");exit();
}
...
...
?>Code: Select all
<?php
$cookie_expire = time() + 86400; // 1 day
if (isSet($_GET['please_set_my_cookie'])) {
setcookie('nomoremovie', 'true', $cookie_expire);
header("Location: http://www.mysite.com/index.php?crash=start");
exit;
}
if (isSet($_COOKIE['nomoremovie'])) {
header("Location: http://www.mysite.com/index.php?crash=start");
exit;
}
?>then make a link which directs to this script like
<a href="script.php?please_set_my_cookie">remember me</a>
is that what you mean?
exactly what i need but it gives this error
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web../html/nomoremovie.php:2) in /home/www/web../html/nomoremovie.php on line 5
i made the codes in a nomoremovie.php file and a link this way
<a href="nomoremovie.php?please_set_my_cookie">remember me</a>
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web../html/nomoremovie.php:2) in /home/www/web../html/nomoremovie.php on line 5
i made the codes in a nomoremovie.php file and a link this way
<a href="nomoremovie.php?please_set_my_cookie">remember me</a>
Check out viewtopic.php?t=1157