visitors count: correction taking ip address

This commit is contained in:
coulisse 2024-03-24 15:01:52 +01:00
parent 2a05d05de4
commit 3dd3813918
2 changed files with 5 additions and 2 deletions

View File

@ -52,6 +52,10 @@ $dbpass = "your-password";
If you would change some MariaDB parameters, then you can find them in `/etc/mysql/my.cnf` or `/etc/my.cnf`, depending on your distro.
If the database will not be created automatically, please see ["DB_ISSUES.md"](docs/DB_ISSUES.md)
TODO: se installando i moduli python errore:
sudo apt-get install libmariadb3 libmariadb-dev
TODO: check number ADXO
**3) Python modules**
You could install python modules using automatic or manual way.

View File

@ -190,13 +190,12 @@ def get_nonce():
#check if it is a unique visitor
def visitor_count():
user_ip = request.remote_addr
user_ip =request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
if user_ip not in visits:
visits[user_ip] = 1
else:
visits[user_ip] += 1
@app.route("/", methods=["GET"])
@app.route("/index.html", methods=["GET"])
def spots():