General discussion

Locked

Alternative to session variable, cookies

By mr.arvind.sharma ·
I want to know is there any other way to retain the information of a user without using session variables, cookies, querystring and hidden form fields in PHP i.e. is there any alternative to session variables, cookies, querystring and storing values in hidden form fields?

This conversation is currently closed to new comments.

13 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Kairoer In reply to Alternative to session va ...

Hi,
Sorry to tell you, as far as I know there are no alternatives if you want to retain user-information across link-clicks.
But - if you only have a very few, and preferably controlled (by IP) users, or you know their IP-address, you might use GLOBAL post variables posted by the browser at each page request as an identifier, and store the session data/information in a database. This works fine until you have lots of users, or several users are behind the same proxy, or until one user uses more than one window/tab to browse the site (this may /may not make a problem for you, depending on the information retained...)
Hope this helps :)

Kai

Collapse -

by mr.arvind.sharma In reply to

I know that I can store the information in the database or make a txt file and store the information relativ to each form and user that is possible if I have few users or what I can do is delete the records or files after a certain period of inactivity by a user. But I am looking for something else if its there.

Collapse -

by Jaqui In reply to Alternative to session va ...

simply put:
using these is a means of maintaining state in the stateless web environment.
even doing the database route mean having some means of identifying each user, before they "login" to be able to get the data about them stored in the db.

so, no, there is no way to completely avoid using one of these to maintain state.

the way to do so with ease of file removable is to work with the sessions, as after the session expires all session specific data is purged by default.

Collapse -

by mr.arvind.sharma In reply to

Thanks Jaqui for your answer.

Collapse -

by Kairoer In reply to Alternative to session va ...

May I ask you for more details about what you want to save across pageviews, how you want to use it and what is your server/script system?
If you try to explain in more details what you are trying to do, it might be easier for us to give you a better suited answer :)

Kai

Collapse -

by mr.arvind.sharma In reply to

Thanks Kairoer,
Suppose I am having 3-4 forms to gather the information from users. whenever a user fills a form and goes to next and then to next form and then comes back to first form I want to retain the information filled in by that user on all the forms filled in by the user.
I am using PHP, MySQL, Apache.

Collapse -

by apotheon In reply to Alternative to session va ...

You're out of options for keeping track of a client across multiple sessions.

PHP gets client data from
1. cookies
2. HTTP headers
3. URLs
4. GET and POST

The only other way to make that work is by way of IP or MAC address connection state. PHP doesn't allow any way to manage identification by MAC address: you'd have to use something else to do it. IP addresses can be handled by harvesting from HTTP headers, using the $REMOTE_ADDR environment valuable, but then you're just replicating the use of session data.

What the heck could be your reason for not using session data, cookies, query strings, or forms?

Collapse -

by HughPoynor In reply to Alternative to session va ...

There is always at least one more way to do anything. These suggestions are untried but seem obvious to me initially. 1. Have php get the user IP address on each page -- use the IP as a key to a mySQL record that holds the info you want to keep across pages, 2. ditto but without mySQL using fwrite() and fread() and your own little ISAM lookup.

Collapse -

by HughPoynor In reply to Alternative to session va ...

There is always at least one more way to do anything. These suggestions are untried but seem obvious to me initially. 1. Have php get the user IP address on each page -- use the IP as a key to a mySQL record that holds the info you want to keep across pages, 2. ditto but without mySQL using fwrite() and fread() and your own little ISAM lookup.

Collapse -

by mac1ne In reply to Alternative to session va ...

sorry I can't offer another solution, BUT I can warn you that using (what you think is) a user's IP addresses is NOT reliable....they can change across page requests, be faked / blocked, can be shared by multiple users coming from a proxy server, etc.

Back to Web Development Forum
13 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums