hsoltau Posted September 14, 2006 Share Posted September 14, 2006 (edited) Hello folks, iam trying to make a frontend gui for a web application in our hospital, that shows the x-ray images from patients... to secure the correct user and password for the clinician who uses this app, iam trying to make a gui for the user and password authentification, after a sucsessfull login, the main gui should start... this is what i have sofar: expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> $Form0 = GUICreate("User | Passwort Abfrage",220,100, -1, -1) $userr = GUICtrlCreateInput ("Benutzer",2,2,100,22) $passs = GUICtrlCreateInput ("Passwort",2,32,100,22,$es_password) $go = GUICtrlCreateButton ("OK",2,62) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $go if GUICtrlRead ($userr) <> "Soltau" or GUICtrlRead ($passs) <> "test" then MsgBox (4096,"Warnung","Falscher Benutzer oder Passwort") Exit ElseIf GUICtrlRead ($userr) = "Soltau" or GUICtrlRead ($passs) = "test" then msgbox (0,"Erfolgreiche Anmeldung", "Sie werden im Hauptprogramm angemeldet", 2) Sleep (1000) Send ("{ESC}") EndIf EndSelect WEnd $Form1 = GUICreate("PACS Webviewer Gui", 461, 350, 292, 225) ;GUISetBkColor (0xA0FdFF) $Label1 = GUICtrlCreateLabel("Patienten ID",3,23) $Input1 = GUICtrlCreateInput("", 72, 23, 129, 21) $Label2 = GUICtrlCreateLabel("Pat. Name *",3,52) $Input2 = GUICtrlCreateInput("", 72, 50, 129, 21) $Label3 = GUICtrlCreateLabel("Pat. Vorname ",230,52) $Input3 = GUICtrlCreateInput("", 323, 50, 129, 21) $LabelradDate1 = GUICtrlCreateLabel("Unt. Datum", 3,103) $comment1 = GUICtrlCreateLabel("* Felder sind Pflichtfelder",230,21,250,48,$SS_simple) GUIStartGroup() $radDate1 = GUICtrlCreateRadio("ohne",70,100,70) $radDate2 = GUICtrlCreateRadio("heute",145,100,70) $radDate3 = GUICtrlCreateRadio("gestern",220,100,70) $radDate4 = GUICtrlCreateRadio("Eingabe -->",300,100,75) GUICtrlSetState ($radDate1,$GUI_CHECKED) $InputDate1 = GUICtrlCreateInput("",380,100,70) $LabelMod1 = GUICtrlCreateLabel("Unt. Art",3,143) GUIStartGroup() $radMod1 = GUICtrlCreateRadio("Alle",70,140,70) $radMod2 = GUICtrlCreateRadio("MR",145,140,70) $radMod3 = GUICtrlCreateRadio("CR",220,140,70) $radMod4 = GUICtrlCreateRadio("CT",300,140,70) GUICtrlSetState ($radMod1,$GUI_CHECKED) $button1 = GUICtrlCreateButton("Starte Webviewer (ENTER Taste drücken)", 80,200,300,30,$BS_DEFPUSHBUTTON ) $button2 = GUICtrlCreateButton("EXIT", 411,300,50,30) $button3 = GUICtrlCreateButton("Reset", 1,300,50,30) GUICtrlSetTip($button1,"Startet den Webviewer mit den gewählten Daten" & Chr(13) & "Lassen Sie den Webviewer geöffnet und wechseln mit Alt-Tab zurück") GUICtrlSetTip($button2,"Beendet das Programm") GUICtrlSetTip($button3,"Löscht die Eingabefelder") GUICtrlSetTip($Input1,"Patienten Nummer: 10 Stellen") GUICtrlSetTip($Input2,"Patienten Nachname: Komplett oder Anfangsbuchstaben" & Chr(13) & "Ist ein Pflichtfeld !!!") GUICtrlSetTip($Input3,"Patienten Vorname: Komplett oder Anfangsbuchstaben") GUICtrlSetTip($radDate1,"Abfrage ohne Datumseingrenzung") GUICtrlSetTip($radDate2,"Untersuchungen nur von heute") GUICtrlSetTip($radDate3,"Untersuchungen nur von gestern") GUICtrlSetTip($radDate4,"Wählen Sie diese Option und geben ein bestimmtes Datum in das Eingabefeld ein im Format 24.12.2006") GUICtrlSetTip($radMod1,"Alle Untersuchungsarten") GUICtrlSetTip($radMod2,"Nur MR Untersuchungen werden angezeigt") GUICtrlSetTip($radMod3,"Nur CR Untersuchungen werden angezeigt") GUICtrlSetTip($radMod4,"Nur CT Untersuchungen werden angezeigt") GUICtrlSetTip($InputDate1,"Geben Sie hier ein Datum im Format 24.12.2006 ein") GUICtrlCreateGroup ("Patienten Daten",0,0,460,80) GUICtrlCreateGroup ("Untersuchungsdaten",0,80,460,100) $statuslabel = GUICtrlCreateLabel(@ComputerName & " " & @IPAddress1 & " " & @UserName , 0,335,461,25,$SS_sunken) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $button1 $patId = GUICtrlRead($Input1) $name = GUICtrlRead($Input2) $vname = GUICtrlRead($Input3) $name = $name &"%" & $vname if GUICtrlRead ($radDate1) = $GUI_CHECKED Then $date = "" ElseIf GUICtrlRead ($radDate2) = $GUI_CHECKED Then $date = _nowcalcdate() $date = _DateTimeFormat($date,2) elseif GUICtrlRead ($radDate3) = $GUI_CHECKED Then $date = _DateAdd( 'd',-1, _NowCalcDate()) $date = _DateTimeFormat($date,2) elseif GUICtrlRead ($radDate4) = $GUI_CHECKED Then $date = guictrlread ($InputDate1) EndIf if GUICtrlRead($radMod1) = $GUI_CHECKED Then $mod ="" elseif GUICtrlRead($radMod2) = $GUI_CHECKED Then $mod = "MR" Elseif GUICtrlRead($radMod3) = $GUI_CHECKED Then $mod = "CR" elseif GUICtrlRead($radMod4) = $GUI_CHECKED Then $mod = "CT" EndIf if $name = "%" Then MsgBox (0, "Warnung", "Bitte geben Sie den Nachnamen des Patienten ein !") Else run ("C:\standardprogramme\sapgui\Pacsweb\CwApiTool.exe -batch -user ***** -passwd ***** -server hdweb1 -mode showlist -pat_name " & $name & " -ris_pat_id " & $patId & " -modality_code " & $mod & " -study_dttm " & $date & " -sts_stat Y") EndIf ;run ("C:\standardprogramme\sapgui\Pacsweb\CwApiTool.exe -batch -user ***** -passwd ***** -server hdweb1 -mode showlist -pat_name " & $name & " -modality_code CT " & " -ris_pat_id " & $patId") case $msg = $button2 Exit case $msg = $button3 GUICtrlSetData($Input1 ,"") GUICtrlSetData($Input2 ,"") GUICtrlSetData($Input3 ,"") GUICtrlSetState ($radDate1,$GUI_CHECKED) GUICtrlSetState ($radMod1,$GUI_CHECKED) Case Else ;;;;;;; EndSelect WEnd Exit iam goofing around with the if conditions, thats not a very nice solution... should i better use an extra script for user password thingy and include in the main script ??? how to do this ? i have tried searching the forum, but nothing ... any ideas to make my weak code better ? thanx in advance and sorry for my bad english again... Henning Edited September 14, 2006 by hsoltau Link to comment Share on other sites More sharing options...
YozY Posted September 17, 2006 Share Posted September 17, 2006 OK here's what i have First you have a loginGUI, and after a succesful login you get the mainGUI i have a seperate file for the mainGUI (main.au3) the usernames and passwords are stored in an ini file (pass.ini) so it reads from there expandcollapse popup#NoTrayIcon #include <GuiConstants.au3> #include <include\md5.au3> Global $savefolder, $username $savefolder = "\\Server\SAVE" FileInstall("loginbg.jpg", "loginbg.jpg", 1) FileInstall("mainbg.jpg", "mainbg.jpg", 1) FileInstall("loadbg.jpg", "loadbg.jpg", 1) FileInstall("games.ini", "games.ini", 1) #include <include\images.au3> $LoginGUI = GUICreate("AD User Center", 275, 80, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX) $Move = GUICtrlCreateLabel("", 1, 0, 232, 15) GUICtrlSetTip($Move, "Verplaatsen") $Close = GUICtrlCreateLabel("", 259, 10, 10, 10) GUICtrlSetTip($Close, "Afsluiten") $background = GUICtrlCreatePic("loginbg.jpg", 0, 0, 275, 80) GUICtrlSetState($background, $GUI_DISABLE) GuiSetIcon("users.ico", 0) $font = "Calibri" GUISetFont (10, 800, 0, $font) $labelusername = GUICtrlCreateLabel ("Gebruikersnaam:", 15, 32) GUICtrlSetBkColor($labelusername, $GUI_BKCOLOR_TRANSPARENT) $username = GUICtrlCreateInput ("", 120, 30, 100, 20, $ES_NOHIDESEL + $ES_LOWERCASE) $labelpassword = GUICtrlCreateLabel ("Wachtwoord:", 35, 56) GUICtrlSetBkColor($labelpassword, $GUI_BKCOLOR_TRANSPARENT) $password = GUICtrlCreateInput ("", 120, 54, 100, 20, $ES_NOHIDESEL + $ES_LOWERCASE + $ES_PASSWORD) $loginbtn = GUICtrlCreateButton ("", 0, 0, 1, 1, $BS_DEFPUSHBUTTON) $loginlabel = GUICtrlCreateLabel("", 235, 33, 29, 29) GUICtrlSetTip($loginlabel, "Login") GUICtrlSetBkColor($loginlabel, $GUI_BKCOLOR_TRANSPARENT) RoundGUI($LoginGUI, 0, 0, 5, 5) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $LoginGUI, "int", 200, "long", 0x00080000) GuiSetState(@SW_HIDE) GuiSetState(@SW_SHOW) While 1 $Message = GUIGetMsg() Select Case $Message = $GUI_EVENT_CLOSE Or $Message = $Close DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $LoginGUI, "int", 100, "long", 0x00090000) Exit Case $Message = $Move DllCall("user32.dll", "int", "ReleaseCapture") DllCall("user32.dll", "int", "SendMessage", "hWnd", $LoginGUI, "int", 0xA1, "int", 2, "int", 0) Case $Message = $loginbtn OR $Message = $loginlabel $username = GUICtrlRead($username) IniReadSection(""& $savefolder &"\pass.ini", ""& $username &"") If @error Then MsgBox(0, "Error", "Uw gebruikersnaam werd niet gevonden") Exit Else $passwordmd5 = _md5(GUICtrlRead($password)) $check = IniRead(""& $savefolder &"\pass.ini", ""& $username &"", "pass", "") If $passwordmd5 = $check Then Else MsgBox(0, "Error", "U heeft een verkeerde wachtwoord ingegeven.") Exit EndIf EndIf DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $LoginGUI, "int", 100, "long", 0x00090000) #include <include\main.au3> EndSelect WEnd #include <include\functions.au3> i hope this helps Link to comment Share on other sites More sharing options...
hsoltau Posted September 17, 2006 Author Share Posted September 17, 2006 Thanks Yozy for the reply, i have to look over your code, so much to understand... you use dllcall and a md5.au3, so I have to learn a littlebit about that... thanks again Henning Link to comment Share on other sites More sharing options...
YozY Posted September 17, 2006 Share Posted September 17, 2006 Thanks Yozy for the reply,i have to look over your code, so much to understand...you use dllcall and a md5.au3, so I have to learn a littlebit about that... thanks againHenningwell it was just an example to show you how i do iti use md5 for password encyrption but you can leave that out if you wantalso the dllcall i use is to create a fade in/out effectif u need any help you can pm me if u want Link to comment Share on other sites More sharing options...
hsoltau Posted September 17, 2006 Author Share Posted September 17, 2006 well it was just an example to show you how i do iti use md5 for password encyrption but you can leave that out if you wantalso the dllcall i use is to create a fade in/out effectif u need any help you can pm me if u wantwhat ist his code for ?RoundGUI($LoginGUI, 0, 0, 5, 5)cant find in help file, is it in images.au3 ?where do i get md5.au3 and images.au3 ?greetingsHenning Link to comment Share on other sites More sharing options...
YozY Posted September 17, 2006 Share Posted September 17, 2006 what ist his code for ?RoundGUI($LoginGUI, 0, 0, 5, 5)cant find in help file, is it in images.au3 ?where do i get md5.au3 and images.au3 ?greetingsHenningwell i use the RoundGUI() function to make my GUI look nicer, you can find the UDF in this forumimages.au3 installs the images i need for the au3 so you don't need itand i attached md5.au3, you can use it if u wantmd5 is an encyrption, you can use it to secure your passwordsbut beware, you can't retrieve the original password after it's encyrypted, you can only change itmd5.au3 Link to comment Share on other sites More sharing options...
hsoltau Posted September 18, 2006 Author Share Posted September 18, 2006 well i use the RoundGUI() function to make my GUI look nicer, you can find the UDF in this forumimages.au3 installs the images i need for the au3 so you don't need itand i attached md5.au3, you can use it if u wantmd5 is an encyrption, you can use it to secure your passwordsbut beware, you can't retrieve the original password after it's encyrypted, you can only change itDear Yozy,another question: but how do you break into the main.au3in your code I see this: If $passwordmd5 = $check Thenand#include <include\main.au3>what is the correct syntax for calling the main program(sorry again for my noooob questions) Henning Link to comment Share on other sites More sharing options...
YozY Posted September 18, 2006 Share Posted September 18, 2006 well here's how the main.au3 file should look like expandcollapse popup$MainGUI = GUICreate("AD User Center", 570, 320, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX) $Move = GUICtrlCreateLabel("", 1, 0, 534, 20) GUICtrlSetTip($Move, "Verplaatsen") $Minimize = GUICtrlCreateLabel("", 535, 9, 10, 10) GUICtrlSetTip($Minimize, "Minimaliseren") $Close = GUICtrlCreateLabel("", 548, 9, 10, 10) GUICtrlSetTip($Close, "Afsluiten") $background = GUICtrlCreatePic ("mainbg.jpg", 0, 0, 570, 320) GUICtrlSetState($background, $GUI_DISABLE) GuiSetIcon("users.ico", 0) GUISetFont (14, 0, 0, $font) $top = GUICtrlCreateLabel ("Klik op een spel om deze te starten", 140, 25, 290, 25, $SS_CENTER) GUICtrlSetColor($top, 0x328297) GUICtrlSetBkColor($top, $GUI_BKCOLOR_TRANSPARENT) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $MainGUI, "int", 200, "long", 0x00080000) GuiSetState(@SW_SHOW) While 1 $Message = GUIGetMsg() Select Case $Message = $GUI_EVENT_CLOSE Or $Message = $Close DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $MainGUI, "int", 100, "long", 0x00090000) Exit Case $Message = $Minimize GUISetState(@SW_MINIMIZE) Case $Message = $Move DllCall("user32.dll", "int", "ReleaseCapture") DllCall("user32.dll", "int", "SendMessage", "hWnd", $MainGUI, "int", 0xA1, "int", 2, "int", 0) EndSelect WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now