Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'functions.php';
- include 'connect.php';
- $action = isset($_GET['action']);
- $email = "leeg";
- switch($action){
- // case 'redirect':
- // header('Location: index.php');
- case 'sendemail':
- $user = sanitize($_POST['mail_to']);
- $query1="SELECT email FROM \"AutoForum\".gebruikers WHERE nickname = '".$user."'";
- $email= $db->query($query1);
- echo $email;
- //echo $email[0]['email'];
- if(!empty($email)){
- //if(!empty($email[0]['email'])){
- $random_password=md5(uniqid(rand()));
- $new_password=substr($random_password, 0, 8);
- $subject="Your forgotten password here";
- $header="from: AutoForum";
- $messages= "Here is your new password for login to our website \r\n.";
- $messages.="Your password is '".$new_password."' \r\n";
- $messages.="Kind regards, \r\n";
- $messages.="Alexander van Boekholdt";
- $messages.="Moderator";
- echo $messages;
- // mail($email,$subject,$messages,$header);
- $pwdtabel = md5($new_password);
- //$query2="update \"AutoForum\".gebruikers set wachtwoord = '".$pwdtabel."' WHERE nickname = '".$user."'";
- //$db->query($query2);
- echo "mail sent";
- }
- else{
- echo "mail not sent";
- }
- }
- giveHeader('Password Sent - AutoForum');
- ?>
- <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#606060" height="auto">
- <tr>
- <td width="33%"><strong>Enter your nickname: </strong></td>
- <td width="67%">
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=sendemail">
- <input name="mail_to" type="text" id="mail_to" size="25">
- <input type="submit" name="Submit" value="Submit">
- </form>
- </td>
- </tr>
- </table>
- <table>
- <tr>
- </tr>
- </table>
- <?php
- // <form method="post" action="?><?php //echo $_SERVER['PHP_SELF']; <?php?>?action=redirect">
- // <input type="submit" id="Redirect" value="Back" >
- // </form>
- giveFooter();
- ?>
Add Comment
Please, Sign In to add comment