Good afternoon friends of stackoverflow.
I have this doubt, in my php code I have a url with variable gets:
I would like to take the variables email and code and through the form that I will present to you later I want to send those variables together with the password and the check password to the file updatePassword.php
<?php
$email = var_dump($_GET['email']);
$code = var_dump($_GET['code']);
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>body{padding-top:40px;padding-bottom:40px;background-color:#eee}.form-signin{max-width:330px;padding:15px;margin:0 auto}.form-signin .checkbox,.form-signin .form-signin-heading{margin-bottom:10px}.form-signin .checkbox{font-weight:400}.form-signin .form-control{position:relative;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:10px;font-size:16px}.form-signin .form-control:focus{z-index:2}.form-signin .signin{margin-bottom:-1px;border-bottom-right-radius:0;border-bottom-left-radius:0}.form-signin input[type=password]{margin-bottom:10px;border-top-left-radius:0;border-top-right-radius:0}</style>
</head>
<body>
<section>
<form class="form-signin" class="container" method="POST" action = "updatePassword.php">
<h2 class="form-signin-heading text-uppercase">Recuperar Clave</h2>
<label for="password" class="sr-only">Ingrese su nueva clave</label>
<input type="password" id="password" name="password" class="form-control signin" placeholder="Ingrese su nueva clave" required autofocus>
<label for="password-check" class="sr-only">Clave</label>
<input type="password" id="password-check" name="password-check" class="form-control" placeholder="Valide su clave" required>
<input type="hidden" name="<?php $email ?>">
<input type="hidden" name="<?php $code ?>">
<p class="help-block">Su nueva clave debe contener al menos 8 caracteres.</p>
<hr>
<button class="btn btn-lg btn-success btn-block" type="submit">Cambiar clave</button>
<!-- <a href="index.php" class="btn btn-lg btn-success btn-block">Átras</a> -->
</form>
</section> <!-- /container -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>
Here the updatePassword.php:
<?php
require_once("connection.php");
if (isset($_POST['email']) and isset($_POST['code'])) {
echo "tomaron los POSTs";
$checkmail = $connect->query("SELECT email FROM users WHERE email='$email' AND lost!='' ");
$count = mysqli_num_rows($checkmail);
if ($count) {
if (isset($_POST['password']) and isset($_POST['password-check'])) {
$password = md5($_POST['password']);
$password_check = md5($_POST['password-check']);
if ($password==$password_check) {
$inserted = $connect->query("UPDATE users SET lost='', password = '$password' WHERE email='$email' ");
}
if ($inserted) {
echo "<h1>Se cambio con exito tu password</h1> <a href='index.php'> Regresa a home </a> ";
header("index.php");
}else {
echo "<h1>No se creo el cambio</h1> <a href='index.php'>Regresa a home </a> ";
}
}
}
}else{
echo "No se hace un coño";
}?>