mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
add tcl libs for session check
This commit is contained in:
parent
cc45e7d034
commit
13ca418ce2
9
addon/lib/querystring.tcl
Normal file
9
addon/lib/querystring.tcl
Normal file
@ -0,0 +1,9 @@
|
||||
catch {
|
||||
set input $env(QUERY_STRING)
|
||||
set pairs [split $input &]
|
||||
foreach pair $pairs {
|
||||
if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
|
||||
set $varname $val
|
||||
}
|
||||
}
|
||||
}
|
13
addon/lib/session.tcl
Normal file
13
addon/lib/session.tcl
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/tclsh
|
||||
|
||||
load tclrega.so
|
||||
|
||||
proc check_session sid {
|
||||
if {[regexp {@([0-9a-zA-Z]{10})@} $sid all sidnr]} {
|
||||
set res [lindex [rega_script "Write(system.GetSessionVarStr('$sidnr'));"] 1]
|
||||
if {$res != ""} {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
Loading…
Reference in New Issue
Block a user