Foros del Web » Programando para Internet » Javascript » Frameworks JS »

hola alguien puede ayudarme, update

Estas en el tema de hola alguien puede ayudarme, update en el foro de Frameworks JS en Foros del Web. hola amigos tengo este codigo llamado tag.php, el cual necesito que este archivo (tag.php) se actualize cada x segundos, antes usaba <meta http-equiv="refresh" content="7"> pero ...
  #1 (permalink)  
Antiguo 22/09/2006, 10:22
 
Fecha de Ingreso: octubre-2005
Mensajes: 407
Antigüedad: 21 años
Puntos: 2
hola alguien puede ayudarme, update

hola amigos

tengo este codigo llamado tag.php, el cual necesito que este archivo (tag.php) se actualize cada x segundos, antes usaba

<meta http-equiv="refresh" content="7">

pero se nota cuando se refresca alguien puede ayudarme con ajax



Código PHP:
<?PHP


    
include("vars.php");
        
$klr = 0; $tag = 0;
        
$nick_name = explode(":",$nombre);
        
$npass = retorna($nick_name[1]);
        
$nombre = retorna($nick_name[0]);
        for (
$e = 1;$e <= count($nrs); $e++) {
            
$npx = explode(":",$nrs[$e]); $nick_name = retorna($npx[0]); $nick_pass = retorna($npx[1]);
            if (
strtolower($nombre) == strtolower($nick_name)) {
                if (
$npass != $nick_pass) {
                    
$nombre = $null; $tag = 0;
                        if (
$sms) {
                            echo 
"<SPAN CLASS=\"avs\">$msg[32]<BR><BR><A HREF=\"tag.php\">$msg[15]</A></SPAN><BR>";
                        }
    if (
$nombre) {
        
setCookie("tagb_nck",$nombre,time()+1296000,"/","");
        
setCookie("tagb_url",$url,time()+1296000,"/","");
    }
                exit;
                }
            }
    
        }




?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.1 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="Description" CONTENT="Tag">
<META NAME="Author" CONTENT="atomik">
<META NAME="Generator" CONTENT="Tag<?PHP echo "$msg[1]" ?>">

[COLOR="Red"]<meta http-equiv="refresh" content="7"> [/COLOR]


<span onmousedown='return false'; oncontextmenu='return false;' ondragstart='return false';>
<script>
document.onselectstart=new Function ('return false');
</script>





<?PHP
if (!($cst)) {
    echo 
"<LINK REL=\"stylesheet\" TYPE=\"text/css\" MEDIA=\"all\" HREF=\"$css\">\n";
} else {
    echo 
"<STYLE>\n"; include("$css"); echo "\n</STYLE>\n";
}
?>
<TITLE>holaaaaa</TITLE>


</HEAD>
<BODY LEFTMARGIN="0" RIGTHMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="125" BORDER="0" >
<?PHP 
#FUNCIONES
    
function retorna($datos) {
        return 
$datos;
    }
    function 
html_bloq($datos) {
        
$datos = str_replace("<","<",$datos);
        
$datos = str_replace(">",">",$datos);
        
$datos = trim($datos);
        return 
$datos;
    }
    function 
izq($cadena, $numero) {
        return 
substr($cadena, 0, $numero);
    }

#CONEXIÓN AL SERVIDOR SQL
    
$cnx = mysql_connect($hst, $usr, $pwd) or die("$msg[16]"); 

#SELECCIÓN DE LA BASE DE DATOS:
    
$sdb = mysql_select_db("$dbe") or die("$msg[17]");

#OPCIONES
    
if (strlen($nombre) >= $lmn) { $nombre = izq($nombre,$lmn); }
    if (
strlen($url) >= $lmu) { $url = izq($url,$lmu); }
    if (
strlen($texto) >= $lmm) { $texto = izq($texto,$lmm); }

#INSERCIÓN DE DATOS EN LA TABLA:
    
if (($nombre != $null) && ($texto != $null)) {
            
$qry2 = "SELECT id, nombre, url, mensaje, ip FROM $tbl ORDER BY id ASC"; 
            
$res2 = mysql_query($qry2) or die("$msg[19]: $qry"); 
            
$ttl = 0;
            while (
$row = mysql_fetch_row($res2)) { 
                if (
$cmz == $null) { $cmz = $row[0]; }
            
$b_txt = $row[3];
            
$ttl++;
            }
        
$ttl++;
        
$lmt++;
        if (
$ttl == $lmt) {
            
$qry = "DELETE FROM $tbl where id = '$cmz' LIMIT 1";
            
$res = mysql_query($qry) or die("$msg[19]: $qry"); 
        }
        
$ip = $_SERVER['REMOTE_ADDR'];
        
$fecha = gmdate("$fch", time()); $fecha = "$fecha (GMT)";
        
$qry = "SELECT deny FROM $tdn WHERE ip = '$ip'";
        
$res = mysql_query($qry) or die("$msg[19]: $qry");
        while (
$row = mysql_fetch_row($res)) { $dny = $row[0]; }
        if ((
$dny == 1) && ($sms == 1)) { echo "<SPAN CLASS=\"avs\">$msg[4]</SPAN><BR>"; }
            if ((
$b_txt != $texto) && ($dny == 0)) {
                
$qry = "INSERT INTO $tbl (url,nombre,mensaje,ip,fecha) VALUES('$url','$nombre','$texto','$ip','$fecha')"; 
                
$res = mysql_query($qry) or die("$msg[18]");
            }
    }

#GENERAR HTML:    
    
$_pagi_sql = "SELECT id, nombre, url, mensaje, fecha FROM $tbl ORDER BY id DESC"; 
    
    
$_pagi_cuantos = 30;
    
$_pagi_nav_num_enlaces = 5;
    
    include(
"paginator.inc.php");

    
$ttl = 0;
    
$cnt = 0;
    while (
$row = mysql_fetch_row($_pagi_result)) { 
        echo 
"<TR>\n";
        if (!(
$cnt)) { echo "<TD CLASS=\"td1\" width='125'>"; $tnt = 1;} else { echo "<TD CLASS=\"td2\">"; $tnt = 0; }
        
$cnt = $tnt;
        
$texto = $row[3];
        
$url = $row[2];
        
$nombre = $row[1];

    


    
$arr_plb = explode(" ",$texto);
        
$num_arr = count($arr_plb);
        
$texto = $null;
            for (
$i = 0; $i < $num_arr; $i++) {
                
$dpr = $arr_plb[$i];
                if ((
$enx) && eregi("www|http",$dpr)) { $dpr = "$pcu"; }
                    if (
$bil) {
                        for (
$e = 0;$e < count($fbd) + 1; $e++)
                            
$dpr = str_replace(strtolower($fbd[$e]),"$pco",strtolower($dpr));
                    }
                
$dpl = strlen($dpr);
                if ((
$dpl > $wwp) && ($uww == 1)) {
                    if (
$ssp) {
                        
$dpr = izq($dpr,$wwp-3);
                        
$dpr = "$dpr...";
                    } else {
                        
$dpr = wordwrap($dpr,$wwp,chr(13),1);
                    }
                }
                if ((!(
$enx)) && (izq($dpr,7) == "http://")) { $dpr = "<A HREF=\"$dpr\" TARGET=\"_blank\">$dpr</A>"; }
                
$texto = "$texto $dpr";
             }

    
    if (
$bml) {
            
$texto = html_bloq($texto);
            
$nombre = html_bloq($nombre);
            
$url = html_bloq($url);
            if (
strtolower(izq($url, 10)) == "javascript") { $url = $null;  }
            if (
strtolower(izq($url, 8)) == "vbscript") { $url = $null; }
            if (
strtolower(izq($url, 7)) == "jscript") { $url = $null; }
            if (
strtolower(izq($url, 3)) == "vbs") { $url = $null; }
            if (
strtolower(izq($url, 4)) == "www.") { $url = "http://$url"; }
            if (
eregi("@", $url)) { $url = "mailto:$url"; }
            
// if (eregi("\.\.\/", $url)) { $url = $null; }
        
}




if (
$sml) {




            
$texto = str_replace(":yes","<IMG SRC=\"$smd/yes.gif\" BORDER=\"0\">",$texto);


        }
        
$arr_plb = explode(" ",$texto);

    
$num_arr = count($arr_plb);
        
$texto = $null;
            for (
$i = 0; $i < $num_arr; $i++) {
                
$dpr = $arr_plb[$i];
                if ((
$enx) && eregi("www|http",$dpr)) { $dpr = "$pcu"; }
                    if (
$bil) {
                        for (
$e = 0;$e < count($fbd) + 1; $e++)
                            
$dpr = str_replace(strtolower($fbd[$e]),"$pco",strtolower($dpr));
                    }





    if ((!(
$enx)) && (izq($dpr,7) == "http://")) { $dpr = "<A HREF=\"$dpr\" TARGET=\"_blank\">$dpr</A>"; }
                
$texto = "$texto $dpr";
             }
        for (
$i = 1;$i <= count($nrs); $i++) {
            
$npx = explode(":",$nrs[$i]); $nick_name = retorna($npx[0]);
            if (
strtolower($nombre) == strtolower($nick_name)) { $klr = 1; }
        }
        if ((
$klr == 1) && ($amc == 1)) { $klr = "admin"; } else { $klr = "niq"; }
        if (
$irc) { $nombre = "<$nombre>"; }
        if ((
$url) && ($enn)) {
            echo 
"<SPAN CLASS=\"$klr\" TITLE=\"$row[4]\"><A HREF=\"$url\" TARGET=\"_blank\">$nombre:</A></SPAN><SPAN CLASS=\"msj\">$texto</SPAN>";
        }
        elseif ((
$url == $null) || ($enn == 0)) {
          echo 
"<SPAN CLASS=\"$klr\" TITLE=\"$row[4]\">$nombre:</SPAN><SPAN CLASS=\"msj\">$texto</SPAN>";
        }
        echo 
"</TD>";
        echo 
"</TR>\n";
        
$ttl++;
    }
    echo 
"</TABLE><CENTER><SPAN CLASS=\"des\">";
    echo
"$_pagi_navegacion<BR>";
    echo 
"<BR>$msg[3]: \"$_pagi_totalReg\"<BR>";
    
/**** echo "<A HREF=\"acceso.php\" TARGET=\"_blank\">$msg[2]</A></SPAN></CENTER>"; ****/

#CIERRE DE LA CONEXIÓN:
   
mysql_close($cnx);
include(
'online.php');
?>
</BODY>
</HTML>


graciasss
__________________
DJJJ
  #2 (permalink)  
Antiguo 22/09/2006, 12:17
 
Fecha de Ingreso: noviembre-2002
Ubicación: Mex
Mensajes: 140
Antigüedad: 23 años, 10 meses
Puntos: 0
claro, puedes leer en este foros el tema de autosalvar en ajax o bien leer el articulo en:

http://fuenteria.net/?p=52

salud
__________________
escribiendo mi libro de AJAX
  #3 (permalink)  
Antiguo 25/09/2006, 14:02
 
Fecha de Ingreso: septiembre-2006
Mensajes: 37
Antigüedad: 20 años, 1 mes
Puntos: 0
Tendrias que aprender de 0, cualquier ejemplo simple te servira.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:26.