#!/usr/bin/env python

import cgi
form = cgi.FieldStorage()
ind = form.getfirst("index", "None")
index = int(ind)
List = []
pos = 0
File = open("/home/ruler/reconfig/users.txt")
for line in File:
	List.insert(pos,line)
	pos +=1
File.close()
Removed = List[index]
Unam = Removed.split(",")
List.pop(index)

pos2 = 0
File = open("/home/ruler/reconfig/users.txt", "w")
for item in List:
	File.write(item)
	pos2 =+1
File.close()

print("Content-type: text/html\n")
print("<h1>" + "User " + Unam[1] + " was removed" + "</h1>")
#print(index)
#print(List[0])
#print(List[72])
#print(List)
print("""<p><a href="main.py">Return back</a></p>""")
print("""<meta http-equiv="refresh" content="5;main.py">""")

