Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (array_key_exists('forgot',$_POST)) {
- $email = $_POST['email'];
- mysql_select_db($database_speedycms, $speedycms);
- $query_email = "SELECT * FROM tbl_users WHERE email='$email'";
- $email = mysql_query($query_email, $speedycms) or die(mysql_error());
- $row_email = mysql_fetch_assoc($email);
- $totalRows_user = mysql_num_rows($email);
- mysql_query("SELECT * FROM users WHERE email='$email'");
- if($totalRows_user == 0)
- {
- echo "<span class='form2'>We're sorry, but we could not find a user with that email address.<p>Please try again.<p>
- <a href='forgotpassword.php' class='form'>Return</a></span>";
- }
- else
- {
- // create a random password
- function createRandomPassword() {
- $chars = "abcdefghijkmnopqrstuvwxyz023456789";
- srand((double)microtime()*1000000);
- $i = 0;
- $pass = '' ;
- while ($i <= 7) {
- $num = rand() % 33;
- $tmp = substr($chars, $num, 1);
- $pass = $pass . $tmp;
- $i++;
- }
- return $pass;
- }
- $password = createRandomPassword();
- // generate email
- $username = $row_email['username'];
- $msg = "Your new login information is:nn";
- $msg .= "Username: $usernamen";
- $msg .= "Password: $passwordn";
- mail("$email", "Speedy CMS Login Information", "$msg", "From:noreply@domain.com");
- // display message
- echo "<span class='form2'>Thanks. Your new password has been sent to <i>".$row_email['email']."</i>.<p>
- <a href='index.php' class='form'>Return</a></span>";
- }
- exit;
- }
- ?>
- ini_set('SMTP', "server.com");
- ini_set('smtp_port', "25");
- ini_set('sendmail_from', "email@domain.com");
- SMTP = smtp.yourdomain.com
- smtp_port = 25
- username = info@yourdomain.com
- password = yourmailpassord
- sendmail_from = info@yourdomain.com
- [mail function]
- SMTP = mail.yourdomain.com
- smtp_port = 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement