Commits

Dobrosław Żybort committed 600d9c8

Record IP

Comments (0)

Files changed (2)

 
 func insertPaste(paste *Paste, ctx *Context) (lastId int64, err error) {
 	result, err := ctx.Database.Exec(`
-		insert into pastes(Title, Author, Datetime, Data, Protection, Syntax) 
-		values (?, ?, ?, ?, ?,?)`,
+		insert into pastes(Title, Author, Datetime, Data, Protection, Syntax, IP) 
+		values (?, ?, ?, ?, ?,?, ?)`,
 		paste.Title,
 		paste.Author,
 		paste.Datetime,
 		paste.Data,
 		paste.Protection,
-		paste.Syntax)
+		paste.Syntax,
+		paste.IP)
 
 	if err != nil {
 		return 0, err
 	}
 	paste.Protection = pasteData.Protection
 	paste.Syntax = pasteData.Syntax
+	paste.IP = req.RemoteAddr
 
 	lastId, err := insertPaste(paste, ctx)