Solved

Check for SSL

Posted on 2013-02-05
3
190 Views
Last Modified: 2013-02-10
This is not working - can't figure out why.
If I try to change the header, I get an error.
If I try to echo the server variables, I get an error.

<?php
if($_SERVER["HTTPS"] != "on" || $_SERVER["SERVER_PORT"] != "443") {
?>
    <script type="text/javascript">
      document.forms[0].action="https://www.xxxxxxxx.com/order.php";
      document.forms[0].submit();
    </script>
<?php
}
?>

and I tried this - no alert!

<script type="text/javascript">
var sValue = <?php $_SERVER["HTTPS"] ?>;
alert(sValue);
</script>  

It's out on 123ehost, so I can't set or control a lot of things.
0
Comment
Question by:dcass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Assisted Solution

by:asavah
asavah earned 500 total points
ID: 38855960
0
 

Accepted Solution

by:
dcass earned 0 total points
ID: 38855985
Don't think that will work here, but
<?php
$port = $_SERVER["SERVER_PORT"];    
if($port != "443") {
?>
    <script type="text/javascript">
      document.forms[0].action="https://www.xxxxxxxxx.com/Order.php";
      document.forms[0].submit();
    </script>
<?php
}
 
did work.  It wasn't setting https at all.
0
 

Author Closing Comment

by:dcass
ID: 38872778
I didn't try your solution asavah, but I appreciate your fast response!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What is define("__APPROOT__", __DIR__); 6 30
Two decimal 5 27
blocking the posted data from outside of my domains 8 21
PHP $_POST vs asp request 4 24
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question