Location: PHPKode > scripts > WH Social > wh_social/forgotten.php
<?php require('framework/session.php'); ?>
<?php require('style/layout/header.php'); ?>

<div id="content_wrapper">
    <div class="content">

    <?php

		if($_SERVER['REQUEST_METHOD'] != 'POST') {

        echo '<p>&nbsp;</p>
        <table align="center" width="350" border="0" cellpadding="0" cellspacing="0" summary="' . $lang['signin'] . '">
        <tr><td><h1>&nbsp;&nbsp;' . $lang['forgot_your_password'] . '</h1></td></tr>
        <tr><td><div class="sign_in"><form name="password" action="" method="post">
        <p><input type="text" name="email" size="30" class="textfields" required> <input type="submit" name="request_pass" value="' . $lang['request_new_password'] . '" alt="' . $lang['request_new_password'] . '" class="buttons"><br>
        <small>' . $lang['email_must_be_filled'] . '</small></p>
        </form></div>
        <p><a href="resend.php" title="' . $lang['lost_conmail'] . '" class="blue">' . $lang['request_conmail'] . '?</a></p></td></tr></table>';

		}else{

		$errors = array();

		if(strlen($_POST['email']) == "") {
		$errors[] = $lang['email_must_be_filled'];
		}

		if(!empty($errors)) {

		echo '<p class="false">' . $lang['not_filled_in_all_fields'] . ' - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
		echo '<ul>';

		foreach($errors as $key => $value) {
		echo '<li>&#8226; ' . $value . '</li>';
		}
		echo '</ul>';

			}else{

			$sql = "SELECT
						email
					FROM
						members
					WHERE
						email = '" . mysql_real_escape_string(trim($_POST['email'])) . "'";

			$result = mysql_query($sql) OR die(mysql_error());
			$row = mysql_fetch_assoc($result);

		if(!$row)
		$errors[] = '<p class="false">' . $lang['user_not_exists'] . '</p>';
		}

		if(count($errors)) {

		//

			}else{

			$password = substr(sha1(microtime()),0,8);

            $sql = "UPDATE
						members
					SET
						password = '" . trim($password) . "'
					WHERE
						email = '" . mysql_real_escape_string(trim($_POST['email'])) . "'";

			mysql_query($sql) OR die(mysql_error());

			$receiver = htmlentities($row['email']);
			$title = 'Ihr neues Passwort';
			$mailbody = '' . $lang['your_new_passwort'] . ': ' . $password. ' - ' . $lang['old_deleted'] . '!';
			$headers = 'From: ' . $webmaster . '';

			if(mail("$receiver", "$title", "$mailbody", "$headers")) {

			echo '<p class="success">' . $lang['newpass_success'] . '</p>
			<p><a href="signin.php">' . $lang['go_to_signin'] . '</a></p>';

		}else{

		echo '<p class="false">' . $lang['newpass_error'] . '</p>';

        }}}

	?>

<?php require('style/layout/footer.php'); ?>
Return current item: WH Social