Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-14-2004, 12:14 AM   #1
Registered: Mar 2004
Location: USA
Distribution: Ubuntu
Posts: 284

Rep: Reputation: 30
PHP HELP: values are deleted from cookies in Mozilla

Dear LQ

I will appreciate if you could go to my site (using Mozilla please, I asume you don't use IE anyway)

Then, click on "more settings", or enter your Name (in the topbar), the news per page, and the Start page you want

For instance, I could select 'Xavier Humberto' as the name, 'Games' as the start page, and '13' as News per page

What that form does is send it's variables to a page called "language.php". The code in it is similar to this:

if ($myvariable1!="") { $variable1=$myvariable1; }
if ($myvariable2!="") { $variable2=$myvariable2; }
if ($myname!="") { $name=$myname; }
if ($variable1=="") { $variable1="default_value_for_variable1"; }
if ($variable2=="") { $variable1="default_value_for_variable2"; }
$val = setcookie("variable1", $variable1, time()+60*60*24*120, "/", "");
$val = setcookie("variable2", $variable2, time()+60*60*24*120, "/", "");
if ($name!="")
$name=htmlspecialchars($name); $name=stripslashes($name);
$val = setcookie("name",$name,time()+60*60*24*120, "/", "");
header ("Location: index.php");

According to me, the script is ok

It works excellent with IE. For instance, with the values mentioned above, every time that I visit, I will see the 'Gaming Zone' as default, with my name in the customized greeting, and 13 news per page

However, with mozilla, a stange thing happens

It seems to work ok, cookies are all set. However, the 'forum' and the 'name' values are deleted from the cookies after I browse 2 or 3 pages

So, if I do the same thing in Mozilla, I will see 13 news per page, and the 'Gaming Zone' as a default

However, if I click on 'More settings', and chose NOT to see the 'Latest forums' on the main page, the setting will just work for 2-3 pages. After that, the value is deleted from the cookies

Same for the name, I will see my name with a customized greeting, but after browsing 2-3 pages, that value is deleted from the cookie

All other values seem to stay (such as the background, the news per page, start page...)

I'll appreciate any suggestions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cookies in php RazorKnight Programming 1 10-08-2004 05:31 AM
PHP - Cookies, unserialize() dhbiker Programming 1 07-28-2004 03:18 PM
mozilla firefox and cookies wrongman Linux - Software 1 05-11-2004 07:03 AM
PHP and cookies. jacksmash Programming 13 04-02-2004 10:01 AM
Mozilla 1.5 cookies 1948chev Linux - General 1 02-20-2004 06:24 PM

All times are GMT -5. The time now is 10:19 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration