-
Conteúdo Similar
-
Por allalves
Estou com problemas para solucionar o desenvolvimento deste codigo que apenas faz um update do campo senha poderiam me ajudar?
Segue abaixo o codigo:
<?php
require 'dbconfig/config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Pagina de alteracao de senha</title>
<link rel="stylesheet" href=css/style.css>
</head>
<body style="background-color:#7f8c8d">
<div id="main-wrapper">
<center>
<h2>Pagina de alteracao de senha</h2>
</center>
<form action="trocasenha.php" method="post">
<Label>Username:</label>
<input type="text" class="inputvalues" placeholder="type your username"/><br>
<label>Nova Password:</label><br>
<input type="password" class="inputvalues" placeholder="password"/>
<label>Confirme seu Password:</label><br>
<input type="password" class="inputvalues" placeholder="type your username"/>
<input type="submit" id="signup_btn" value="Altera"/>
<a href="index.php"><input type="button" id="back_btn" value="Back"/></a>
</form>
<?php>
if(isset($_POST['submit_btn']))
{
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
if($password==$cpassword)
{
$encrypted_password = md5($password);
$query= "select * from userinfotable WHERE username='$username'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)<=0)
{
echo '<script type="text/javascript"> alert("User no exists.. try another username") </script>';
}
else
$query= "update userinfotable values(id,'$encrypted_password') where username='$username';";
$query_run = mysqli_query($con,$query);
if($query_run)
{
echo '<script type="text/javascript"> alert("Senha alterada com sucesso.. Go to login page to login") </script>';
}
else
{
echo '<script type="text/javascript"> alert("'.mysqli_error($con).'") </script>';
}
}
}
else{
echo '<script type="text/javascript"> alert("Password and confirm password does not match!") </script>';
}
?>
</div>
</body>
</html>
-
Por allalves
Estou com problemas para solucionar o desenvolvimento deste codigo que apenas faz um update do campo senha poderiam me ajudar?
Segue abaixo o codigo:
<?php
require 'dbconfig/config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Pagina de alteracao de senha</title>
<link rel="stylesheet" href=css/style.css>
</head>
<body style="background-color:#7f8c8d">
<div id="main-wrapper">
<center>
<h2>Pagina de alteracao de senha</h2>
</center>
<form action="trocasenha.php" method="post">
<Label>Username:</label>
<input type="text" class="inputvalues" placeholder="type your username"/><br>
<label>Nova Password:</label><br>
<input type="password" class="inputvalues" placeholder="password"/>
<label>Confirme seu Password:</label><br>
<input type="password" class="inputvalues" placeholder="type your username"/>
<input type="submit" id="signup_btn" value="Altera"/>
<a href="index.php"><input type="button" id="back_btn" value="Back"/></a>
</form>
<?php>
if(isset($_POST['submit_btn']))
{
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
if($password==$cpassword)
{
$encrypted_password = md5($password);
$query= "select * from userinfotable WHERE username='$username'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)<=0)
{
echo '<script type="text/javascript"> alert("User no exists.. try another username") </script>';
}
else
$query= "update userinfotable values(id,'$encrypted_password') where username='$username';";
$query_run = mysqli_query($con,$query);
if($query_run)
{
echo '<script type="text/javascript"> alert("Senha alterada com sucesso.. Go to login page to login") </script>';
}
else
{
echo '<script type="text/javascript"> alert("'.mysqli_error($con).'") </script>';
}
}
}
else{
echo '<script type="text/javascript"> alert("Password and confirm password does not match!") </script>';
}
?>
</div>
</body>
</html>
-