SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Location
    Ljubljana
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using the active protocol

    Hello,

    I've been wondering how its possible to make a link to other domain with the current active protocol?

    For instance:

    Users comes to mywebsite.com and he posts a form:
    1. he is on http://mywebsite.com so form should post
    http://someotherdomain.com

    2. he is on https://mywebsite.com (SSL) so form should post to
    https://someotherdomain.com


    Is there any way to set form post action to "://someotherdomain.com" so that browser would automatically use the current used protocol (http or https) accordingly?

    Thanks for help
    Get RankTrackr 2.0: Rank Tracker | PopStrap

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,656
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Kundi,

    I believe that this is a PHP question ...

    ... where I would have the form's script fetch Apache's {HTTPS} variable OR {SERVER_PORT} variable (using $_SERVER['HTTPS'] or $_SERVER['SERVER_PORT']) and test for on/null or 80/443 and add the "s" to http in the action accordingly.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •