SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Addict eanimator's Avatar
    Join Date
    Sep 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CApturing the complete URL

    Hello,

    I want to know how can I set exact URL such as:

    http://www.mydomain.com/home/control...?varId=123_abc

    I wish to use it then for the redirection purposes.

    Please note: $_SERVER['HTTP_REFERER'] will not work.

    Awaiting a response.

    Thanks.

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    URL of what?

  3. #3
    SitePoint Addict eanimator's Avatar
    Join Date
    Sep 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.mydomain.com/home/control...?varId=123_abc << this one

    I tried. but not been able to fetch Query string.

  4. #4
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still don’t understand. Where does the URL come from? Or where is it supposed to come from?

  5. #5
    Non-Member
    Join Date
    May 2009
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you referring to setting it up in the .htaccess file for a 301 redirect or doing some sort of mod rewrite?

  6. #6
    SitePoint Addict eanimator's Avatar
    Join Date
    Sep 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See..

    my site has user restricted area:

    1. View orders
    user tried to view his/her order but he/she not loggen in so php script will redirects to login.

    at login page, I want to save a URL from where user came to login.php

    hope its clear to you now ?? Please confirm

  7. #7
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    header('Location: /login.php?goto=' urlencode($_SERVER['REQUEST_URI'])); 
    And then, upon succesfull login:

    PHP Code:
    header('Location: ' $_GET['goto']); 
    Of course you may want to verify the $_GET['goto'] value.

  8. #8

  9. #9
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something’s not right then because REQUEST_URI includes should include the query string. Post some code.

  10. #10
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try putting print_r($_SERVER); into the page and see what comes up


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
  •