SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Encrypt string for passing between pages

    Hi, I need to encryped an ID number to pass it between two pages.

    For example, I have this link on the first page.

    [a href=""http://www.whatever.com/page2.phtml?id=encrypted_id]Click here for page 2[/a]

    Then on page2.phtml I need to be able to decrypt the $id variable number and use it for a lookup.

    The built in crypt() function in PHP wont work because I can't decrypt it on the next page.

    Any ideas?

    Thanks for your time!

  2. #2
    Ceci n'est pas Zoef Zoef's Avatar
    Join Date
    Nov 2002
    Location
    Malta
    Posts
    1,111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could I ask why you would want to do that? I'm sure you have a good reason, I'm just curious .

    Rik
    English tea - Italian coffee - Maltese wine - Belgian beer - French Cognac

  3. #3
    SitePoint Zealot LiamW's Avatar
    Join Date
    Mar 2003
    Location
    Hamilton, Ontario
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    www.php.net/urlencode

    You might want to look into using sessions

    www.php.net/session

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I'd add my voice for sessions.
    John

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys..thanks for replying..I found something like I needed base64_encode(). I have been looking for quite awhile at quite a lot of resources and only ran across this ones..but its just what I needed.

  6. #6
    SitePoint Zealot
    Join Date
    Dec 2001
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it's not. Anyone could base64_decode() the string you are passing and grab the ID. It's terribly insecure and not designed for that usage.

    I too would lend my voice to using sessions and, depending on how sensitive the data is, SSL. Although I am also curious as to why you need to pass this sensitive information across pages at all.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •