Location: PHPKode > projects > php Blogger > reset.php
<?php session_start();
/* * ********************************************************************
*  Copyright notice PHP Blogger 1.1.
*
*  (c) 2011 Predrag Rukavina - admin[at]phpblogger[dot]org
*  All rights reserved
*
*  This script is part of the PHP Blogger project. 
*  The PHP Blogger project is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*  MA  02110-1301, USA.
*
*  This copyright notice MUST appear in all copies of the script!
* ********************************************************************** */
##############################
# reset.php      version 1.1.#
##############################
if(@$_SESSION['INC_USER_ID'] == true) {
	echo $lang['ERRORSIG'];
	die();
}
include ('settings.php');
require_once ('languages/lang_'.$language.'.php');
$smarty->display('blank.php');
$id = $_GET['id'];
if($id == false) {
	echo "Error 404.</div>";
	include ('static.php');
	die();
}
$arecordSet = &$conn->Execute("SELECT * FROM users where `tempass`  = '".mysql_real_escape_string($id)."'");
if($arecordSet) {
	if($arecordSet->fields > 0) {
		$usid = $arecordSet->fields['usid'];
		$username = $arecordSet->fields['username'];
		$password = $arecordSet->fields['password'];
		$email = $arecordSet->fields['email'];
	}
} else {
	$recordSet->Close();
	$arecordSet->Close();
	$conn->Close();
	echo "Error 404.</div>";
	include ('static.php');
	die();
}
if(!isset($_SESSION["jumpsy"]))
	$_SESSION["jumpsy"] = 0;
$_SESSION["jumpsy"] = $_SESSION["jumpsy"] + 1;
if($_SESSION["jumpsy"] > 1) {
	echo "Error.</div>";
	$smarty->display('footer.php');
	die();
}
$tips = 'JvKnrQWPsThuJteNQAuH';
$cchash = sha1(uniqid($tips.mt_rand(),true));
$cchash = substr($cchash,0,8);
$hashe = md5($cchash);
$brecordSet = &$conn->Execute("UPDATE users SET password = '".mysql_real_escape_string($hashe)."' WHERE usid = '".mysql_real_escape_string($usid)."'");
$myurl = "$sitepath/userpanel.php";
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=utf-8'."\r\n";
$headers .= "From: $sitemail"."\r\n";
$bodys = "
<head>
<style>
#content{
align:center;
padding:5px;
margin:0px auto;
background:#fff;
border-top:2px solid #FF8300;
width:100%;
font-family;tahoma;
color:#222;
}
</style>
</head>
<div id = 'content'>
<h4>$sitetitle</h4>$lang[RETHEADE] \"$username\",
<br />
$lang[RETNEWP]
<br /><br />
<font color=\"#000000\">$cchash</font>
<br /><br />
<a href=\"$myurl\">$myurl</a>
<br /><br />
$lang[RETREGAR], $sitetitle $lang[RETTEAM]";
$subject = "$lang[RETSUBJ] $sitetitle";
mail($email,$subject,$bodys,$headers);
echo "<center><div id='info'>$lang[RETSEND]</center></div></div>";
include ('static.php');
$recordSet->Close();
$arecordSet->Close();
$brecordSet->Close();
$conn->Close();
?>
Return current item: php Blogger