#!/usr/bin/env python

import cgi
form = cgi.FieldStorage()
ind = form.getfirst("index", "None")
index = int(ind)
List = []
pos = 0
File = open("rules2.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("rules2.txt", "w")
for item in List:
	File.write(item)
	pos2 =+1
File.close()

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

