Foros del Web » Programando para Internet » PHP »

¿Donde esta el problema?

Estas en el tema de ¿Donde esta el problema? en el foro de PHP en Foros del Web. Hola, estoy trabajando con un scrip y tengo un problema. Luego de logear me dirigo a perfil y no hace las consultas, no aparece la ...
  #1 (permalink)  
Antiguo 13/06/2012, 15:53
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
¿Donde esta el problema?

Hola, estoy trabajando con un scrip y tengo un problema.

Luego de logear me dirigo a perfil y no hace las consultas, no aparece la información que debiera darme.

También me da 2 warning
Código PHP:
Ver original
  1. Notice: Undefined index: btnPerfilAceptar in E:\wamp\www\panel\perfil.php on line 61
  2. Notice: Undefined index: perfil_foto in E:\wamp\www\panel\perfil.php on line 158

perfil.php
Código PHP:
Ver original
  1. <?php
  2. ###############################################
  3. ###                                         ###
  4. ###        Archivo perfil.php               ###
  5. ###                                         ###
  6. ###############################################
  7. if(!isset($_SESSION['uce']))
  8. {
  9.     // Redirecciona a entrar.php si el usuario no se ha logueado
  10.     header("location:entrar.php");
  11.     exit;
  12. }
  13.  
  14. $nombre = $_GET['usuario'];
  15.  
  16. if(verificarSiExisteUsuario($nombre))
  17. {  
  18.     if($nombre == $nombre)
  19.     {
  20.         $ver_perfil = true;
  21.     }
  22.    
  23.     $query = "SELECT * FROM players WHERE Nombre = '".$nombre."' LIMIT 1";
  24.     $result = mysql_query($query);
  25.    
  26.     $perfil_nombre = $result['Nombre'];
  27.     $perfil_sexo = verGenero($result['Sexo']);
  28.     $perfil_edad = $result['Edad'];
  29.     $perfil_telefono = verTelefono($result['Telefono']);
  30.     $perfil_raza = $result['raza'];
  31.     $perfil_origen = verOrigen($result['Origen']);
  32.     $perfil_nivel = $result['Payday'];
  33.     $perfil_horas_jugadas = $result['Payday'];
  34.     $perfil_carkey = verAuto($result['Coches']);
  35.     $perfil_housekey = verCasa($result['Casa']);
  36.     $perfil_rango = verRango($result['AdminLevel']);
  37.     $perfil_skin = $result['Skin'];
  38.     $perfil_banco = $result['Banco'];
  39.     $perfil_materiales = $result['Productos'];
  40.     $perfil_drogas = $result['Consumos'];
  41.     $perfil_crimenes = $result['Crimes'];
  42.     $perfil_arrestos = $result['condenas'];
  43.     $perfil_altura = $result['altura'];
  44.     $perfil_peso= $result['peso'];
  45.     $perfil_ojos = $result['ojos'];
  46.     $perfil_pelo = $result['pelo'];
  47.     $perfil_descripcion_psicologica = $result['descripcion_psicologica'];
  48.     $perfil_historia = $result['historia'];
  49.     $perfil_fecha_registro = $result['fecha_registro'];
  50.     $perfil_email = $result['Email'];
  51.     $mostrar = true;
  52. }
  53. else
  54. {
  55.     $msj = $info['error_perfil_1'];
  56.     $estilo = "error";
  57.     $mostrar = true;       
  58. }
  59.  
  60.  
  61. if($_POST['btnPerfilAceptar'])
  62. {
  63.         if(isset($_POST['txtPerfilNombre']) && isset($_POST['txtPerfilEdad']) && isset($_POST['txtPerfilAltura']) && isset($_POST['txtPerfilPeso'])
  64.         && isset($_POST['txaPerfilDescripcionPsicologica']) && isset($_POST['txaPerfilHistoria']) && isset($_POST['txtPerfilEmail']))      
  65.         {  
  66.             $editar_perfil_nombre = addslashes($_POST['txtPerfilNombre']);     
  67.             $editar_perfil_edad = addslashes($_POST['txtPerfilEdad']);     
  68.             $editar_perfil_raza = addslashes($_POST['txtPerfilRaza']);
  69.             $editar_perfil_altura = addslashes($_POST['txtPerfilAltura']);
  70.             $editar_perfil_peso = addslashes($_POST['txtPerfilPeso']);
  71.             $editar_perfil_ojos = addslashes($_POST['txtPerfilOjos']);
  72.             $editar_perfil_pelo = addslashes($_POST['txtPerfilPelo']);                         
  73.             $editar_perfil_email = addslashes($_POST['txtPerfilEmail']);           
  74.             $editar_perfil_descripcion_psicologica = addslashes($_POST['txaPerfilDescripcionPsicologica']);
  75.             $editar_perfil_historia = addslashes($_POST['txaPerfilHistoria']);     
  76.                
  77.             if(!empty($editar_perfil_edad) && !empty($editar_perfil_altura) && !empty($editar_perfil_peso) && !empty($editar_perfil_descripcion_psicologica)
  78.             && !empty($editar_perfil_historia) && !empty($editar_perfil_email))
  79.             {              
  80.                 if(verificarSiEsNumero($editar_perfil_edad) && $editar_perfil_edad > 0)
  81.                 {
  82.                     if(verificarSiEsNumero($editar_perfil_altura) && $editar_perfil_altura > 0)
  83.                     {
  84.                         if(verificarSiEsNumero($editar_perfil_peso) && $editar_perfil_peso > 0)
  85.                         {
  86.                             mysql_query("UPDATE players SET edad = '".$editar_perfil_edad."', raza = '".$editar_perfil_raza."', altura = '".$editar_perfil_altura."', peso = '".$editar_perfil_peso."',
  87.                             ojos = '".$editar_perfil_ojos."',pelo = '".$editar_perfil_pelo."', descripcion_psicologica = '".$editar_perfil_descripcion_psicologica."'
  88.                             ,historia = '".$editar_perfil_historia."',Email = '".$editar_perfil_email."' where Nombre = '".$editar_perfil_nombre."'")or die(mysql_error());
  89.                            
  90.                            
  91.                             $msj = $info['perfil_correcto_1']."<br><br><a href='principal.php?contenido=perfil&usuario=$nombre'>&laquo; Volver</a>";
  92.                             $estilo = "ok";
  93.                             $editado = true;
  94.                             $mostrar = false;
  95.                         }
  96.                         else
  97.                         {
  98.                             $msj = $info['error_perfil_6'];
  99.                             $estilo = "error";
  100.                             $mostrar = true;
  101.                         }                          
  102.                     }
  103.                     else
  104.                     {
  105.                         $msj = $info['error_perfil_5'];
  106.                         $estilo = "error";
  107.                         $mostrar = true;
  108.                     }
  109.                 }
  110.                 else
  111.                 {
  112.                     $msj = $info['error_perfil_4'];
  113.                     $estilo = "error";
  114.                     $mostrar = true;
  115.                 }
  116.             }
  117.             else
  118.             {
  119.                 $msj = $info['error_perfil_3'];
  120.                 $estilo = "error";
  121.                 $mostrar = true;
  122.             }
  123.         }
  124.         else
  125.         {
  126.             $msj = $info['error_perfil_2'];
  127.             $estilo = "error";
  128.             $mostrar = true;
  129.         }
  130. }
  131.  
  132.  
  133. ?>
  #2 (permalink)  
Antiguo 13/06/2012, 15:56
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: ¿Donde esta el problema?

Segunda parte de perfil.php

Código PHP:
Ver original
  1. <div style="text-align:right;padding-bottom:20px">
  2. <img id="btnExpandirInformacion" src="imagenes/iconos/informacion.png" onclick="expandirInformacion('datos_informacion','btnExpandirInformacion')" alt="Informaci&oacute;n" title="Informaci&oacute;n">
  3. </div>
  4. <div id="datos_informacion" cellspacing="0" cellpadding="0" border="0" style="padding:5px 20px 15px 20px;display:none">
  5.     <div style="background:url(imagenes/informacion/panel-arriba.png) top no-repeat;height:30px"></div>
  6.     <div style="background:url(imagenes/informacion/panel-medio.png) top repeat-y;padding:30px 30px 30px 30px">
  7.          <b>
  8.             A continuaci&oacute;n se presentan los datos principales de la cuenta.<br />La informaci&oacute;n personal est&aacute; disponible solamente para el due&ntilde;o del personaje.
  9.          </b>  
  10.     </div>
  11.     <div style="background:url(imagenes/informacion/panel-abajo.png) top no-repeat;height:30px"></div>
  12. </div>
  13. <?php if(!empty($msj)){ ?>
  14.          <div align="center">
  15.               <div class="<?php echo $estilo; ?>"><?php echo $msj; ?></div>
  16.          </div>
  17. <?php } ?>
  18. <br /><br />
  19. <?php if($mostrar == true){?>
  #3 (permalink)  
Antiguo 13/06/2012, 15:58
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: ¿Donde esta el problema?

Ultima parte de perfil.php

Código PHP:
Ver original
  1. <?php if($ver_perfil == true || $ver_admin == true){?>                                                                                              
  2.     <tr>                                           
  3.         <th class="th-label" width="20%"><?php echo $info['perfil_telefono']; ?></th>
  4.         <td><input name="txtPerfilTelefono" id="txtPerfilTelefono" type="text" size="30" value="<?php echo $perfil_telefono; ?>" disabled="disabled"></td>  
  5.     </tr>                                        
  6.  <?php }?>                          
  7.     <tr>
  8.         <th class="th-label" width="20%"><?php echo $info['perfil_altura']; ?></th>
  9.         <td><input name="txtPerfilAltura" id="txtPerfilAltura" type="text" size="30" maxlength="3" value="<?php echo $perfil_altura; ?>"
  10.         <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>></td>
  11.     </tr>
  12.     <tr>
  13.         <th class="th-label" width="20%"><?php echo $info['perfil_peso']; ?></th>
  14.         <td><input name="txtPerfilPeso" id="txtPerfilPeso" type="text" size="30" maxlength="3" value="<?php echo $perfil_peso; ?>"
  15.         <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>></td>
  16.     </tr>
  17.     <tr>
  18.         <th class="th-label" width="20%"><?php echo $info['perfil_ojos']; ?></th>
  19.         <td>
  20.             <select id="txtPerfilOjos" name="txtPerfilOjos" <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>>                                     
  21.                 <option value="Azules">Azules</option>
  22.                 <option value="Cafe" <?php if($perfil_ojos == 'Cafe'){echo "selected"; }?>>Caf&eacute;</option>
  23.                 <option value="Grises" <?php if($perfil_ojos == 'Grises'){echo "selected"; }?>>Grises</option>                                     
  24.                 <option value="Verdes" <?php if($perfil_ojos == 'Verdes'){echo "selected"; }?>>Verdes</option>
  25.                 <option value="Otro" <?php if($perfil_ojos == 'Otro'){echo "selected"; }?>>Otro</option>
  26.           </select>
  27.         </td>
  28.     </tr>
  29.     <tr>
  30.         <th class="th-label" width="20%"><?php echo $info['perfil_pelo']; ?></th>
  31.         <td>
  32.             <select id="txtPerfilPelo" name="txtPerfilPelo" <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>>
  33.                 <option value="Castaño">Casta&ntilde;o</option>
  34.                 <option value="Negro"  <?php if($perfil_pelo == 'Negro'){echo "selected"; }?>>Negro</option>
  35.                 <option value="Pelirojo"  <?php if($perfil_pelo == 'Pelirojo'){echo "selected"; }?>>Pelirojo</option>
  36.                 <option value="Rubio"  <?php if($perfil_pelo == 'Rubio'){echo "selected"; }?>>Rubio</option>
  37.                 <option value="Otro"  <?php if($perfil_pelo == 'Otro'){echo "selected"; }?>>Otro</option>
  38.           </select>
  39.         </td>
  40.     </tr>                                        
  41.     <tr>
  42.         <th class="th-label" width="20%"><?php echo $info['perfil_origen']; ?></th>
  43.         <td><input name="txtPerfilOrigen" id="txtPerfilOrigen" type="text" size="30" value="<?php echo $perfil_origen; ?>" disabled="disabled"></td>
  44.     </tr>
  45.     <tr>
  46.         <th class="th-label" width="20%"><?php echo $info['perfil_rango']; ?></th>
  47.         <td><input name="txtRango" id="txtPerfilRango" type="text" size="30" value="<?php echo $perfil_rango; ?>" disabled="disabled"></td>
  48.     </tr>
  49.     <tr>
  50.         <th class="th-label" width="20%"><?php echo $info['perfil_nivel']; ?></th>
  51.         <td><input name="txtPerfilNivel" id="txtPerfilNivel" type="text" size="30" value="<?php echo $perfil_nivel; ?>" disabled="disabled"></td>
  52.     </tr>
  53.     <tr>
  54.         <th class="th-label" width="20%"><?php echo $info['perfil_horas_jugadas']; ?></th>
  55.         <td><input name="txtPerfilHorasJugadas" id="txtPerfilHorasJugadas" type="text" size="30" value="<?php echo $perfil_horas_jugadas; ?>" disabled="disabled"></td>
  56.     </tr>
  57. <?php if($ver_perfil == true || $ver_admin == true){?>
  58.     <tr>
  59.         <th class="th-label" width="20%"><?php echo $info['perfil_carkey']; ?></th>
  60.         <td><input name="txtPerfilCarKey" id="txtPerfilCarKey" type="text" size="30" value="<?php echo $perfil_carkey ?>" disabled="disabled"></td>
  61.     </tr>
  62.     <tr>
  63.         <th class="th-label" width="20%"><?php echo $info['perfil_housekey']; ?></th>
  64.         <td><input name="txtPerfilHouseKey" id="txtPerfilHouseKey" type="text" size="30" value="<?php echo $perfil_housekey ?>" disabled="disabled"></td>
  65.     </tr>  
  66.     <tr>
  67.         <th class="th-label" width="20%"><?php echo $info['perfil_banco']; ?></th>
  68.         <td><input name="txtPerfilBanco" id="txtPerfil" type="text" size="30" value="<?php echo $perfil_banco; ?>" disabled="disabled"></td>
  69.     </tr>
  70.     <tr>
  71.         <th class="th-label" width="20%"><?php echo $info['perfil_materiales']; ?></th>
  72.         <td><input name="txtPerfilMateriales" id="txtPerfilMateriales" type="text" size="30" value="<?php echo $perfil_materiales; ?>" disabled="disabled"></td>
  73.     </tr>  
  74.     <tr>
  75.         <th class="th-label" width="20%"><?php echo $info['perfil_drogas']; ?></th>
  76.         <td><input name="txtPerfilDrogas" id="txtPerfilDrogas" type="text" size="30" value="<?php echo $perfil_drogas; ?>" disabled="disabled"></td>
  77.     </tr>
  78.     <tr>
  79.         <th class="th-label" width="20%"><?php echo $info['perfil_crimenes']; ?></th>
  80.         <td><input name="txtPerfilCrimenes" id="txtPerfilCrimenes" type="text" size="30" value="<?php echo $perfil_crimenes; ?>" disabled="disabled"></td>
  81.     </tr>
  82.     <tr>
  83.         <th class="th-label" width="20%"><?php echo $info['perfil_arrestos']; ?></th>
  84.         <td><input name="txtPerfilArrestos" id="txtPerfilArrestos" type="text" size="30" value="<?php echo $perfil_arrestos; ?>" disabled="disabled"></td>
  85.     </tr>
  86. <?php }?>
  87.     <tr>
  88.          <th class="th-label" colspan="3">
  89.              <?php echo $info['perfil_descripcion_psicologica']; ?><br />
  90.             <textarea id="txaPerfilDescripcionPsicologica" name="txaPerfilDescripcionPsicologica" cols="95" rows="5" <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>><?php echo $perfil_descripcion_psicologica; ?></textarea>
  91.          </th>
  92.     </tr>                              
  93.     <tr>
  94.         <th class="th-label" colspan="3">
  95.              <?php echo $info['perfil_historia']; ?><br />
  96.         <textarea id="txaPerfilHistoria" name="txaPerfilHistoria" cols="95" rows="10" <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>><?php echo $perfil_historia; ?></textarea>
  97.       </th>
  98.     </tr>                            
  99.     <?php if($ver_perfil == true || $ver_admin == true){?>                          
  100.     <tr>
  101.          <th class="th-label" width="20%"><?php echo $info['perfil_email']; ?></th>
  102.          <td><input name="txtPerfilEmail" id="txtPerfilEmail" type="text" size="30"
  103.             value="<?php echo $perfil_email; ?>" style="width:200px"
  104.             <?php if($ver_perfil == false && $ver_admin == false){ echo "disabled='disabled'";}?>>
  105.          </td>
  106.     </tr>
  107.     <?php }?>                          
  108.     <tr>
  109.          <th class="th-label" width="20%"><?php echo $info['perfil_fecha_registro']; ?></th>
  110.          <td><input name="txtPerfilFechaRegistro" id="txtPerfilFechaRegistro" type="text" size="30"
  111.             value="<?php echo $perfil_fecha_registro; ?>" style="width:200px" disabled="disabled">
  112.          </td>
  113.     </tr>                              
  114.     <tr>
  115.         <?php if($ver_perfil == true){?>
  116.             <td><br /><br /><input type='submit' id='btnPerfilAceptar' name='btnPerfilAceptar' value='Guardar Cambios'></td>            
  117.         <?php } ?>    
  118.     </tr>
  119. </table>
  120. </form>
  121. <?php }?>
  #4 (permalink)  
Antiguo 13/06/2012, 19:09
Avatar de zarkiel  
Fecha de Ingreso: febrero-2012
Mensajes: 51
Antigüedad: 12 años, 2 meses
Puntos: 15
Respuesta: ¿Donde esta el problema?

Antes de utilizar $_SESSION tienes que ejecutar la funcion session_start();
Código PHP:
Ver original
  1. session_start(); // inicias session
  2. if(!isset($_SESSION['uce'])){
los warning te salen porque no inicializaste las variables "btnPerfilAceptar" y "perfil_foto"
__________________
« Los deseos pueden hacerse realidad, pero no basta con esperar un milagro, el milagro lo hacemos nosotros... Aquí y ahora »
  #5 (permalink)  
Antiguo 14/06/2012, 00:51
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: ¿Donde esta el problema?

Bien, agregue session_start como me indicaste y ahora me sale un error, pero la linea no tiene ninguna función o al menos eso creo.

Error:
Código PHP:
Ver original
  1. Parse error: syntax error, unexpected $end in E:\wamp\www\panel\perfil.php on line 304

Linea 304
Código HTML:
Ver original
  1. <?php }?>

Ya intente quitando la linea y me da error en la linea anterior (303) la cual es solo "</form>".

Estuve leyendo y podría ser alguna llave, pero no encontré nada malo en el código, los campos de la db están todos correctos.

Última edición por Psicopata17; 14/06/2012 a las 00:59
  #6 (permalink)  
Antiguo 14/06/2012, 01:46
 
Fecha de Ingreso: mayo-2011
Mensajes: 171
Antigüedad: 12 años, 11 meses
Puntos: 32
Respuesta: ¿Donde esta el problema?

Cita:
Iniciado por Psicopata17 Ver Mensaje
Bien, agregue session_start como me indicaste y ahora me sale un error, pero la linea no tiene ninguna función o al menos eso creo.

Error:
Código PHP:
Ver original
  1. Parse error: syntax error, unexpected $end in E:\wamp\www\panel\perfil.php on line 304

Linea 304
Código HTML:
Ver original
  1. <?php }?>

Ya intente quitando la linea y me da error en la linea anterior (303) la cual es solo "</form>".



Estuve leyendo y podría ser alguna llave, pero no encontré nada malo en el código, los campos de la db están todos correctos.


cuando te da estos tipos de errores es por falta de una coma en alguna parte del código, revisa detalladamente
  #7 (permalink)  
Antiguo 14/06/2012, 15:49
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: ¿Donde esta el problema?

Cita:
Iniciado por dukeblass Ver Mensaje
cuando te da estos tipos de errores es por falta de una coma en alguna parte del código, revisa detalladamente
Si, leí en el foro que podrida ser eso.

Pero... revise y no encontré nada fuera de lugar, uso Dreamweaver para facilitar y ver bien el código (con colores) y nada mal....
  #8 (permalink)  
Antiguo 15/06/2012, 16:00
 
Fecha de Ingreso: junio-2012
Mensajes: 18
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: ¿Donde esta el problema?

Aun sigo con el mismo problema

Etiquetas: mysql, registro, sql, usuarios
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:31.