Webmaster Security

Anti-flood DDoS in PHP

Submitted by BURST, , Thread ID: 106919

Thread Closed
BURST
$ cat /etc/passwd
Challenge
Expert in Security
Level:
1
Reputation:
70
Posts:
1.35K
Likes:
151
Credits:
169
22-11-2018, 10:43 PM
#1
Code:
<?php
if (!isset($_SESSION)) {
    session_start();
}
// anti flood protection
if($_SESSION['last_session_request'] > time() - 2){
    // users will be redirected to this page if it makes requests faster than 2 seconds
    header("location: http://www.example.com/403.html");
    exit;
}
$_SESSION['last_session_request'] = time();
?>

I've already tested this script as you higher the second It Will keep redirecting to

Code:
http://www.example.com/403.html

without any reason.

Can anyone tell me why?
[Image: e72398fe92beda2aa80d0329e8b9f4febece7568.gif]

Users browsing this thread: 1 Guest(s)