Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/11/2011, 10:48
dajahero
 
Fecha de Ingreso: noviembre-2011
Mensajes: 3
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Problema con envío de variables en PHP por URL

Clase ControlTelefónico.php :

Código:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta name="keywords" content="" />
  4. <meta name="description" content="" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6.  
  7.  
  8.  
  9. <script language="JavaScript" type="text/JavaScript" src="Recursos/plantilla.js">                           </script>
  10. <link href="Recursos/plantilla.css" rel="stylesheet" type="text/css">
  11. <link rel="shortcut icon" href="Recursos/telmex_ico.ico">
  12. <script src="mootools-core-1.3.2-full-compat-yc.js" type="text/javascript"></script>
  13. <script language="javascript">
  14.  
  15. timer=setTimeout("verseleccion();verseleccion_concepto()",0);;
  16.  
  17. function verseleccion()
  18.        
  19. {
  20.  
  21. window.addEvent('domready', function(){
  22.             var valor_mes="";
  23.             var valor_annio="";
  24.             var valor_sub="";
  25.             var valor="";
  26.  
  27.             var sub=document.getElementById("cb_subdireccion");
  28.             var valor_sub=sub.value;
  29.  
  30.             var mes=document.getElementById("cb_mes");
  31.             var valor_mes=mes.value;
  32.  
  33.             var annio=document.getElementById("cb_anio");
  34.             var valor_annio=annio.value;
  35.            
  36.             var valor="";
  37.            
  38.            
  39.  
  40.  
  41. var mis_datos = [
  42.         [      
  43.             valor_mes,
  44.            
  45.         ],
  46.         [
  47.             valor_annio,
  48.            
  49.         ],
  50.         [
  51.             valor_sub,
  52.            
  53.         ],
  54.         [
  55.            
  56.             valor,
  57.         ],
  58.        
  59. ];
  60.  
  61.         //convierto ese array en un JSON con Mootools
  62.         var miJSON = JSON.encode(mis_datos);
  63.        
  64.         //pondríamos esto para ver el JSON generado en la capa con id=resultado
  65.         //$('resultado').set("html", "<pre>" + miJSON + "</pre>");
  66.        
  67.         //creo una conexión
  68.         var miAjax = new Request({
  69.             url: "recibo-json.php",
  70.             data: "datos=" + miJSON,
  71.             onSuccess: function(textoRespuesta){
  72.                 $('resultado').set("html", textoRespuesta);
  73.             },
  74.             onFailure: function(){
  75.                 $('resultado').set("html", "fallo en la conexión Ajax");
  76.             }
  77.         })
  78.         miAjax.send();
  79.     });
  80.  
  81.  
  82.  
  83.        
  84.         }
  85.  
  86. function verseleccion_concepto()
  87.         {
  88.  
  89.  
  90. window.addEvent('domready', function(){
  91.             var valor_mes="";
  92.             var valor_annio="";
  93.             var valor_sub="";
  94.             var valor="";
  95.  
  96.             var sub=document.getElementById("cb_subdireccion");
  97.             var valor_sub=sub.value;
  98.  
  99.             var mes=document.getElementById("cb_mes");
  100.             var valor_mes=mes.value;
  101.  
  102.             var annio=document.getElementById("cb_anio");
  103.             var valor_annio=annio.value;
  104.            
  105.             var valor=window.location.hash;
  106.            
  107.            
  108.  
  109.  
  110.  
  111. var mis_datos = [
  112.         [      
  113.             valor_mes,
  114.            
  115.         ],
  116.         [
  117.             valor_annio,
  118.            
  119.         ],
  120.         [
  121.             valor_sub,
  122.            
  123.         ],
  124.         [
  125.             valor,
  126.            
  127.         ],
  128. ];
  129.  
  130.         //convierto ese array en un JSON con Mootools
  131.         var miJSON = JSON.encode(mis_datos);
  132.        
  133.         //pondríamos esto para ver el JSON generado en la capa con id=resultado
  134.         //$('resultado').set("html", "<pre>" + miJSON + "</pre>");
  135.        
  136.         //creo una conexión
  137.         var miAjax = new Request({
  138.             url: "recibo-json.php",
  139.             data: "datos=" + miJSON,
  140.             onSuccess: function(textoRespuesta){
  141.                 $('resultado').set("html", textoRespuesta);
  142.             },
  143.             onFailure: function(){
  144.                 $('resultado').set("html", "fallo en la conexión Ajax");
  145.             }
  146.         })
  147.         miAjax.send();
  148.     });
  149.  
  150.  
  151.  
  152.        
  153.         }
  154.  
  155.  
  156.    
  157.     </script>
  158.  
  159.  
  160. <title>TELMEX - Control Telef&oacutenico</title>
  161.    
  162.  
  163. <?php
  164.  
  165.    
  166.     header("Content-Type: text/html;charset=utf-8");//para manejar acéntos
  167.         session_start();
  168.     include_once 'Conexion.php';
  169.    
  170.         if($_SESSION['usuario'])
  171.      {
  172.         $usuario=$_SESSION['usuario'];
  173.  
  174.         include_once 'Conexion.php';
  175.         $consulta="SELECT nombre_usuario, a_paterno, a_materno FROM usuario WHERE usuario='".$usuario."'";
  176.         mysql_query("SET NAMES 'utf8'");
  177.        
  178.         $res=mysql_query($consulta);
  179.        
  180.         mysql_connect("localhost","control_tel","admin");
  181.         mysql_select_db("control_telefonico");
  182.        
  183.         while ($row = mysql_fetch_row($res))
  184.         {
  185. ?>
  186.  
  187. </head>
  188.  
  189. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload=tiempo()>
  190.  
  191.  
  192. <table width="100%" height="80%" border="0">
  193. <tr>
  194.     <td height="10"><table width="100%" border="0" cellspacing="0" cellpadding="0" VALIGN="top">
  195.      
  196.       <tr>
  197.         <td width="100%" height="46" valign="bottom">
  198.        
  199.        <h1><font color="#2E73C8">&nbsp;Control Telef&oacutenico</font></h1></td>
  200.        
  201.        <td width="10%"><center><img align= "center" src="Recursos/logo_telmex.jpg" width="226" height="45"></center></td>
  202.      </tr>
  203.      <tr>
  204.        <td colspan="2" bgColor="#2E73C8" height="25" valign="bottom">
  205.  
  206. <h2><font color="#F7F8E0"> &nbsp;
  207.        
  208.        
  209. <?php
  210.          
  211. $fecha =time();
  212.  
  213.     if(date("a")=="am")
  214.     {
  215.     echo "Buenos d&iacuteas";
  216.     }
  217.     else
  218.     {
  219.     echo "Buenas tardes";
  220.     }
  221.  
  222.     header("Content-Type: text/html;charset=utf-8");
  223.  
  224.     echo " ";
  225.     echo "$row[0]";
  226.     echo " ";
  227.     echo "$row[1]";
  228.     echo " ";
  229.     echo "$row[2]";
  230.     }
  231.    
  232. }
  233.  
  234. else
  235. {
  236. echo 'No has iniciado sesion';
  237. }
  238. ?>
  239.  
  240.         </font></h2>
  241.  
  242.     </td>
  243.       </tr>
  244.     </table></td>
  245.   </tr>
  246.   <tr>
  247.     <td height="22" valign="top">
  248.     <center>
  249.  
  250.     <h2><font>Generar Reporte: </font></h2>
  251.     </center></td>
  252.    
  253.   </tr>
  254.   <tr>
  255.    <td height="30">
  256.     <table width="100%" height="100%">
  257.     <tr>
  258.     <td width="38%" height="49">
  259.     <center>
  260.    
  261.     <strong>Por mes:</strong>
  262.  
  263.    
  264.        <?php
  265.         $SQL="SELECT DISTINCT mes_text FROM cuenta order by mes DESC";
  266.         $result=mysql_query($SQL);
  267.  
  268.         echo '<select name="cb_mes" id="cb_mes" size=1 style="width:120px" onchange="verseleccion(); verseleccion_concepto()">';
  269.        
  270.         // DESPLIEGA
  271.         while ($row=mysql_fetch_array($result))
  272.         {
  273.             echo '<option value="'.$row["mes_text"].'">'.$row["mes_text"];
  274.         }
  275.         //mysql_free_result($result);
  276.         echo '</select>';
  277.  
  278.     ?>
  279.  
  280.    
  281.     <strong>&nbsp; A&ntildeo:</strong>
  282.  
  283.    
  284.     <?php
  285.          
  286.         $SSQL="SELECT DISTINCT anio FROM cuenta order by anio";
  287.         $resultado=mysql_query($SSQL);
  288.  
  289.         echo '<select name="cb_anio" id="cb_anio" size=1 style="width:80px" onchange="verseleccion(); verseleccion_concepto()">';
  290.        
  291.         // DESPLIEGA
  292.         while ($row=mysql_fetch_array($resultado))
  293.         {
  294.             echo '<option value="'.$row["anio"].'">'.$row["anio"];
  295.         }
  296.         //mysql_free_result($resultado);
  297.         echo '</select>';
  298.        ?>
  299.     </center>
  300.     </td>
  301.     <td width="62%">
  302. <form name="subdireccion" method="post">
  303.     <strong>Subdirecci&oacuten de Sistemas:&nbsp; </strong>
  304.  
  305.  
  306.        
  307.        <?php
  308.         $SQL="SELECT DISTINCT area FROM cuenta order by area DESC";
  309.         $result=mysql_query($SQL);
  310.  
  311.         echo '<select name="cb_subdireccion" id="cb_subdireccion" size=1 style="width:430px" onchange="verseleccion(); verseleccion_concepto()">';
  312.         echo '<<option value="TODOS">TODOS</option>';
  313.         // DESPLIEGA
  314.         while ($row=mysql_fetch_array($result))
  315.         {
  316.             echo '<option value="'.$row["area"].'">'.$row["area"];
  317.         }
  318.         //mysql_free_result($result);
  319.         echo '</select>';
  320.  
  321.     ?>
  322.        
  323.        
  324.     </center>
  325.     </td>
  326.     </tr>
  327.     <tr>
  328.      <td colspan="2" bgColor="#2E73C8" height="5" valign="bottom">
  329.      </td>
  330.     </tr>
  331.    
  332.     </table>
  333.     </td>
  334.    
  335.   </tr>
  336.  
  337.   <tr>
  338.    <td valign="top"><center>
  339.     <strong> <h2> R E S U M E N </h2> </strong> </center>
  340.  
  341.  
  342.  
  343.  
  344. <div id=resultado> </div>
  345.  
  346.  
  347. <?php
  348.  
  349. function dameURL()
  350. {
  351. $url="http://".$_SERVER['HTTP_HOST'].":".$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
  352. return $url;
  353. }
  354. echo 'Valor URL: ';
  355. echo dameURL();
  356.  
  357. ?>
  358.  
  359.  
  360.  
  361. </body>
  362. </html>