Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/07/2014, 13:53
Avatar de jeisonr
jeisonr
 
Fecha de Ingreso: julio-2014
Mensajes: 22
Antigüedad: 9 años, 9 meses
Puntos: 0
Eliminacion,modificacion,ingreso de usuarios en php 2

modificar.php

Código PHP:
Ver original
  1. <?php
  2. include('acceso_db.php');
  3.  
  4. if (!empty($_POST)) {
  5. $texto8 = $_POST['texto8'];
  6. $texto5 = $_POST['texto5'];
  7. $texto6= $_POST['texto6'];
  8. $texto7 = $_POST['texto7'];
  9.  
  10.  
  11. $q = "UPDATE usuarios SET usuario_email='".$texto5."', Nombres='".$texto6."',Apellidos='".$texto7."' WHERE usuario_nombre='".$texto8."'";
  12. $rs = mysql_query($q);
  13.  if($rs) {
  14.          echo '<script language="JavaScript" type="text/javascript">
  15.             alert("Datos ingresados correctamente..");
  16.             function redirection(){  
  17.             window.location ="perfil.php";
  18.             }  setTimeout ("redireccionar()", 5000000000000000);
  19.             </script>';
  20.         }else {
  21.         echo "ha ocurrido un error y no se registraron los datos.";
  22.             }
  23.         }
  24. ?>
  25. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  26.        
  27.                 <table   style="margin: 0 auto width="221" cellspacing="7" cellpadding="7" border="8" bgcolor="#1E679A">
  28.             <tr>
  29.                <td><font color="#FFFFFF" face="arial, verdana, helvetica">
  30.                <div style="text-align:center;">
  31.             <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  32.             <label>Usuario:</label><br />
  33.             <input type="text" name="texto8" maxlength="50" /><br />
  34.             <label>Correo:</label><br />
  35.             <input type="text" name="texto5" maxlength="50" /><br />
  36.             <label>Nombres:</label><br />
  37.             <input type="text" name="texto6" maxlength="50" /><br />
  38.             <label>Apellidos:</label><br />
  39.             <input type="text" name="texto7" maxlength="50" /><br />
  40.             <input type="submit" name="enviar" value="Modificar" />
  41.             <input type="reset" value="Borrar" />
  42.             <a href="acceso.php" target="_self"> <input type="button" name="boton" value="Ingresar" />
  43.            
  44.             </table>
  45.                    
  46.         </font></td>
  47.             </tr>          
  48.         </div>
  49.         </form>

pagina_restringida.php

Código PHP:
Ver original
  1. <?php
  2.  
  3.     include('acceso_db.php'); // incluímos los datos de acceso a la BD
  4.     // comprobamos que se haya iniciado la sesión
  5.     if(isset($_SESSION['usuario_nombre'])) {
  6. ?>
  7.  
  8. <html lang="en">
  9. <head>
  10.     <meta charset="UTF-8">
  11.     <title>Document</title>
  12. </head>
  13. <body>
  14.     Hola <?=$_SESSION['usuario_nombre']?> esta es una página restringida
  15. </body>
  16. </html>
  17. <?php
  18.     }else {
  19.         echo "Estás accediendo a una página restringida, para ver su contenido debes estar registrado.<br />
  20.        <a href='acceso.php'>Ingresar</a> / <a href='registro.php'>Regitrarme</a>";
  21.     }
  22. ?>

perfil.php

Código PHP:
Ver original
  1. <?php
  2.     include('acceso_db.php');
  3.     ?>
  4.  
  5. <html lang="en">
  6. <head>
  7.     <meta charset="UTF-8">
  8.     <title>Document</title>
  9. </head>
  10. <body>
  11.     <?php
  12.         $perfil = mysql_query("SELECT * FROM usuarios WHERE usuario_id='".$_GET['id']."'") or die(mysql_error());
  13.         if(mysql_num_rows($perfil)) {
  14.             $row = mysql_fetch_array($perfil);
  15.             $id = $row["usuario_id"];
  16.             $nick = $row["usuario_nombre"];
  17.             $email = $row["usuario_email"];
  18.             $freg = $row["usuario_freg"];
  19.             $nombre = $row["Nombres"];
  20.             $apell= $row["Apellidos"];
  21.     ?>
  22.     <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  23.            
  24.         <tr>
  25.             <strong>Nombres:</strong> <?=$nombre?><br />
  26.             <strong>Apellidos:</strong> <?=$apell?><br />
  27.             <strong>Usuario:</strong> <?=$nick?><br />
  28.             <strong>Correo:</strong> <?=$email?><br />
  29.             <strong>Registrado el:</strong> <?=$freg?><br />
  30.             <strong><a href="cambiar_contrasena.php">Cambiar contraseña</a></strong>
  31.         </tr>
  32.     </form>
  33.             <a href="logout.php"><strong>Cerrar Sesión</strong></a><br>
  34.             <a href="acceso.php"><strong>Acceso</strong></a><br>
  35.             <a href="modificar.php"><strong>Modificar datos de usuario</strong></a><br>
  36.             <a href="eliminar.php"><strong>Eliminar  usuario</strong></a>
  37.     <?php
  38.         }else {
  39.     ?>
  40.             <p>El perfil seleccionado no existe o ha sido eliminado.</p>
  41.     <?php
  42.               }
  43.     ?>
  44. </body>
  45. </html>


continuo en Eliminacion,modificacion,ingreso de usuarios en php 3