Skip to content

Commit

Permalink
This commit refs #64301: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdkdkussin committed May 13, 2024
0 parents commit 5a95381
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_notes
Thumbs.db
.DS_Store
.idea
.phpstorm.meta.php
node_modules
PATCHES.txt
mysqldumper
phpMyAdmin-*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Kussin | eCommerce und Online-Marketing GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Kussin | OXID eShop Banned IPs (DDoS Protection)

This module allows you to ban IP addresses from accessing your OXID eShop.<br>
The module is designed to protect your shop from DDoS attacks.

## Requirement

1. OXID eShop Version CE/PE/EE v4.x or newer
2. PHP 7.4 or newer

## Installation

1. Download the latest release from [Github](https://github.com/kussin/OxidBannedIps/releases)
2. Unzip the archive
3. Copy the content of the folder `src` to the root of your OXID eShop installation
4. Add the following line to the top of your `/path/to/oxid/source/index.php` file:
```
include_once dirname(__FILE__) . "/banned_ips.php";
```
## Bugtracker and Feature Requests
Please use the [Github Issues](https://github.com/kussin/OxidBannedIps/issues) for bug reports and feature requests.
## Support
Kussin | eCommerce und Online-Marketing GmbH<br>
Fahltskamp 3<br>
25462 Rellingen<br>
Germany
Fon: +49 (4101) 85868 - 0<br>
Email: info@kussin.de
## Licence
[End-User Software License Agreement](LICENSE)
## Copyright
(c) 2006-2024 Kussin | eCommerce und Online-Marketing GmbH
5 changes: 5 additions & 0 deletions src/source/banned_ips.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$aBannedIps = array(
'111.230.204.202',
);
21 changes: 21 additions & 0 deletions src/source/banned_ips.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
// BANNED IPS
include_once dirname(__FILE__) . "/banned_ips.inc.php";

// GET REMOTE IP
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$sRemoteIp = $_SERVER['HTTP_CLIENT_IP'];

} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$sRemoteIp = $_SERVER['HTTP_X_FORWARDED_FOR'];

} else {
$sRemoteIp = $_SERVER['REMOTE_ADDR'];
}

// CHECK REMOTE IP
if (in_array($sRemoteIp, $aBannedIps)) {
// BLOCK IP
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this page.');
}

0 comments on commit 5a95381

Please sign in to comment.