SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post how do i encode url

    Hi, can i ask how can i encode paramters in the url,because i am passing variables to other page and i want that the url will encoded or the value of paramter ,.i am using window.open.


    Thank you in advance.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi jemz,

    depending on what you are trying to achieve you will want either encodeURI() or encodeURIComponent()

    See also: http://stackoverflow.com/questions/7...deuricomponent

  3. #3
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi pullo,

    Thank you for the reply...so this is intended only for the query string as for encodeURI and encodeURIComponent?...but how can i encode if i have this kind of parameter

    page.php?empid=4
    now i don't want the user know the empid is 4,is it possible to do some hash something like this

    index.php?empid=%72566363363663d&
    because i am afraid that if the user will change the url or something like he will guess and change this to no. 5 or any no... the new page will load and some information will be seen.

    can you help me on this please.

    Thank you

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi jemz,

    Quote Originally Posted by jemz View Post
    because i am afraid that if the user will change the url or something like he will guess and change this to no. 5 or any no... the new page will load and some information will be seen.
    Then you need some kind of authentication system in place.
    A user should not be able to get at sensitive information by guessing a url.
    Simple as that, I'm afraid.

  5. #5
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you pullo


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
  •