Location: PHPKode > projects > Peardrop CMS > peardrop/password_reset.php
<!DOCTYPE html>
	$header = file_get_contents("inc/header");
	$meta = file_get_contents("inc/meta");
	$footer = file_get_contents("inc/footer");
	//Working Directories
	$dir = "content";
	<link href="./css/admin_style.css" type="text/css" rel="stylesheet">
	<title>Peardrop Admin Panel</title>
	<meta name="author" content="Ron Laws">
	<meta charset="utf-8">
	<script type="text/javascript" src="./ckeditor/ckeditor.js"></script>
  	<link rel="Stylesheet" href="spgm/flavors/default/spgm_style.css" />
  	<script src="spgm/spgm.js" type="text/javascript"></script>
 	 <script src="spgm/contrib/overlib410/overlib.js" type="text/javascript"></script>
		<!-- Original:  Wayne Nolting (hide@address.com) -->

		<!-- This script and many more are available free online at -->
		<!-- The JavaScript Source!! http://javascript.internet.com -->

		<!-- Begin
		function verify() {
		var themessage = "You are required to complete the following fields: ";
		if (document.form.password.value=="") {
		themessage = themessage + " - Password";
		if (document.form.email.value=="") {
		themessage = themessage + " -  E-mail";
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ") {
		else {
		return false;
		//  End -->
	<script type="text/javascript" src="./ckeditor/ckeditor.js"></script>
	    <link rel="stylesheet" href="./CodeMirror/lib/codemirror.css">
	    <script src="./CodeMirror/lib/codemirror.js"></script>
	    <script src="./CodeMirror/lib/util/overlay.js"></script>
	    <script src="./CodeMirror/mode/xml/xml.js"></script>
	    <script src="./CodeMirror/mode/css/css.js"></script>
	<link rel="stylesheet" type="text/css" href="./css/pro_dropdown_3.css" />
	<script src="./js/stuHover.js" type="text/javascript"></script>
	  <script src="./js/jquery-latest.js"></script>
	  $("div.msgbox").fadeOut("slow", function () {
	}, 6000);
<div id="container">
   <div id="navigation">
   <div id="content">
function printForm()
print <<<ENDHTM
<div id="auth-box">
<form name="form" action="password_reset.php?reset=1" method="post">
			Enter your Email Address:<br>
			<input type="text" name="email" value=""> <br>
			<input type="submit" value="Save" onclick="verify();">
		<a href="admin.php" alt="Back to admin">Back to login</a>
$reset = $_REQUEST['reset'];
if ($reset == 1){ 
$eml = $_POST['email'];
	if ($eml == $email){
		//make new password
		$temppass = md5(time());
		$string = '<?php 
		$username = "'.$username.'";
		$password = "'. md5($temppass). '";
		$email = "'.$email. '";
		$fp = fopen("passwd.inc.php", "w");

		fwrite($fp, $string);
		copy ("passwd.inc.php", "config/passwd.inc.php") or die ("Could not move file, check file permissions of $dir");
		unlink ("passwd.inc.php");
		chmod("config/passwd.inc.php", 0644);
		//email that to the administrator	
		mail($email, 'Password Reset', "As requested, a new password has been made for you, please log in using $temppass as your login password and then change it through the administration panel.");
			print ('
			<div id="auth-box">
			<p>Your password has been reset, please check your email for instructions.</p>
			<a href="admin.php" alt="Back to admin">Back to login</a>
		echo("<div class=\"msgbox\"><p><img class=\"align-left\" src=\"./img/alert.png\" alt=\"info\">Wrong Email!</p></div>");

	echo ("Password Reset Form:");
	echo("<div class=\"msgbox\"><p><img class=\"align-left\" src=\"./img/info.png\" alt=\"info\">Enter the admin email address</p></div>");

Return current item: Peardrop CMS