Results 1 to 4 of 4

Thread: PHP weakness??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245

    Angry 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..

  2. #2
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    Re: PHP weakness??

    Quote 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.
    ?
    'What's this bit for anyway?
    For Jono

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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']); 
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245

    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
  •  



Click Here to Expand Forum to Full Width