Fwd: cookies time? - now it doesn't write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---------- Forwarded message ----------
From: German Piqué <extremdur2@xxxxxxxxx>
Date: 19-sep-2006 10:38
Subject: Re:  cookies time? - now it doesn't write
To: "Frank M. Kromann" <frank@xxxxxxxxxxxx>

Now works... Oo

But i have another problem.

My script must check a DB and inform of the changes that have been
produced since the last update. I tried two different ways to do it:

1) Use a file in the server to store the diferences

2) Use cookies to store the info.

The first solution has the problem that the update will take place for all
the users that access the script. I think that would be risky for the
integrity of the file or the info retrieved in a case of to much accesses...


The second option i think that is better. But i encounter problems.
Depending on the content, the setcookie returns an error. The idea of the
code is that first search if the cookie exists. If yes, shows it. otherwise,
no. After that, when the access to the DB is made, it stores the results in
the cookie to be reused again. I tried to avoid the 4 KBs limit problem by
creating a class that controls the lenght of the string and if it surpases
the limit, creates another cookie, with the increment of a counter attatchet
to the base name of the cookie.

It's curious that if I put the string manually, it can be larger than one
string created through the union of one array's cells.

Could it be a memory problem, like the class is taking all of it leaving
nothing to the cookies? I think that this sentence has no sense but i don't
know what it could be.

I tried to destroy the cookies after reading them, too. But when I try to
re-create it later in order to insert the new info causes an error, and in
the next refresh, there are no cookies and I can write to the cookies!!
Then, in the next refresh, again I can read the cookie, but I can't write to
it. In the next, there are no cookis and I can write again... Why? Why if
the cookie is destroyed I can write it but if it's create I can't rewrite
it?

That's the cause that leade me to think that it's a memory problem.

Well... any ideas?



2006/9/19, German Piqué <extremdur2@xxxxxxxxx>:

So, it's another problem. -_- I'll give it a try.

2006/9/18, Frank M. Kromann <frank@xxxxxxxxxxxx>:

> both time() and mktime() works fine on Windows.
>
> - Frank
>
> > Well, reading the documentation about cookies i saw that the function
> time()
> > works using UNIX epochs. If I try to use this function (or mktime) in
> > windows, the php shows a white page, like there's an error somewhere.
> >
> > It's a problem with windows machine's or there's another solution to
> this?
> >
> > Meanwhile, I put no time option (so cookie expires at the end of the
> > session) but i would like to try to set up a timeout.
> >
> > I don't demand absolute solutions, I only want a clue to work on.
> >
> > Thank you :)
> >
>
>
>
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux