Autor Tema: Iframe o Redirección dependiento de un $_GET  (Leído 1798 veces)

Desconectado Murru

  • PHPerit@
  • *
  • Mensajes: 15
  • Karma: 0
  • @EduMurru
    • Ver Perfil
    • Juegos Flash Online Gratis
Iframe o Redirección dependiento de un $_GET
« en: 21 de Noviembre de 2011, 23:14:50 pm »


Iframe Esto crearía un iframe, dependiendo de lo que pongas en la dirección.
Ejemplo: Si pones http://ejemplo.com/iframe.php?u=www.google.com , en los sitios donde aparece <?php echo $_GET['u'] ?> , serán cambiados por www.google.com
Hay un fallo, no puedes poner ?u=http://google.es , porque si no el iframe iría a http://http://google.es

Código: [Seleccionar]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ANSI"><title>Iframe - <?php echo $_GET[&#39;u&#39;] ?></title>
</head>
<iframe id="frame" src="http://<?php echo $_GET[&#39;u&#39;] ?>" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe>
<script type="text/javascript">
function resizeIframe() {
    var height = document.documentElement.clientHeight;
    height -= document.getElementById('frame').offsetTop;

    // not sure how to get this dynamically
    height -= 30; /* whatever you set your body bottom margin/padding to be */

    document.getElementById('frame').style.height = height  "px";
};
document.getElementById('frame').onload = resizeIframe;
window.onresize = resizeIframe;
</script>
Vista Previa: http://bluecube.es/codigo/iframe.php?u=www.nomojuegos.es



Redirección Simplemente, redirigir en X segundos a una web.
Ejemplo: Si pones http://ejemplo.com/r.php?u=www.google.com , en los sitios donde aparece <?php echo $_GET['u'] ?> , serán cambiados por www.google.com
No puedes poner ?u=http://google.es , porque haría redirección a http://http://google.es

Código: [Seleccionar]
<?php
$segundos 
5//Numero de Segundos en redirigir
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="Refresh" CONTENT="<?php echo $segundos ?>; URL=http://<?php echo $_GET[&#39;u&#39;] ?>">
<meta http-equiv="content-type" content="text/html; charset=ANSI"><title>Redirigiendo - <?php echo $_GET[&#39;u&#39;] ?></title>
</head>
Estás siendo redirigido a <?php echo $_GET[&#39;u&#39;] ?> en <?php echo $segundos ?> segundos.
Vista Previa: http://bluecube.es/codigo/r.php?u=www.nomojuegos.es


Fuente: http://www.bluecube.es/home/?p=30

Comunidad PHPeros

Iframe o Redirección dependiento de un $_GET
« en: 21 de Noviembre de 2011, 23:14:50 pm »