Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// funzione
- function change_password($nuovapass)
- {
- session_start();
- session_regenerate_id(TRUE);
- $username = $_SESSION['user'];
- $prefixx = PREFIX;
- $table = $prefixx."users";
- $query = "UPDATE ".$table." SET password = '{$nuovapass}' WHERE username = '$username';";
- mysql_query($query) or die("MySQL error: ".mysql_error());
- print"Password Cambiata con successo<br>";
- }
- //// file changepassword.php
- <html>
- <head>
- <meta content="text/html; charset=ISO-8859-1"
- http-equiv="content-type">
- <title></title>
- </head>
- <body>
- <form method="post">
- <h2>Modifica Password</h2>
- <br>
- Nuova Password: <input name="nuovapass"><br>
- <br>
- Conferma Nuova Password: <input name="cnuovapass"><br>
- <input value="Cambia Password" type="submit">
- </form>
- </body>
- </html>
- <?php
- require_once("functions.php");
- $pass = mysql_real_escape_string($_POST['nuovapass']);
- $passc = mysql_real_escape_string($_POST['cnuovapass']);
- $nuovapass = MD5($pass);
- if(isset($pass) && ($passc) && ($pass === $passc))
- {
- change_password($nuovapass);
- }
- else
- {
- print"Riempire tutti i campi<br>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement