Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/04/2012, 15:49
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Verificar en un Iframe la URL de donde es puesto visto

a.html (url completa: http://emprear.dnsd.info/a.html )

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <title>titulo</title>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. </head>
  6. <iframe src="b.php" name="marco"></iframe>
  7. </body>
  8. </html>

b.php

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>titulo</title>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  7. </head>
  8. <body>
  9. <p>Javascript; <br />
  10. <script type="text/javascript">
  11. //<![CDATA[
  12. /* script */
  13. var ref = document.referrer;
  14. document.write(ref);
  15. //]]>
  16. </script>
  17. </p>
  18.  
  19. <p>Php:<br />
  20.    
  21. <?php
  22. $ref = $_SERVER['HTTP_REFERER'];
  23. $ok = "http://emprear.dnsd.info/a.html";
  24. if(($ref == "")||($ref != $ok)){
  25.     echo "error";
  26. }
  27. ?> 
  28.    
  29. </p>
  30. </body>
  31. </html>

Siempre es más seguro hacerlo con php, ya que el cliente puede deshabilitar javascript
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.