#!/usr/bin/wish -f

wm title	. "DETOUR.NET atualizer by k-s"
wm geometry	. 310x190

global USERNAME1
global PASSWORD1

set USERNAME1 [exec cat /root/.detour | grep USERNAME | cut -d= -f2] 
set PASSWORD1 [exec cat /root/.detour | grep PASSWORD | cut -d= -f2]
set USERNAME $USERNAME1
set PASSWORD $PASSWORD1

label .detour	-text "Detour.net atualizer" -font "-adobe-courier-bold-*-normal-*-24-*-*-*-*-*-*-*-*" \
		   -foreground "darkgreen"
label .usrtxt	-text "Username:"
label .pwdtxt	-text "Password:"
label .modtxt	-text "Mode:"

entry .user	-textvariable USERNAME
entry .pass	-textvariable PASSWORD

radiobutton .moderb1 -text "ADD" -variable VMODE -value "ADD"
radiobutton .moderb2 -text "DEL" -variable VMODE -value "DEL"


button .bok	-text " OK "   -command { dothethings $USERNAME $PASSWORD $VMODE}
button .bexit	-text " EXIT " -command exit
button .bmyhp	-text "k-s Linux Programs" -font "-adobe-courier-bold-*-normal-*-10-*-*-*-*-*-*-*-*" \
		   -foreground green -background black -command { exec netscape http://www.angelfire.com/ks/linuxprg/} \
		   -justify center -borderwidth 0

place .detour	-x 5   -y 0   -width 300
place .usrtxt   -x 20  -y 50
place .user	-x 90  -y 50  -width 200 -height 25
place .pwdtxt   -x 20  -y 75
place .pass     -x 90  -y 75  -width 200 -height 25
place .modtxt	-x 20  -y 100 
place .moderb1	-x 70  -y 100 -width 50	 -height 25
place .moderb2	-x 150 -y 100 -width 50  -height 25 
place .bok	-x 50  -y 130 -width 50  -height 30
place .bexit	-x 210 -y 130 -width 50  -height 30
place .bmyhp	-x 5   -y 170 -width 300 -height 15

proc dothethings { USERNAME PASSWORD MODE} {
	exec pdc.pl $USERNAME $PASSWORD $MODE
		exec echo "USERNAME=$USERNAME\nPASSWORD=$PASSWORD" >  /root/.detour
}
