Alpha first commit
This commit is contained in:
47
new.py
Executable file
47
new.py
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/python3.5
|
||||
import cgi
|
||||
import cgitb
|
||||
cgitb.enable()
|
||||
import re
|
||||
import configparser
|
||||
from functions.headfoot import printheader,printfooter
|
||||
|
||||
# IMPORT DE LA CONFIGURATION
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.conf')
|
||||
|
||||
DOMAIN = config.get('general','domain')
|
||||
TEMPLATEPATH = config.get('general','templatepath')
|
||||
PROTO = config.get('general','proto')
|
||||
|
||||
# EXTRACTION DES VARIABLES
|
||||
TEMPLATEFILE = open(TEMPLATEPATH, "r")
|
||||
TEMPLATE = TEMPLATEFILE.read()
|
||||
|
||||
ALLVARIABLES = re.findall(r'\$\$\w+', TEMPLATE)
|
||||
VARIABLES = ""
|
||||
|
||||
for i in ALLVARIABLES:
|
||||
if VARIABLES.find(i) == -1:
|
||||
VARIABLES = VARIABLES +" "+ i
|
||||
|
||||
VARIABLES = re.sub('[$$]', '', VARIABLES)
|
||||
|
||||
printheader()
|
||||
|
||||
# BODY
|
||||
print('<form action="/create.py">')
|
||||
print('Nom du VirtualHost : <input type="text" name="VHOSTNAME"><br>')
|
||||
|
||||
for i in VARIABLES.split():
|
||||
print(i, ':')
|
||||
print('<input type="text" name="', i , '"><br>', sep="")
|
||||
|
||||
print('<input type="submit" value="GO">')
|
||||
|
||||
print('</form>')
|
||||
print('<br><a href="', PROTO , '://', DOMAIN , '/index.py">Retour</a>', sep='')
|
||||
|
||||
|
||||
printfooter()
|
||||
|
||||
Reference in New Issue
Block a user