-
Notifications
You must be signed in to change notification settings - Fork 0
/
wotlocal.lsp.template
60 lines (58 loc) · 1.98 KB
/
wotlocal.lsp.template
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
50
51
52
53
54
55
56
57
58
59
60
(context (quote wotlocal))
(set (quote getemailpwsmysql)
(lambda (sponsoremail "[email protected]")
(begin
(MySQL:init)
(set (quote servportuserpassdbtable) (parse (read-file wot:MYSQLACCESSFILE) ":"))
(MySQL:connect)
(setf (nth 0 MySQL:connect) (quote (host user passw database port)))
(setf (nth 1 MySQL:connect) (quote (not(= (MySQL:mysql_real_connect MySQL:MYSQL host user passw database port 0 0) 0))))
(MySQL:connect (nth 0 servportuserpassdbtable) (nth 2 servportuserpassdbtable) (nth 3 servportuserpassdbtable) (trim (nth 4 servportuserpassdbtable)) (int (nth 1 servportuserpassdbtable)))
(set (quote sponsoremail) (MySQL:escape sponsoremail))
(set (quote sponsoremail) (trim sponsoremail))
(set (quote querystring) (append "SELECT email, password FROM " (nth 4 servportuserpassdbtable) "." (nth 5 servportuserpassdbtable) "t1 WHERE t1.email = '" sponsoremail "' LIMIT 50") )
(MySQL:query querystring)
(if
(and (!= (MySQL:num-rows) nil) (> (MySQL:num-rows) 0))
(begin
(set (quote emailpwlist) (MySQL:fetch-all))
(MySQL:close-db)
(throw emailpwlist)
)
(begin
(MySQL:close-db)
(throw (list))
)
)
)
)
)
(set (quote getemailpwstextfile)
(lambda (sponsoremail "[email protected]")
(begin
(set (quote returnlist) (list))
(set (quote emailpwtext) (read-file "___KEYRINGDIRPATH___/users.json"))
(set (quote emailpwlist) (json-parse (read-file "___KEYRINGDIRPATH___/users.json")))
(if (= nil emailpwlist)
(begin
(print "json-error: " (json-error))
)
)
(map
(lambda (x)
(begin
(if (= sponsoremail (nth 0 x))
(begin
(set (quote returnlist) (append returnlist (list x)))
)
(begin
)
)
)
)
emailpwlist
)
(throw returnlist)
)
)
)