Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/04/2012, 08:09
Avatar de ahaugas
ahaugas
 
Fecha de Ingreso: agosto-2011
Ubicación: Madrid
Mensajes: 249
Antigüedad: 12 años, 9 meses
Puntos: 21
Respuesta: Pasar de http a https

pues sencillo

Código PHP:
Ver original
  1. <?php
  2.     class websiteHttps {
  3.        
  4.         function website_Https() {
  5.             global $website_https,$loggedInUser;
  6.             $this->https                    = $website_https;
  7.             $this->host                     = htmlentities($_SERVER["HTTP_HOST"]);
  8.             $this->url                      = htmlentities($_SERVER["REQUEST_URI"]);
  9.            
  10.            
  11.             //Verify if user session start and check https protocol
  12.             //if https protocol in server redirect to secure protocol
  13.             //if not https protocol change headers age
  14.            
  15.             if(!isUserLoggedIn()) { } else {
  16.             if ($this->https  && isset($_SERVER["HTTPS"])){
  17.               header("Strict-Transport-Security: max-age=500");
  18.                 } elseif ($this->https  && !isset($_SERVER["HTTPS"])){
  19.               header("Status-Code: 301");
  20.               header("Location: https://".$this->host.$this->url);
  21.                 }
  22.             }
  23.         }
  24.     }
  25. ?>

y lo llamas asi en donde lo quieras tener https

Código PHP:
Ver original
  1. //HTTP Strict Transport Security
  2.     $websiteHttpsSec = new websiteHttps();
  3.     $websiteHttpsSec->website_Https();

espero que sea esto y suerte