php - How to use sessions in place of a querystring -
Using PHP .. I have a small app that I've created that is currently navigating data from a database And uses a query string to obtain data. The key in the database is also in the string and it is no longer acceptable. I need to change it. I would like to hide the DB key and would like to use a session instead, but I'm not sure how to do it. In fact, there are other variables in the query string which I would probably like to use for all sessions.
page.php? Var1 and var2 and id = 1
This is what my string looks like I am looping through the results in the database and giving each row the id so that when users click on the line they want But I am not sure how I can do this session.
Do anyone have any ideas?
Thanks
EDIT: I am developing an email type system where senders and recipients receive and are receiving mail. Each piece of mail stored on the server will have its own unique key. Currently, I am using that number to retrieve the message, but the problem is that I do not want people to change the number and match the others Will have to read. I could possibly use GUID for this or some kind of hash, but I really hate long query strings. I was just thinking that it would be very clean if there is a way to hide the ID together.
Renewed (again ... yes, I know.) < / P> The $ _GET parameter allows access to a particular group of data is more convenient for any user. Renew To store a private record key, you probably want to use post data, and if you really want to see it, you always have that link. You can use CSS for that. Honestly, the best way to stop people from reading others' mails is a relationship table, which says that only X person can use Wi-Fi ID). He or she is an area who tells you who is the 'owner' of the email. The fact is that users can still access the POST parameter, and easily create their POST parameters. This means that if someone knows the naming scheme, then anyone can actually use someone else's email. In an ideal system, one sender and one recipient (the recipient may have a comma separated value) Only one of those columns should be allowed to use email. How to use sessions (already) First start the session_start () before calling, and then after that Check script for variables If they are not present, then generate them. If they are, grab them and use them. Sessions are stored in the $ _SESSION array whenever you want to use $ _SESSION, you need to call session_start () FIRST And then you can assign anything to it or hold it. When you want to delete the data, call_destroy (); Call
session_start (); If ($ ($ _ session ['db_key'])) {$ _SESSION ['db_key'] = // generate the key of your database} and {$ db_key = $ _SESSION ['db_key']; }
Comments
Post a Comment