#!C:\Python36\python.exe
# -*- coding: utf-8 -*-
import json
import cgi
pagenum = cgi.FieldStorage()
if pagenum['login'].value == 'admin' and pagenum['password'].value == '12345':
	print("Content-Type: text/html;")
	print("Set-Cookie: role=1;")
	print("Set-Cookie: uname=admin;")
	print("")
	print('<!DOCTYPE html><html lang=""><head><meta http-equiv="refresh" content="0; url=/" /></head></html>')
elif pagenum['login'].value == 'user' and pagenum['password'].value == '1234':
	print("Content-Type: text/html;")
	print("Set-Cookie: role=2;")
	print("Set-Cookie: uname=user;")
	print("")
	print('<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=/" /></head></html>')
else :
	print("Content-Type: text/html;")
	print("")
	print('<!DOCTYPE html><html><head><meta charset="cp1251"><meta http-equiv="refresh" content="3; url=/login.html" /></head><center><h2>Не правильный логин или пароль</h2></center></html>')
