Ver Mensaje Individual
  #15 (permalink)  
Antiguo 04/06/2008, 15:43
wild3r
 
Fecha de Ingreso: junio-2008
Mensajes: 9
Antigüedad: 15 años, 11 meses
Puntos: 0
Respuesta: Pregunta sobre sobre error en codigo

Cita:
Iniciado por pateketrueke Ver Mensaje
bien, tuve que hacerlo....

Código PHP:
<?php

// YA ENTENDI!!!!
// ;)

/************************************************** ************************************
Originally from http://www.phpbuddy.com/article.php?id=8
Author: Ranjit Kumar (Cheif Editor phpbuddy.com)
Modified by: Ying Zhang (Dodo) http://pure-essence.net
Two main modifications:
1. To check currently saved screen resolution cookie
2. To allow inclusion by other php files

In order to use this file in another php file, use:

$callget_res_page_name = $REQUEST_URI;
$GLOBALS[callget_res_page_name] = $callget_res_page_name;
include("get_resolution.php");
echo $screen_width." is your screen width and ".$screen_height." is your screen height.";

// JUSTO ARRIBA dice esto....

para usar este archivo en otro archivo, usa:

- declara la variable $call_Get_res_page_name con REQUEST_URI yo como, tengo
register_globals OFF entonces... es por medio de $_SERVER

- incluye el archivo get_resolution.php

y ya obtienes la resolucion por medio de $screen_width y $screen_height

---------------------------------- y luego....

- tambien habia comentado que las comillas son necesarias como llaves de cualquier arreglo

- luego, gracias a que tengo short_open_tag OFF tuve que reemplazar <? por <?php y los <?= por <?php echo
asi como sus faltantes punto-y-comas y otros caracteres de expresión...

- cambie $HTTP_COOKIE_VARS por $_COOKIE

.......... ya lo probe en mi servidor local y si, funciona... gracias!

************************************************** ***************************************/

$callget_res_page_name $_SERVER['REQUEST_URI']; // $_SERVER
$GLOBALS['callget_res_page_name'] = $callget_res_page_name// comillas !!!
?>



<script language="javascript">
<!--
function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_res="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
if (document.cookie){
location = '<?php echo $GLOBALS['callget_res_page_name']; ?>';
}

}


function checkRes(width, height) {
if(width != screen.width || height != screen.height) {
writeCookie();
} else {
return true;
}
}
//-->
</script>

<?php
if(isset($_COOKIE["users_res"])) {
$screen_res $_COOKIE["users_res"];
$screen_res_tmp explode("x"$screen_res);
$screen_width $screen_res_tmp[0];
$screen_height $screen_res_tmp[1];
?>
<script language="javascript">
<!--
checkRes(<?php echo $screen_width?><?php echo $screen_height?>);
//-->
</script>
<?php
}
else 
//means cookie is not found set it using Javascript
{
?>
<script language="javascript">
<!--
writeCookie();
//-->
</script>
<?php
}


// tal y como dice en los comentarios...
//
echo $screen_width." is your screen width and ".$screen_height." is your screen height.";
?>
Muchisimas gracias!! Ahora si funciona!!!