TGC Codebase Backup



Password protection by The Wilderbeast

20th Oct 2005 14:23
Summary

Stops users getting past wihtout there password and username



Description

Stops users getting past wihtout there password and username



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem Saves usernames in C:\
rem By Michael Wild
main:
cls
set dir "C:\"
print "Set up new acount(1)"
print "Login(2)"
print "Press 1 or 2>"
input a 
if a= 1 then goto na
if a= 2 then goto login

na:
cls
input "Username>";user$
input "Password>";pass$

make directory user$
set dir user$
open to write 1,"login.dat"
write string 1,user$
write string 1,pass$
close file 1

print "Acount created successuly!"
print "Press any key"
suspend for key
goto main

login:
cls
set dir "C:\"
input "Username>";luser$
input "Password>";lpass$
set dir luser$
open to read 1,"login.dat"
read string 1,user$
read string 1,pass$

if luser$= user$
print "Correct username"
else
print "Wrong username"
endif

if lpass$= pass$
print "Correct password"
goto yourlabelhere
else
print "Wrong password"
endif

yourlabelhere:
print "Rest of your program goes here"