Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
PHP/MySQL Spamming
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Weasel" data-source="post: 203087" data-attributes="member: 9520"><p>I got something, I guess it could be improved, but it does the trick:</p><p> </p><p>Add this somewhere at the top:</p><p>[PHP]session_start();</p><p>$hour = date("H");</p><p>$minute = date("i");</p><p>$seconds = date("s");</p><p>$day = date("d");</p><p>$month = date("m");</p><p>$year = date("Y");</p><p>$extratime = 30;</p><p> </p><p>$current = mktime($hour,$minute,$seconds,$month,$day,$year);</p><p>$expire = mktime($hour,$minute,$seconds+$extratime,$month,$day,$year);[/PHP]</p><p> </p><p>Add this on the place where you want the input etc, and at "// All the code here" put the actual code.</p><p>[PHP]if ($_SESSION['check_time'] < $current && $_SESSION['check_amount'] < 3)</p><p>{</p><p>if ($_SESSION['check_time'] > $current && $_SESSION['check_amount'] >= 3)</p><p>{</p><p>unset($_SESSION['check_amount']);</p><p>}</p><p> // All the code here</p><p>}</p><p>else</p><p>{</p><p>echo 'Please don\'t spam!';</p><p>}[/PHP]</p><p> </p><p>On submit, set the sessions:</p><p>[PHP]if (!isset($_SESSION['check_amount']))</p><p>{</p><p>$_SESSION['check_amount'] = 1;</p><p>$_SESSION['check_time'] = $expire;</p><p>}</p><p>else {</p><p>$_SESSION['check_amount']++;</p><p>}[/PHP]</p></blockquote><p></p>
[QUOTE="Weasel, post: 203087, member: 9520"] I got something, I guess it could be improved, but it does the trick: Add this somewhere at the top: [PHP]session_start(); $hour = date("H"); $minute = date("i"); $seconds = date("s"); $day = date("d"); $month = date("m"); $year = date("Y"); $extratime = 30; $current = mktime($hour,$minute,$seconds,$month,$day,$year); $expire = mktime($hour,$minute,$seconds+$extratime,$month,$day,$year);[/PHP] Add this on the place where you want the input etc, and at "// All the code here" put the actual code. [PHP]if ($_SESSION['check_time'] < $current && $_SESSION['check_amount'] < 3) { if ($_SESSION['check_time'] > $current && $_SESSION['check_amount'] >= 3) { unset($_SESSION['check_amount']); } // All the code here } else { echo 'Please don\'t spam!'; }[/PHP] On submit, set the sessions: [PHP]if (!isset($_SESSION['check_amount'])) { $_SESSION['check_amount'] = 1; $_SESSION['check_time'] = $expire; } else { $_SESSION['check_amount']++; }[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
PHP/MySQL Spamming
Top