- 35,440
- 11,502
- CPU
- Ryzen 7 5800x
- Dissipatore
- Deepcool gammax l240 v2
- Scheda Madre
- Aourus Gigabyte X-470 ultra gaming
- HDD
- Samsung Evo 850 250gb ,2tb x 2 toshiba P300, 256 Ssd silicon power, Samsung evo plus 1tb nvme
- RAM
- 32 gb G.Skill Tridentz 3200 mhz RGB
- GPU
- Zotac - RTX 3070 Ti Trinity OC
- Monitor
- ASUS TUF QHD 165hz IPS, ITEK GCF 165hz IPS QHD, Samsung Curvo 144hz QHD
- PSU
- Seasonic Focus 650w 80 platinum
- Case
- Coolermaster h500p
- Periferiche
- Asus Tuf Wireless
- Net
- Fibra Tim 100mb
- OS
- Windows 10 Pro 64 bit
amici come ben sapete sto lavorando a un sito web php.
Allora dopo aver fatto tutte le funzioni di registrazione accesso etc, sto lavorando sulla procedura di recupero password.
Ho creato nella main page un link che apre una finesta modale dove inserendo la mail verificando che essa esista mando una mail con un link
la form è questa:
come vedete richiama un sendemail.php che vi posto ora
come vedete questa genera un link che viene spedito al mio email template.php
la mia domanda è:
una volta che clicco sul link, e mi apre la mia pagina recovermail.php
come faccio a sapere a quale indirizzo email sto aggiornando la password per cambiarla??
perchè ho impostato una session ma credo che mi si svuoti e non riesco a cambiare la password
Allora dopo aver fatto tutte le funzioni di registrazione accesso etc, sto lavorando sulla procedura di recupero password.
Ho creato nella main page un link che apre una finesta modale dove inserendo la mail verificando che essa esista mando una mail con un link
la form è questa:
HTML:
<form action ="sendmailwebsite.php" method="POST">
<img id="image" src="immagini/immaginiprova/background.png" />
<p id="text">
<img id="password_forgot" src="immagini/forgot.png" style="width:90%; margin-left:5%;"/>
<br>
<br>
<?php echo $error ?>
<label for="email_address" style="font-family: foo; font-size:40px; margin-left: 10%;">Email:</label>
<br>
<br>
<input type="text" name="email-recovery" id="email-recovery" class="textField" style="width:620px; height:42px; margin-left: 10%; font-size:25px; font-family: 'Fontdiner Swanky', cursive;"/>
<br>
<br>
<!--<img id="ok" src="immagini/ok.png" style="width:30%;margin-top:20%; margin-left: 35%;" />-->
<input type="image" value="send" src="immagini/ok.png" alt="Submit" style="width:30%; float:right;margin-top: 20%; margin-right:35%;"
</p>
</form>
come vedete richiama un sendemail.php che vi posto ora
Codice:
<?php
/**
* Created by PhpStorm.
* User: Christian
* Date: 07/06/2017
* Time: 10:51
*/
require_once('scripts/php_scripts/mail_prova/class.phpmailer.php');
require_once('scripts/php_scripts/mail_prova/class.smtp.php');
require_once('scripts/php_scripts/mail_prova/class.pop3.php');
require_once('scripts/php_scripts/mail_prova/class.phpmaileroauthgoogle.php');
require_once('scripts/php_scripts/mail_prova/class.phpmaileroauth.php');
require_once('scripts/php_scripts/dbconnect.php');
$error = "";
$db = new dbconnect;
$address = $_POST['email-recovery'];
$existing = $db->existingemail($address);
if($existing == "Valid Email") {
$mail = new PHPMailer();
$uniqidStr = md5(uniqid(mt_rand()));
//$resetPassLink = 'https://guesswhothegame/resetPassword.php?fp_code='.$uniqidStr;
$resetPassLink = 'http://localhost/gamewebsitetemplate/resetPassword.php?fp_code='.$uniqidStr;
$_SESSION['link'] = $resetPassLink;
$_SESSION['emailtorecover'] = $address;
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
//$my_url = urlencode("https://guesswhothegame/gamewebsitetemplate/email_template.php?link=".$uniqidStr);
$body = file_get_contents("http://localhost/gamewebsitetemplate/email_template.php?link=".$uniqidStr, false, stream_context_create($arrContextOptions));
//$body = file_get_contents($my_url);
$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "mioindirizzo@gmail.com"; // GMAIL username
$mail->Password = "miapassword"; // GMAIL password
$mail->SetFrom('from@gmail.com', 'Gmail');
//$mail->AddReplyTo("user2@gmail.com', 'First Last");
$mail->Subject = "Request Changing Password";
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($address, "user");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
//echo "Message sent!";
//header("location: emailcorrect.php");
echo "<script language='javascript' type='text/javascript'>location.href='emailcorrect.php'</script>";
}
}else{
$error = "Insert a valid email address of an account of the game!";
header("location: erroremail.php");
//echo "<script> openPasswordRecovery(); </script>";
}
?>
come vedete questa genera un link che viene spedito al mio email template.php
la mia domanda è:
una volta che clicco sul link, e mi apre la mia pagina recovermail.php
come faccio a sapere a quale indirizzo email sto aggiornando la password per cambiarla??
perchè ho impostato una session ma credo che mi si svuoti e non riesco a cambiare la password