Ver Mensaje Individual
  #11 (permalink)  
Antiguo 25/02/2016, 17:35
Avatar de Hernand67890
Hernand67890
 
Fecha de Ingreso: febrero-2016
Ubicación: Cundinamarca
Mensajes: 15
Antigüedad: 8 años, 2 meses
Puntos: 0
Información Respuesta: editar perfil de usuario desde la pagina web

Muy amable por sus indicaciones.

he realizado las correspodientes modificaciones, cambiando el type por "if isset"

Anexo el codigo del archivo editar.php

Código PHP:
Ver original
  1. <?php
  2. if(isset ($_SESSION['id'])) {
  3. ?>
  4.  
  5. <!DOCTYPE html>
  6. <link rel="stylesheet" href="../css/estilo.css" type="text/css" media="all">
  7. <html lang="en">
  8. <head>
  9. <title>Mi perfil de operario</title>
  10. <body><a href ="../view/login.php" class = "dos">Cerrar Sesion...</a>
  11.     <p id ="title">Bievenido operario
  12.     <?php
  13.     echo $_SESSION['name'] ;
  14.     echo " " ;
  15.     echo $_SESSION['apellido'];
  16.     ?>
  17.     </p>
  18.  
  19. <?php include("../controller/crear.php");
  20.   $id = @$_SESSION["id"];
  21.   $ssql = "select * from users where id= ". $id; $editar = mysql_query($ssql);
  22.   $ssql = "select * from users where id= 1". $id.$editar = mysql_query($ssql);
  23.   //$ssql=mysql_query("UPDATE usuarios SET nombre = '$nombre', apellido = '$apellido' usuario = '$usuario', contraseña = '$contraseña', WHERE ID_USUARIO = $ID_USUARIO")OR die (mysql_error());
  24. ?>
  25.  
  26.  
  27. <form action="../controller/crear.php" method="post"> <input type="if isset" name="id" value="<?php echo $id;?>">
  28. <br />
  29.   Nombre:
  30. <br />
  31.     <input type="text" name="nombre" value="<?php echo  @$name =nombre;?>">
  32. <br />
  33.   Apellido:
  34. <br />
  35.     <input type="text" name="apellido" value="<?php echo @$name =apellido;?>">
  36. <br />
  37.   Usuario:
  38. <br />
  39.     <input type="text" name="usuario" value="<?php echo @$name =usuario;?>">
  40. <br/>
  41.   Contraseña:
  42. <br />
  43.     <input type="text" name="contraseña" value="<?php echo @$name =contraseña;?>">
  44. <br/>
  45.  
  46. <center> <input class="form-btn" name="submit" type="submit" value="Actualizar Informacion" /></center>
  47.  
  48. <!-- footer -->
  49.             <footer>
  50.                 <div class="wrapper">
  51.                     <section class="lower">
  52.                         <h3> <span></span></h3>
  53.                      
  54.  
  55.                     </section>
  56.                     <section class="lower">
  57.                         <h3></h3>
  58.  
  59. </html>
  60. <?php
  61. }else{echo "Lo sentimos, debes iniciar sesion antes de acceder a esta pagina"; } ?>

Anexo la imagen la cual me muestra solo dos errores y el formulario pero sin los datos almacenados en la base de datos.



Anexo el codigo crear.php el cual va apuntado el archivo editar.php desde el include.

Código PHP:
Ver original
  1. <?php
  2.  
  3. include ("../model/wish.php");
  4.  
  5.  
  6.  
  7. $nombre= $_POST['nombre'];
  8. $apellido= $_REQUEST['apellido'];
  9. $usuario= $_REQUEST['usuario'];
  10. $pass1= $_REQUEST['pass1'];
  11. $pass2= $_REQUEST['pass2'];
  12.  
  13.  
  14. $wish = new wish();
  15. $igual= $wish->verificar($pass1, $pass2);
  16.  
  17. if($igual == true){
  18.    
  19.    
  20. $wish->registrar($nombre, $apellido, $usuario, $pass1);
  21.  
  22.  
  23. }else if ($igual == false){
  24.    
  25.     echo "<h1> LAS CONTRASEÑAS NO COINCIDEN</h1>";
  26.    
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. ?>

Anexo el codigo wish.php el cual apunta hacia la base de datos.

Código PHP:
Ver original
  1. <?php
  2.  
  3. include 'conexion.php';
  4.  
  5. class wish extends conexion {
  6.        
  7.         private $fine;
  8.     private $user ;
  9.     private $password;
  10.     private $consulta ;
  11.     private $conexion;
  12.     private $row, $pas1 , $pas2;
  13.         private $penombre, $peapellido, $peusuario, $pepassword, $verificar ;
  14.  
  15.     public function wish(){
  16.  
  17.     $conect = new conexion();
  18.     $this->conexion = $conect -> conectar();
  19.     $conect -> seleccion_db();  
  20.  
  21.     }
  22.  
  23.     public  function login($usuario, $pass){
  24.         $this->user = $usuario;
  25.         $this->password= $pass;
  26.         $this->consulta= mysql_query("SELECT usuario , password FROM wisher where usuario = '".$this->user."' and  password = '".$this->password."'", $this->conexion);
  27.                 if($this->row = mysql_fetch_array($this->consulta)){
  28.                     session_start();
  29.                     $this->consulta = mysql_query("SELECT * FROM wisher where usuario = '".$this->user."' ",  $this->conexion);  
  30.                     $this->row = mysql_fetch_array($this->consulta);
  31.                     //Id
  32.                     $this->id = $this->row['id'];
  33.                     $_SESSION['id'] = $this->id;
  34.                     $this->ini = 1;
  35.                     //Nombre
  36.                     $this->id = $this->row['nombre'];
  37.                     $_SESSION['name'] = $this->id;
  38.                     //apellido
  39.                     $this->id = $this->row['apellido'];
  40.                     $_SESSION['apellido'] = $this->id;
  41.                          header("Location: ../Aplication/index.html");      
  42.                 }else{
  43.                         echo " usuario o password incorrecto ";
  44.  
  45.                        
  46.                 }
  47.                 return $this->consulta ;
  48.     }
  49.  
  50.         public function registrar($nom, $ape, $use, $pass){
  51.            
  52.             $this->penombre = $nom;
  53.             $this->peapellido = $ape;
  54.             $this->peusuario = $use;
  55.             $this->pepassword = $pass;
  56.            
  57.             $this->verificar = mysql_query("SELECT usuario FROM wisher where usuario = '".$this->peusuario."' " ,  $this->conexion );
  58.  
  59.             if($this->row = mysql_fetch_array($this->verificar)){
  60.                
  61.                 echo "<h1>EL USUARIO QUE ACABA DE INGRESAR YA EXISTE</h1>";  
  62.                
  63.             }else if(!$this->row = mysql_fetch_array($this->verificar)){
  64.            
  65.                 mysql_query("INSERT INTO wisher(nombre, apellido, usuario, password) values('$this->penombre', '$this->peapellido', '$this->peusuario' , '$this->pepassword')", $this->conexion );
  66.                
  67.              
  68.                
  69.                header("location: ../view/login.php");
  70.            
  71.             }
  72.            
  73.            
  74.            
  75.            
  76.            
  77.            
  78.         }
  79.        
  80.        
  81.         public function verificar($pass1 , $pass2){
  82.            
  83.             $this->fine = false;
  84.            
  85.             $this->pas1 = $pass1;
  86.             $this->pas2 = $pass2;
  87.            
  88.            
  89.             if($this->pas1 == $this->pas2){
  90.                
  91.                 $this->fine = true ;
  92.                
  93.                
  94.             }
  95.            
  96.            
  97.             return $this->fine ;
  98.         }

Gracias.