|
-
Sep 26th, 2005, 12:10 AM
#1
Thread Starter
Addicted Member
PHP weakness??
i've done everything but still no success.. i have a link named temp and i just want to pass the links name to a textfield from another page.. is it really hard or impossible to do this? it makes me NUTS!!!!!!!!!
anyone nice enough to teach me or at least a link on how to this or alternative as long as i can pass values from one page to another.. please do reply.. i get depressed everytime i get stuck..
thanks..
-
Sep 26th, 2005, 04:22 AM
#2
Fanatic Member
Re: PHP weakness??
 Originally Posted by titan7262
...pass values from one page to another..
This I can tell you about.
When the page has finnished being worked on by the PHP engine it is forgotten about there for you must pass your data out to a digital third eliment to be able to use it.
There are four ways (that I can think of) to allow a string or other value to move from page to page.
1: GET: Make your link thenewpage.php?firstval=value&secondval=value2&val3=something
this can then be read by the next page.
The weakness is that any user can alter the values that call the page but you do get to see them all. Limit total 255 char I understand
2: POST: make all your values hidden values in a form and submit them with GET problem is that refreshing pages etc will cause page has expired messages and requests to resend the data.
3: Use Cookies and make the user store the data for themselves.
4: Use a database and store all the values temporarily with in the table against a randomly generated key or MD5 hash of the current time + session Id or something. You will still need to use one of the first three methods to pass the key but the users will not be able to tamper with the data. Hotmail uses session cookies and GET
Number 1 is simplist but doesn't allow for masses of data and number 4 is most secure.
The alternative is to create a big database and force the users to make aco****s and store all the data in their accounts... which is where 4 was heading anyway.
Does this help at all.
If not explain in more detail what you are doing and what you wish to achieve by doing it and I'm sure more help will be forthcoming.
-
Sep 26th, 2005, 02:45 PM
#3
Re: PHP weakness??
Another method is to use sessions. Sessions are handled by PHP and rather than have the information about the user (sometimes sensitive) transferred back and forth between the client and the server in the form of cookies, a session is stored on the server and identified by an ID either stored in a cookie or appended to the link.
In your situation, where you want to be able to pass a value to the server side script, I recommend you use the query string. You can construct a link as follows which when clicked can be accessed in your PHP script:
http://adam.codedv.com/examples/post_dump.php?temp=45
PHP Code:
echo ($_GET['temp']);
-
Sep 27th, 2005, 11:00 PM
#4
Thread Starter
Addicted Member
Re: PHP weakness??
Thanks for the reply.. i actually managed to finish my pages. i used $_POST[''] and $_GET[''] consecutively but with the help of if..elseif..else but i ma a noob at PHP and i don't know SESSIONS yet.. but em looking forward on doing some pages using next. Haven't got the time to read my posts but i think what you both posted would be needing a great amount of reading and understanding.. thanks again...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|