acepto todo tipo de ayuda
una disculpa. es q no se aun utilizar bien el foro.
este es mi codigo
Código:
necesito ayuda, pues es para mi trabajo y ya me lo piden.<?php //mantiene sesion activa session_start(); ?> <!-- conexion a la base de datos --> <?php require("ClaseBaseDatos.php"); $usuario = new Servidor_Base_Datos(); ?> <html> <head> <script language="javascript" type="text/javascript"> function datos(u, s, p, st, h)//funcion para abrir la pagina en PopUp { var usu=u;//envia usuario var ser=s;//envia idserver var pol=p;//envia nombre_job var sta=st;//envia status var h_e=h;//envia hora de ejecucion var popup=window.open(("formulario.php?policy="+pol+"&server="+ser+"&user="+usu+"&status="+sta+"&h_eje="+h_e),"popup","width=400,height=400,directories=no, menubar =no,status=no,toolbar=no,location=no,scrollbars=no,fullscreen=yes"); } </script> <link rel="STYLESHEET" type="text/css" href="Hoja_Estilo.css"> </head> <body> <table width="100%" border="0"> <tr> <th height="102" colspan="3" scope="col"> <h1>B i e n v e n i d o</h1></th> <th width="16%" scope="col"> <img src="t_systems-trans.png" height="100" width="117"></th> </tr> <tr> <td colspan="3"> <div class="titulo">Datos Del Usuario</div> </td> <td width="16%"> <table border="0" width="100%" height="100%"> <tr> <td align="center" class="fecha"> <?php $fecha = date("Y-m-d"); echo $fecha; ?> </td></tr> <tr> <td align="center" class="fecha"><?php echo $hora=date ( "G:i:00" ); ?> </td></tr> </table> </td> </tr> <tr bgcolor="#CC66CC" bordercolor="#CCCCCC"> <td width="38%"><div class="parrafo">Nombre</div></td> <td width="23%"><div class="parrafo">Rol</div></td> <td width="23%"><div class="parrafo">Turno</div></td> <td><div class="parrafo">WiW</div></td> </tr> <?php //obtener usuario y password $us=$_SESSION["mysessionvar"]; $buscar="SELECT * FROM usuario WHERE(wiw='$us')"; $usuario->consulta($buscar); $dob=$usuario->contarRenglones(); echo "<tr bordercolor=#333333>"; if($dob==1)//si existe el registro con la informacion.... { echo "<input type='hidden' name='user' value='$user'>"; $filas=$usuario->extraer_renglon(); echo "<td><div class=parrafo>".$filas[2]." ".$filas[3]."</div></td>";//muestra nombre y apellido echo "<td><div class=parrafo>".$filas[5]."</div></td>";//muestra rol echo "<td><div class=parrafo>".$filas[4]."</div></td>";//muestra Turno echo "<td><div class=parrafo><input type=hidden name=user value=$user>".$filas[0]."</div></td>"; $turno=$filas[4];//salva el turno en la variable $turno } echo "</tr>"; ?> <form name="formselec" action="regservidor.php" method="POST"> <?php if ($turno=="Vespertino" || $turno=="Matutino")//si el turno es Matutino O Vespertino { $recupera="SELECT p.id_policy, p.servers_servidor,p.nombre_job,p.hora FROM policy p, servers s, usuario u WHERE(p.servers_servidor=s.servidor AND (p.hora >=u.hraent AND p.hora < u.hrasal)) ORDER BY p.hora"; } else if($turno=="Nocturno") { $recupera="SELECT p.id_policy, p.servers_servidor,p.nombre_job,p.hora FROM policy p, servers s, usuario u WHERE((p.servers_servidor=s.servidor) AND (u.wiw='$user') AND (p.hora >= u.hraent OR p.hora <= u.hrasal) ) ORDER BY p.hora Desc"; } $usuario->consulta($recupera); $numren=$usuario->contarRenglones(); if ($numren==0) { echo "la base de datos está vacia"; exit; } else { ?> <table border="0" align="center" width="100%" height="12%"> <tr bgcolor="#FF99CC"><td height="25" class="parrafo" div>#</td> <td div class="parrafo">Servidor</td><td div class="parrafo">Nombre_Job</td> <td div class="parrafo">Hora</td><td div class="parrafo">Enviar</td></tr> <?php $cont=1; while ($fila = $usuario->extraer_registros() ) { $colorfil=$cont%2; if($colorfil!=0){ echo "<tr bgcolor=#F5A9F2>";} else {echo "<tr bgcolor=#FFCCFF>";} ?> <td height="21" class="letras"><?php echo $cont; ?></td> <td><?php echo $se=$fila["servers_servidor"];?></td> <td><?php echo $po=$fila["nombre_job"];?></td> <td><?php echo $he=$fila["hora"];?></td> <td align="justify"> <input type="radio" name="rd1" onClick="<?php $usuario->registrar_backup($us, $se, $po, $he, 'S', '', ''); ?>"/>S <input type="radio" name="rd1" onClick="javascript:datos('<?php echo $us;?>','<?php echo $se;?>','<?php echo $po;?>','<?php echo $st='F';?>','<?php echo $he;?>')"/>F<br> <input type="radio" name="rd1" onClick="<?php $usuario->registrar_backup($us, $se, $po, $he, 'R', '', ''); ?>"/>R <input type="radio" name="rd1" onClick="<?php $usuario->registrar_backup($us, $se, $po, $he, 'Q', '', ''); ?>"/>Q </td> <?php $cont++; } ?> <?php } ?> </tr> </table> </form> </body> </html>
y esta es mi funcion
Código:
public function registrar_backup($us, $se, $po, $st, $he, $in, $de) { $usu=$us; $ser=$se; $pol=$po; $sta=$st; $hej=$he; $inc=$in; $det=$de; $repetido="SELECT * FROM logserver WHERE (id_policy='$policy' AND id_server='$server' AND fecha='$fecha')"; $rep=mysql_query($repetido,$this->cnx); $num=mysql_num_rows($rep); if($num==0) { $grabar="INSERT INTO logserver(`id_reg`,`id_user`,`id_server`,`id_policy`,`status`,`hejecucion`,`fecha`,`hora`,`num_incidente`,`diagnostico`) VALUES ('','$usu','$ser','$pol','$sta', '$hej','$this->fecha','$this->hora','$inc','$det')"; } else { $grabar="UPDATE logserver SET status='$sta', id_user='$usu', num_incidente='$inc', diagnostico='$det' WHERE (id_policy='$pol' AND id_server='$ser' AND fecha='$this->fecha')"; } $cambios=mysql_query($grabar,$this->cnx); if($cambios==true) { echo "<script language='javascript'> alert($cambios); //status es el contenido del error </script>"; } else { return false; } } }