Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Setting up HTTP/HTTPS Variable in PHP

  1. #1
    Zash's Avatar
    Zash is offline WiredStorm.com - Lightning Fast Web Hosting
    Join Date
    Feb 2009
    Location
    New York, USA
    Posts
    1,137
    Blog Entries
    1
    Thanks
    64
    Thanked 121 Times in 93 Posts

    Setting up HTTP/HTTPS Variable in PHP

    Hey,

    I'm setting up SSL on my proxy. I want an infobar at the top of my page to show 'You have SSL enabled' and 'You have SSL Disabled'.

    I want an If..Else statement, but then I need a variable to determine whether the protocol is http or https. I'm not sure how.

    MySpace Proxy | MySpace Proxy Site | Proxy Site for MySpace and Youtube has it set up so that the text changes. I want it like this.

    Thanks for any help
    WiredStorm Hosting Solutions
    █ Lightning Fast Shared and Reseller Hosting
    █ cPanel with Softaculous and 24/7 Email (Ticket) Support
    Biodegradable Sunscreen - Unblock Facebook

  2. #2
    Mr.Bill's Avatar
    Mr.Bill is offline One is glad to be of service
    Join Date
    Dec 2008
    Location
    Redmond, Oregon
    Posts
    828
    Blog Entries
    1
    Thanks
    72
    Thanked 350 Times in 182 Posts
    This is an easy one for me to answer since its my site

    PHP Code:
    <?php
    if ($_SERVER['HTTPS'] == 'on')
    {
      echo 
    '<a class="right" href="http://www.example.com/">
    <span>Turn Off SSL</span></a>'
    ;
    }
    else
    {
      echo 
    '<a class="right" href="https://www.example.com/">
    <span>Turn On SSL</span></a>'
    ;
    }
    ?>
    Good luck with your sites.

    Reverse IP Check ಠ_ಠ Proxy Sites
    <?php if ($youask == 'stupid question') { echo ('stupid answer'); } ?>

  3. #3
    Zash's Avatar
    Zash is offline WiredStorm.com - Lightning Fast Web Hosting
    Join Date
    Feb 2009
    Location
    New York, USA
    Posts
    1,137
    Blog Entries
    1
    Thanks
    64
    Thanked 121 Times in 93 Posts
    Hey thanks a lot

    I'm just curious, is there really a benefit you've noticed to having SSL over no SSL?
    WiredStorm Hosting Solutions
    █ Lightning Fast Shared and Reseller Hosting
    █ cPanel with Softaculous and 24/7 Email (Ticket) Support
    Biodegradable Sunscreen - Unblock Facebook

  4. #4
    Mr.Bill's Avatar
    Mr.Bill is offline One is glad to be of service
    Join Date
    Dec 2008
    Location
    Redmond, Oregon
    Posts
    828
    Blog Entries
    1
    Thanks
    72
    Thanked 350 Times in 182 Posts
    Uses a lot more resources then before a lot seem to favor the ssl over the non. Not a lot of ssl proxies out there so its a nice service to offer.

    Would also suggest wrapping that around the adsense ads so they dont get the security warning about the ads not being secure.

    Reverse IP Check ಠ_ಠ Proxy Sites
    <?php if ($youask == 'stupid question') { echo ('stupid answer'); } ?>

  5. #5
    Zash's Avatar
    Zash is offline WiredStorm.com - Lightning Fast Web Hosting
    Join Date
    Feb 2009
    Location
    New York, USA
    Posts
    1,137
    Blog Entries
    1
    Thanks
    64
    Thanked 121 Times in 93 Posts
    What exactly should I put here?

    PHP Code:
    <?php
    if ($_SERVER['HTTPS'] == 'on')
    {
      echo 
    '??????';
    }
    else
    {
      echo 
    'ADSENSE CODE';
    }
    ?>
    WiredStorm Hosting Solutions
    █ Lightning Fast Shared and Reseller Hosting
    █ cPanel with Softaculous and 24/7 Email (Ticket) Support
    Biodegradable Sunscreen - Unblock Facebook

  6. #6
    Mr.Bill's Avatar
    Mr.Bill is offline One is glad to be of service
    Join Date
    Dec 2008
    Location
    Redmond, Oregon
    Posts
    828
    Blog Entries
    1
    Thanks
    72
    Thanked 350 Times in 182 Posts
    PHP Code:
     <?php
    if ($_SERVER['HTTPS'] == 'on')
    {
      echo 
    '';
    }
    else
    {
      echo 
    'ADSENSE CODE';
    }
    ?>
    Will work. Might ad some other offers in a test form in the blank echo. Just to fill the area or other content. Even though I did not do this it doesnt seem to bother people as it triggers on the proxified pages also so might not be worth the hassle to do it

    Reverse IP Check ಠ_ಠ Proxy Sites
    <?php if ($youask == 'stupid question') { echo ('stupid answer'); } ?>

  7. #7
    Zash's Avatar
    Zash is offline WiredStorm.com - Lightning Fast Web Hosting
    Join Date
    Feb 2009
    Location
    New York, USA
    Posts
    1,137
    Blog Entries
    1
    Thanks
    64
    Thanked 121 Times in 93 Posts
    I think I'll just leave the Ads as is. It appears to be working fine, and I don't really have any content to fill instead.

    Thanks a lot for your help anyways The SSL is up at http://www.guardtunnel.com
    WiredStorm Hosting Solutions
    █ Lightning Fast Shared and Reseller Hosting
    █ cPanel with Softaculous and 24/7 Email (Ticket) Support
    Biodegradable Sunscreen - Unblock Facebook

  8. #8
    Keldorn's Avatar
    Keldorn is offline Net Builder
    Join Date
    Dec 2008
    Location
    Canada
    Posts
    400
    Thanks
    21
    Thanked 60 Times in 52 Posts
    Quote Originally Posted by Mr.Bill View Post
    Will work. Might ad some other offers in a test form in the blank echo..

    This would be my method of doing it. Switch statements are more easy to read and maintain.

    PHP Code:
    <?php

       
    switch($_SERVER['HTTPS']) {
        
    //returned true, stop on this case
          
    case true:
             echo 
    "Yes this is ssl";
          break;
         
    //Returned Empty. Stop on default.
         
    default:
             echo 
    "not ssl";
          break;
        }
    ?>
    Submit new proxies -

  9. #9
    SeriousBiz's Avatar
    SeriousBiz is offline Newbie Net Builder
    Join Date
    Jul 2009
    Location
    Spain
    Posts
    57
    Thanks
    2
    Thanked 8 Times in 7 Posts
    Quote Originally Posted by dollar View Post
    This would be my method of doing it. Switch statements are more easy to read and maintain.

    PHP Code:
    <?php

       
    switch($_SERVER['HTTPS']) {
        
    //returned true, stop on this case
          
    case true:
             echo 
    "Yes this is ssl";
          break;
         
    //Returned Empty. Stop on default.
         
    default:
             echo 
    "not ssl";
          break;
        }
    ?>
    But they're slower
    Free Male Enhancement Pills Affiliate Program for Webmasters and Internet Marketers
    $25/$30 per free trial. Converts like crazy, even on untargeted traffic (it does for me ).

  10. #10
    Keldorn's Avatar
    Keldorn is offline Net Builder
    Join Date
    Dec 2008
    Location
    Canada
    Posts
    400
    Thanks
    21
    Thanked 60 Times in 52 Posts
    Quote Originally Posted by SeriousBiz View Post
    But they're slower
    Do you have benchmark proof? I dont think they are.
    Submit new proxies -

Page 1 of 2 12 LastLast

Similar Threads

  1. Goal Setting
    By Charles in forum Freelancing
    Replies: 24
    Last Post: 9 October, 2011, 01:49 AM
  2. [Free] setting up SB accounts
    By lugaw in forum Services
    Replies: 0
    Last Post: 6 January, 2011, 13:23 PM
  3. Replies: 7
    Last Post: 29 November, 2009, 09:07 AM
  4. Replies: 12
    Last Post: 27 August, 2009, 06:58 AM
  5. What is the main difference between http and https?
    By hendricius in forum Building
    Replies: 2
    Last Post: 22 July, 2009, 20:04 PM

Tags for this Thread

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
  •