php-windows Digest 31 May 2004 12:04:26 -0000 Issue 2269

Topics (messages 23892 through 23894):

Re: How do you delete a cookie on the spot?
        23892 by: Ross Honniball

Do not delete cookies; use php sessions
        23893 by: hubo

Which is more ideal for updating each row at a time in a MySQL database?
        23894 by: Daniel Anderson

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- I have never personally used cookies, but something I read recently indicated the following.

This is in relation to a browsers implementation of cookie behaviour:

1. The way you delete a cookie is to set it's expiry date to a date in the past
2. Browsers are not required to delete the cookie immediately. The timing
   of their clean-up process is browser dependent.

Obviously you want to take note of point 2.

You may want to consider, as an alternative approach, using session variables to store information. Using session variables, the data is stored on the server side and you have more accurate control over it's values.

Good luck ... Ross

At 08:56 AM 31/05/2004, you wrote:
Hi, can anyone tell me how to clear a cookie when the line comes up?
Because the following: setcookie("name",""); does work yes, but not well enough.
I need it to remove that cookie there and then.


For example:

You go through a login process to access a page, it sets a cookie with username and password so it registers you as being logged in.

When you click a link which directs you to a logout page, it will clear the cookie.

This is all well and good but if you retype the url to get back to the page, e.g. http://server/main/ it will still state that you have logged in.

This seems to be flying all over the place, can anyone help? Please don't direct me to the PHP Manual or any other place as I have already checked.

Many thanks,
Dan


. Ross Honniball                  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia
. Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
. There are no problems. Only solutions.

--- End Message ---
--- Begin Message ---
When you use php you do not need to deal with cookies explicitely. Instead
use just php's sessions.
Set a session variable to the username after the password validation. When
logging out just set this session variable to "".  (Or, in a more
object-oriented manner, create an user object after validation, delete it
when logging out.)
Do not use cookies to store passwords. It may be unsecure since cookies are
sent forth and back all the time during a session.


"Daniel Anderson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
Hi, can anyone tell me how to clear a cookie when the line comes up?
Because the following: setcookie("name",""); does work yes, but not well
enough.
I need it to remove that cookie there and then.

For example:

You go through a login process to access a page, it sets a cookie with
username and password so it registers you as being logged in.

When you click a link which directs you to a logout page, it will clear the
cookie.

This is all well and good but if you retype the url to get back to the page,
e.g. http://server/main/ it will still state that you have logged in.

This seems to be flying all over the place, can anyone help? Please don't
direct me to the PHP Manual or any other place as I have already checked.

Many thanks,
Dan

--- End Message ---
--- Begin Message ---
Hi,

can anyone recommend which of these is better for loading and updating one row at a 
time in a MySQL database?

for()
foreach()
while()
if...then()

other...?

What I am trying to do is make a PHP code open a table in a MySQL database, then it 
loads the information needed like Column 1 and Column 2 for example.


Such as:

Column 1 has 20 in one row and 15 in the next, Column 2 has 0 in both rows.

What I got it to do is to subtract one value from Column 1 and add a value to Column 2.

So after running this script once, it will end up as Column 1 having 19 for the first 
row and 14 for the row below it. And both rows in Column 2 having 1 in each.

The problem starts when I try updating the database, rather than saving one at a time 
in each database it will replace all other rows with the first one loaded. So instead 
of row 2 having 14 it will have the same as the first row, which is 19.


Thanks to Ross and hubo for the cookie advice, I have managed to get it working fine.

If you can recommend anything that can get my one step closer to getting this script 
to parse successfully then it will be a great help,

Many thanks again,

Dan

--- End Message ---

Reply via email to