<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PunBB Forums - Forgot Password Flood Protection]]></title>
	<link rel="self" href="http://punbb.informer.com/forums/feed/atom/topic/21380/"/>
	<updated>2009-03-25T22:10:30Z</updated>
	<generator>PunBB</generator>
	<id>http://punbb.informer.com/forums/topic/21380/forgot-password-flood-protection/</id>
		<entry>
			<title type="html"><![CDATA[Re: Forgot Password Flood Protection]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/post/126111/#p126111"/>
			<content type="html"><![CDATA[<p>I&#039;ll write this up for you real quick.</p><p>MySQL Query:<br /></p><div class="codebox"><pre><code>ALTER TABLE `users` ADD `last_pass_request` INT( 10 ) NOT NULL</code></pre></div><p>Open Login.php<br />Find:<br /></p><div class="codebox"><pre><code>        // Validate the email-address
        $email = strtolower(trim($_POST[&#039;req_email&#039;]));
        if (!is_valid_email($email))
            message($lang_common[&#039;Invalid e-mail&#039;]);</code></pre></div><p>Add after:<br /></p><div class="codebox"><pre><code>        $result = $db-&gt;query(&#039;SELECT 1 FROM &#039;.$db-&gt;prefix.&#039;users WHERE email=\&#039;&#039;.$db-&gt;escape($email).&#039;\&#039; AND last_pass_request&gt;&#039;.(time() - 3600)) or error(&#039;Unable to fetch user info&#039;, __FILE__, __LINE__, $db-&gt;error());
        if ($db-&gt;num_rows($result))
            message(&#039;A user has requested a new password too recently to send another.  Please wait an hour or contact an admistrator.&#039;);

        // Add the last password request for this email to the database
        $db-&gt;query(&#039;UPDATE users SET last_pass_request=&quot;&#039;.time().&#039;&quot; WHERE email=&quot;&#039;.$db-&gt;escape($email).&#039;&quot;&#039;) or error(&#039;Unable to add last password request info to the database&#039;, __FILE__, __LINE__, $db-&gt;error());</code></pre></div><p>I tested and it worked on my local server.&nbsp; Let me know if there are any problems.</p>]]></content>
			<author>
				<name><![CDATA[Tieguy]]></name>
				<uri>http://punbb.informer.com/forums/user/12667/</uri>
			</author>
			<updated>2009-03-25T22:10:30Z</updated>
			<id>http://punbb.informer.com/forums/post/126111/#p126111</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Forgot Password Flood Protection]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/post/126033/#p126033"/>
			<content type="html"><![CDATA[<p>Does anyone have some code already in use to prevent forgot password flooding? </p><p>The way 1.2.x works now there is nothing that keeps someone from entering a users email over and over requesting a new password.</p>]]></content>
			<author>
				<name><![CDATA[lush]]></name>
				<uri>http://punbb.informer.com/forums/user/15100/</uri>
			</author>
			<updated>2009-03-24T01:37:41Z</updated>
			<id>http://punbb.informer.com/forums/post/126033/#p126033</id>
		</entry>
</feed>
