Jump to content

OuisVN

New Members
  • Posts

    7
  • Joined

  • Last visited

OuisVN's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. It's not neccesary because id is unsignned but thx, I fix it. The fields are differents in db. Solved.
  2. Thx but is only to get a grade in my university. I use mysqli_error in the connection <?php $config['servidor'] = 'xxx:xxx'; $config['usuario'] = 'xxx'; $config['contrasena'] = 'xxx'; $config['base_datos'] = 'xxx'; $conexion = mysqli_connect($config['servidor'], $config['usuario'], $config['contrasena'], $config['base_datos']); if(!$conexion){ die("Error de Conexion a la base de datos: ". mysqli_connect_error()); } ?>
  3. principal php (editar_producto.php) <?php //Incluir Encabezado require_once('layout/header.php'); $id = $_GET['id']; //Incluir Conexión require_once('base_datos/conexion.php'); session_start(); if($_SESSION['tipo_usuario'] == 'admin') { //QUERY SELECT $consulta = mysqli_query($conexion, "SELECT usuarios.correo, pesos.nombres, productos.fecha_registro, productos.cantidad, productos.nombrep, productos.precio, productos.descripcion, productos.id, categorias.nombre FROM categorias INNER JOIN productos ON productos.categoria_id = categorias.id INNER JOIN pesos ON pesos.id = productos.pesos_id INNER JOIN usuarios ON usuarios.id = productos.usuario_id WHERE productos.id = $id"); $usuario = mysqli_fetch_array($consulta); if(mysqli_num_rows($consulta)): ?> <div class="container"> <h2 class="text-center"><b>EDITAR PRODUCTO (<?php echo $usuario['id']; ?>)</b></h2> <?php require_once('layout/insertar_prod.php') ?> <form action="editar_producto_post.php" method="POST" role="form"> <div class="form-group"> <label for="">Nombre Juego</label> <input type="text" class="form-control" name="nombrep" required="" value="<?php echo $usuario['nombrep']; ?>"> </div> <div class="form-group"> <label for="">Categoria</label> <select class="form-control" name="nombre" required=""> <option value="1" <?php if($usuario['nombre'] =="FPS Games") echo "selected";?>>FPS Games</option> <option value="2" <?php if($usuario['nombre'] =="Aventure Games") echo "selected";?>>Aventure Games</option> </select> </div> <div class="form-group"> <label for="">Descripción</label> <input type="text" class="form-control" name="descripcion" required="" value="<?php echo $usuario['descripcion']; ?>"> </div> <div class="form-group"> <label for="">Precio</label> <input type="text" class="form-control" name="precio" required="" value="<?php echo $usuario['precio']; ?>"> </div> <div class="form-group"> <label for="">Tipo de Moneda</label> <select class="form-control" name="nombres" required=""> <option value="1" <?php if($usuario['nombres'] =="EUROS") echo "selected";?>>EUROS</option> <option value="2" <?php if($usuario['nombres'] =="DOLARES") echo "selected";?>>DOLARES</option> </select> </div> <div class="form-group"> <label for="">Cantidad</label> <input type="text" class="form-control" name="cantidad" required="" value="<?php echo $usuario['cantidad']; ?>"> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Editar Producto</button> <a href="administracion2.php" class="btn btn-success">Volver Atrás</a> </div> </form> </div> <?php endif; } else { ?> <div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Alerta!</strong> No tienes los suficientes permisos para acceder a esta página... </div> <?php } //Incluir Pie de Pagina require_once('layout/footer.php'); ?> editar_producto_post.php <?php $nombrep = $_POST['nomprep']; $nombre = $_POST['nombre']; $descripcion = $_POST['descripcion']; $precio = $_POST['precio']; $nombres = $_POST['nombres']; $cantidad = $_POST['cantidad']; $id = $_POST['id']; session_start(); $loginid = $_SESSION['id']; //Incluir Conexión require_once('base_datos/conexion.php'); $editar = mysqli_query($conexion, "UPDATE productos SET nombrep = '$nombrep', descripcion = '$descripcion', precio = '$precio', categoria_id = '$nombre', usuario_id = '$loginid', cantidad = '$cantidad', pesos_id = '$nombres' WHERE id = '$id'"); $consulta = mysqli_affected_rows($conexion); header("Location: administracion2.php?consulta=".$consulta); ?> When i tried to use update in the differents fields i got the next message: Alerta! El producto no pudo ser actualizado, intentelo de nuevo. Alert: The product could'n update, try again... But the update query is correct. :/
  4. it's just for a project, for that reason I want to remove the md5.
  5. static function hash($str, $rawsalt = '', $hash = 'sha512') { if($rawsalt == '') { $rawsalt = self::rand(((strlen($str) % 3) + 1) * 5); } $loc = array(hash('sha1', $rawsalt), hash('sha1', $str), ''); foreach(str_split($loc[0], 1) as $index => $character) { $loc[2] .= $character . $loc[1][$index]; } $hash = hash($hash, $loc[2]); return substr_replace($hash, $rawsalt, (strlen($str) << 2) % strlen($hash), 0); } static function validate($str, $hash, $engine = 'sha512') { $salt = substr($hash, (strlen($str) << 2) % strlen(hash($engine, 1)), ((strlen($str) % 3) + 1) * 5); return self::hash($str, $salt, $engine) === $hash ? true : false; } I need remove hash, sha512, md5 and other hashings without damage code
  6. what I want is to remove me because it has generated many problems. Saved password that is such which entered. I hope you can help me.
  7. I need help i need remove all md5 and others hashings in this codes Validate: http://pastebin.com/wLENt5df and Register/Login: http://pastebin.com/gG0fK7ys In register/login i remove md5 $loginKey = md5(time() . json_encode($_POST)); to $loginKey = time() . json_encode($_POST); AND 'password' => $mysql->hash($_POST['pass']), to 'password' => $mysql->$_POST['pass'], but i need remove md5 in validate, please help me
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.