Welcome Guest, Not a member yet? Register   Sign In
My new work - An anti-scriping library.
#1

(This post was last modified: 05-28-2019, 02:50 AM by allenlee.)

I just have completed the document, can't wait for share with you. Any feedback, feature request are welcome. 


Git: https://github.com/terrylinooo/shieldon



Document: https://shield-on-php.github.io/


Demo: https://terryl.in (Just refresh many times at a short period time to see how it work.)


Implement this in your Codeigniter 3:

in MY_Controller


Code:
public function protection()
{
    $db = [
        'host'    => $this->db->hostname,
        'dbname'  => $this->db->database,
        'user'    => $this->db->username,
        'pass'    => $this->db->password,
        'charset' => 'utf8',
    ];

    $pdoInstance = new \PDO(
        'mysql:host=' . $db['host'] . ';dbname=' . $db['dbname'] . ';charset=' . $db['charset'],
        $db['user'],
        $db['pass']
    );

    $shieldon = new \Shieldon\Shieldon();
    $shieldon->setDriver(new \Shieldon\Driver\MysqlDriver($pdoInstance));
    $shieldon->setComponent(new \Shieldon\Component\Ip());
    $shieldon->setComponent(new \Shieldon\Component\Robot());

 
    $shieldon->setCaptcha(new \Shieldon\Captcha\ImageCaptcha(['word_length' => 4]));
    

    // Start protecting your website!
    $result = $shieldon->run();
    
    if ($result !== $shieldon::RESPONSE_ALLOW) {
        if ($shieldon->captchaResponse()) {
            // Unban current session.
            $shieldon->unban();
        }
        // Output the result page with HTTP status code 200.
        $shieldon->output(200);
    }
}

Then


PHP Code:
$this->protection(); 

In any Controller, you want to protect the page.
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply
#2

Interesting project!

Do you exclude the "good" bots ?
Like the search engines crawler ?
remote software developer jobs aggregated in one place
*No SEO spam, per forum policy*
Reply




Theme © iAndrew 2016 - Forum software by © MyBB