From 30e5e0279463f67d94b1c0f55f2fda97bcf9b1df Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Mar 2020 21:18:29 +0100 Subject: password protection --- web/website/.htaccess | 4 ++++ web/website/fonctions.py | 16 ++++++++++++++++ web/website/init-bd.sql | 32 ++++++++++++++++++++++++++++++++ web/website/style.css | 7 +++++++ web/website/test.html | 8 ++++++++ web/website/test.py | 9 +++++++++ 6 files changed, 76 insertions(+) create mode 100644 web/website/.htaccess create mode 100644 web/website/fonctions.py create mode 100644 web/website/init-bd.sql create mode 100644 web/website/style.css create mode 100644 web/website/test.html create mode 100644 web/website/test.py (limited to 'web/website') diff --git a/web/website/.htaccess b/web/website/.htaccess new file mode 100644 index 0000000..825c08d --- /dev/null +++ b/web/website/.htaccess @@ -0,0 +1,4 @@ +AuthType Basic +AuthName "restricted area" +AuthUserFile /var/www/html/ATS-Project/web/.htpasswd +require valid-user diff --git a/web/website/fonctions.py b/web/website/fonctions.py new file mode 100644 index 0000000..1b18cc7 --- /dev/null +++ b/web/website/fonctions.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +def baseHTML(title,body): + content=(""" + + + """+ title +""" + + + + """+ body +""" + + + """) + return content diff --git a/web/website/init-bd.sql b/web/website/init-bd.sql new file mode 100644 index 0000000..6cd080f --- /dev/null +++ b/web/website/init-bd.sql @@ -0,0 +1,32 @@ +--Example used in a previous project + +/* +drop table if exists util cascade; +drop table if exists contact cascade; + +create table util( + id_util serial primary key, + login varchar(20) not null, + mdp varchar(20) +); + +create table contact( + id_contact serial primary key, + nom varchar(100), + email varchar(100), + tel varchar(10), + adresse varchar(100), + latitude real, + longitude real, + id_util smallint not null references util +); + +insert into util(login,mdp) values ('root','root'); +insert into util(login,mdp) values ('pico','pico'); +*/ + +--drop table if exists aaa cascade; + +--create table aaa( +-- bbb ccc ddd +--); diff --git a/web/website/style.css b/web/website/style.css new file mode 100644 index 0000000..69f4ad1 --- /dev/null +++ b/web/website/style.css @@ -0,0 +1,7 @@ +body { + background-color:#000000; +} + +p{ + color: white; +} diff --git a/web/website/test.html b/web/website/test.html new file mode 100644 index 0000000..b789672 --- /dev/null +++ b/web/website/test.html @@ -0,0 +1,8 @@ + + + + Test + + + This is a test page + diff --git a/web/website/test.py b/web/website/test.py new file mode 100644 index 0000000..4da1d58 --- /dev/null +++ b/web/website/test.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import mod_python +import fonctions + +def index(req): + req.content_type="text/html" + req.write(fonctions.baseHTML("Test","This is a test page.")) -- cgit v1.2.3