TGC Codebase Backup



Pentagon by Anonymous Coder

9th Jan 2005 15:13
Summary

A simple password protection program with a UI



Description

A simple password protection program with a UI taken from the codebase.
You still can get out of it, so I need a little help to disable the Win key, for example. Enjoy!



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` Created by Alan Reid. The UI was taken from the Darkbasic Codebase at
` http://darkbasic.thegamecreators.com/
' UPDATED: 8/10/2005

Sync on
Sync rate 300

Do
cls 0
ink rgb(255,255,255),1
print "Loading services..               [OK]"
sleep 2000
print "Loading Windows XP Support..   [FAILED]"
sleep 700
print "Loading application..            [OK]"
sleep 1000
print "Starting program.."
sleep 2000

cls 0
ink rgb(128,128,128),1
box 200,180,440,270

ink rgb(0,0,255),1
box 200,180,440,197

ink rgb(255,255,255),1
set cursor 210,180
center text 320,100,"PENTAGON SECURITY SYSTEM 2005"
print "Pentagon 2005"
ink 0,1
box 215,240,425,255

`outline
ink rgb(100,100,100),1
box 200,198,201,270
box 200,269,440,270
box 439,198,440,270
box 214,240,215,255
box 425,240,426,255
box 215,239,426,240
box 215,255,426,256

`blue outline
ink rgb(0,0,200),1
box 200,180,201,197
box 439,180,440,197
box 200,180,440,181
box 200,196,440,197

ink rgb(0,0,0),1
center text 320,200,"PLEASE CREATE A PASSWORD:"
ink rgb(255,255,255),1
set cursor 220,240
input createpass$
goto start

sync
loop

start:
Do
cls 0
ink rgb(255,255,255),1
center text 320,100,"PENTAGON SECURITY SYSTEM 2005"

if makebutton(320,200,"Lock PC")>0 
	buttonpressed=1
	goto lock
endif
if makebutton(320,250,"Credits")>0 
	buttonpressed=2
	goto credits
endif
if makebutton(320,350,"Exit")>0 
	buttonpressed=4
	goto esc
endif

sync
loop


lock:
cls 0
disable escapekey
disable systemkeys
Sync on
Sync rate 300

Do
cls 0
ink rgb(128,128,128),1
box 200,180,440,270

ink rgb(0,0,255),1
box 200,180,440,197

ink rgb(255,255,255),1
set cursor 210,180
center text 320,100,"PENTAGON SECURITY SYSTEM 2005"
print "Pentagon 2005 - System Protected"
ink 0,1
box 215,240,425,255

`outline
ink rgb(100,100,100),1
box 200,198,201,270
box 200,269,440,270
box 439,198,440,270
box 214,240,215,255
box 425,240,426,255
box 215,239,426,240
box 215,255,426,256

`blue outline
ink rgb(0,0,200),1
box 200,180,201,197
box 439,180,440,197
box 200,180,440,181
box 200,196,440,197

ink rgb(0,0,0),1
center text 320,200,"ENTER PASSWORD:"
ink rgb(255,255,255),1
set cursor 220,240
input pass$

if pass$=createpass$ 
	goto start
else
	ink rgb(255,0,0),1
	center text 320,270,"Invalid password! Try again."
	sleep 2000
	cls 0
	goto lock
endif

sync
loop


credits:
cls 0
print "P R O G R A M  C R E A T E D  B Y  A L A N  R E I D"
print "========================================================================"
print ""
print "Programmed & developed by Alan Reid."
print "Some part of the code was taken from other sources."
print "Program distributed under GPL."
print "Please inform bugs: alanreid14@gmail.com"
print "Press any key to return."
suspend for key
cls 0
goto start

esc:
cls 0
print "Thank you for using Pentagon Security System 2005!"
sleep 3000
end

function makebutton(x,y,desc$)
	buttonpressed=0
	ink rgb(0,255,255),0 : box x-52,y-14,x+52,y+14
	ink rgb(0,0,255),0 : box x-50,y-12,x+50,y+12
	ink rgb(0,128,0),0
	myx=mousex() : myy=mousey()
	if myx>x-50 and myx<x+50
		if myy>y-12 and myy<y+12
			buttonpressed=1
		endif
	endif
	if buttonpressed=1 then ink rgb(255,255,0),0
	set text size 18 : center text x,y-8,desc$
	if mouseclick()=0 then buttonpressed=0
endfunction buttonpressed