aboutsummaryrefslogtreecommitdiffstats
path: root/webstats/scratch.lisp
blob: af68eb011d1e9db686edaa81bd13d1604af7ce41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(hunchentoot:define-easy-handler (vars-disp :uri "/vars") ()
  (setf (hunchentoot:content-type*) "text/plain")
  (format nil "Hey ~{~A ~% ~}~%"
          (list
           (remote-addr*)
           (header-in* :x-forwarded-for)
           (authorization)
           (hunchentoot::iso-time)
           (request-method*)
           (script-name*)
           (query-string*)
           (server-protocol*)
           (return-code*)
           (content-length*)
           (referer)
           (user-agent))))

(hunchentoot:define-easy-handler (link :uri "/link") ()
  (with-html-string
    (:doctype)
    (:html
     (:header (:title "hu yu ipi")
              (:script :src "/stats/stats.js" :type "text/javascript"))
     (:body
      (:p "learning "
          (:a :href "vars" "some explodiert")
          (:a :href "visit" "count visit"))
      (:form :action "/stats/visit"
             :method "post"
             (:input :type "text" :name "title")
             (:input :type "submit" :value "submit" :name "submit"))))))

;; (sqlite:with-open-database (db "test.db")
;;   (drop-stats-table db)
;;   (create-stats-table db))

;; (sqlite:with-open-database (db "test.db")
;;   (sqlite:with-transaction db
;;     (let ((ip "122.0.0.1")
;;           (agent "sly"))
;;       (add-ip db :ip ip)
;;       (add-user-agent db :user-agent agent)
;;       (insert db
;;               :click nil
;;               :page "ho"
;;               :referer "ref"
;;               :ip ip
;;               :user-agent agent
;;               :title "try"))))