diff --git a/blogthon.cgi b/blogthon.cgi
index 5dd7d11..15e1fe5 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -43,6 +43,32 @@ if not post_display: post_display = ""
if not static_display: static_display = ""
if not allentries_display: allentries_display = ""
+# Commentstuff
+ctitle = action.getvalue('ctitle')
+cname = action.getvalue('cname')
+ctext = action.getvalue('ctext')
+if not ctitle: ctitle = ""
+if not cname: cname = ""
+if not ctext: ctext = ""
+
+# Comment to commit?
+if cname and ctext and ctitle:
+ # Prevent XSS hacks
+ cname = cname.replace("<", "<")
+ cname = cname.replace(">", ">")
+ cname = cname.replace("\"", """)
+ ctext = ctext.replace("<", "<")
+ ctext = ctext.replace(">", ">")
+ ctext = ctext.replace("\"", """)
+
+ # Add comment
+ comments_file = glob.glob(entries_dir + ctitle + '.comments')
+ content = open(comments_file[0], "a+")
+ content.write("-." + cname + "\n")
+ content.write("+." + time.asctime() + "\n")
+ content.write("." + ctext + "\n")
+ content.close()
+
print 'Content-type: text/html\n'
print ''
@@ -159,9 +185,10 @@ else: # Show regular entry
# Form for adding comments
print '
'
- print '