Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("datos.php");
- include ("funciones.php");
- $con=conectar ($host,$usuario,$clave,$base);
- if (!$con){
- echo "error" ;
- } else{
- if(($_POST["user"]=="admin" && $_POST["password"]=="admin")){
- $user=$_POST["user"];
- $password=$_POST["password"];
- $C=0;
- $consulta= "SELECT * FROM usuarios ";
- $paquete= consultar($con,$consulta);
- while ($fila=mysqli_fetch_array($paquete)) {
- if ($fila["user"]==$user && $fila["password"]==$password) {
- $C=$C+1 ;
- }
- }
- $consulta= "SELECT * FROM usuarios ";
- $paquete= consultar($con,$consulta);
- echo "<table border='1'>";
- echo "<td><strong>Id</strong></td>";
- echo "<td><strong>Usuario</strong></td>";
- echo "<td><strong>Contraseña</strong></td>";
- while ($fila=mysqli_fetch_array($paquete)){
- echo "<form action='modificar.php' method='post'>";
- echo "<tr>";
- echo "<td><input type='text' name='id' value='" . $fila['id'] . "'></td>";
- echo "<td><input type='text' name='user' value='" . $fila['user'] . "'></td>" ;
- echo "<td><input type='text' name='password' value='" . $fila['password'] . "'></td>" ;
- echo "</tr>";
- }
- echo "</table>";
- echo "<input type='submit' name='enviando' value='Modificar'><p>";
- echo "</form>";
- }
- }
- ?>
- <?php
- require("datos.php");
- $id=$_POST["id"];
- $user=$_POST["user"];
- $password=$_POST["password"];
- $conexion=mysqli_connect($host, $usuario, $clave, $base);
- if(mysqli_connect_errno()){
- echo "fallo al conectar la BBDD";
- exit();
- }
- mysqli_select_db($conexion, $base) or die ("No se encuentra la BBDD");
- $consulta="UPDATE usuarios SET user='$user', password='$password' WHERE id='$id'";
- $resultados=mysqli_query($conexion, $consulta);
- if($resultados==false){
- echo "Error al modificar registro";
- }else{
- echo "Registro modificado";
- }
- ?>
- <form action='modificar.php' method='post'>
- <input type='text' name='id' value=''/>
- <input type='text' name='user' value=''/>
- <input type='text' name='password' value=''/>
- <form action='modificar.php' method='post'>
- <input type='text' name='id' value=''/>
- <input type='text' name='user' value=''/>
- <input type='text' name='password' value=''/>
- <form action='modificar.php' method='post'>
- <input type='text' name='id' value=''/>
- <input type='text' name='user' value=''/>
- <input type='text' name='password' value=''/>
- ......
- <form action='modificar.php' method='post'>
- <input type='text' name='id' value=''/>
- <input type='text' name='user' value=''/>
- <input type='text' name='password' value=''/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement