mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
session check for rmupdate.html (former index.html) via new index.cgi
This commit is contained in:
parent
13ca418ce2
commit
842cecf8d3
@ -1,5 +1,5 @@
|
||||
{
|
||||
CONFIG_URL /addons/rmupdate
|
||||
CONFIG_URL /addons/rmupdate/index.cgi
|
||||
CONFIG_DESCRIPTION {
|
||||
de {<li>System-Update</li>}
|
||||
en {<li>System-update</li>}
|
||||
|
36
addon/www/index.cgi
Normal file
36
addon/www/index.cgi
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/tclsh
|
||||
|
||||
load tclrega.so
|
||||
|
||||
catch {
|
||||
set input $env(QUERY_STRING)
|
||||
set pairs [split $input &]
|
||||
foreach pair $pairs {
|
||||
if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
|
||||
set $varname $val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[info exists sid] > 0} {
|
||||
# Session prüfen
|
||||
if {
|
||||
([string index $sid 0] != "@")
|
||||
|| ([string index $sid [expr [string length $sid] -1]] != "@")
|
||||
|| ([string length $sid] != 12)} {
|
||||
puts {error: session invalid}
|
||||
} else {
|
||||
regsub -all {@} $sid "" sid
|
||||
set res [lindex [rega_script "Write(system.GetSessionVarStr('$sid'));"] 1]
|
||||
if {$res != ""} {
|
||||
# gültige Session
|
||||
set fp [open "/usr/local/addons/rmupdate/www/rmupdate.html" r]
|
||||
puts -nonewline [read $fp]
|
||||
close $fp
|
||||
} else {
|
||||
puts {error: session invalid}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
puts {error: no session}
|
||||
}
|
Loading…
Reference in New Issue
Block a user