Solved

Check for SSL

Posted on 2013-02-05
3
186 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now