abnrange
10-19-2008, 11:43 AM
Hi all,
Having problem with my user login. My project exceeds the 1mb limit please download from http://www.hamiltonschools.org/hess/download/scctest.zip
sorry for the size.
The problem. If up Publish>Preview, login username and password = admin1. That works fine - Once you page jump on the top right there is a logoff button. Click that it page jumps to a loggoff page. On that page is a login button. Click that and it get a nil value. This is where I got stuck. It works fine in other apps just not this one. That why I included the entire project.
If you page view it works fine!
Any help would be great - Thanks
abnrange
10-19-2008, 01:23 PM
This is the code that works on app start. Once you logff and click the login button which has the following code (same as on app start) I get "On Click, Attempt to call field 'ImportDataBase' (a nil value)." I don't understand why it works on startup and not on page jump to a logoff page. Attached is the same login script that works and is setup in my app - but fails to work in my app which can be downloaded from here. http://www.hamiltonschools.org/hess/...ad/scctest.zip
Thanks
User.ImportDatabase("AutoPlay\\Users\\user.db");
User.ImportDatabase = Application.RunScriptFile;
function User.ExportDatabase(sFile)
local str = "";
for i, v in User.N do
str = str.."User.Create(\""..v.."\", \""..User.P[i].."\");\r\n";
end
TextFile.WriteFromString(sFile, str, false);
end
function User.GetUsers()
return User.N;
end
------------------user login----------------
userprompt = Dialog.Input("Login", "Please enter a username.");
if (userprompt ~= "CANCEL") then
passprompt = Dialog.Input("Login", "Please enter a password.");
if (passprompt ~= "CANCEL") then
userauth = User.CheckAuthentication(userprompt, passprompt);
if (userauth == true) then
Dialog.TimedMessage("Login", "You have logged in successfully.", 2000, MB_ICONINFORMATION);
Page.Jump("Start");
else
--Dialog.TimedMessage("Login", "Failed to login.", 2000, MB_ICONINFORMATION);
Dialog.Message("Login Failed", "Please try again.");
userprompt = Dialog.Input("Login", "Please enter a username.");
if (userprompt ~= "CANCEL") then
passprompt = Dialog.Input("Login", "Please enter a password.");
if (passprompt ~= "CANCEL") then
userauth = User.CheckAuthentication(userprompt, passprompt);
if (userauth == true) then
Dialog.TimedMessage("Login", "You have logged in successfully.", 2000, MB_ICONINFORMATION);
Page.Jump("Start");
else
Dialog.TimedMessage("Login Failed", "Now Exiting!", 2000, MB_ICONINFORMATION);
Application.Exit(0);
end
end
end
end
end
end
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.