/* Look up the email address (which is used as the username). Find the password. Compare. */ bool foundemail; string dbpassword; main() { DatabaseTables("Developers", "Developers"); if (foundemail = Developers.Find("email == '" + email + "'")) { dbpassword = Developers.password.Get(); } switch (Button) { case "Login": Login(); break; case "Oops": Oops(); break; } } Login() { if (!foundemail) <$Couldn't find your email: in the database. Please reregister. Thanks.$> else { if (password == dbpassword) { // put a session cookie WriteCookie("Developer", "yes"); DeveloperName = Developers.Name.Get(); <$Welcome, .$> WriteCookie("DeveloperName", DeveloperName, "31-DEC-2002 00:00:00 GMT", "", "", 0); } else { <$Sorry. Password not correct. Your password is being emailed to you.

$> Oops(); } } } Oops() { Name = Developers.Name.Get(); msg = "Dear : Your password for CloudWriter.com is ."; msg1 = Replace1(msg); // non-encoded replace .. looks for non-encoded // send the email SendMail("john@vermontdatabase.com", email, msg1); // email comes from from // Client << msg1; <$Thank you, . An email with your username and password has been sent to you at .$> } bool CheckCookie() { return _Cookie["Developer"] == "yes"; } Check() { if (CheckCookie()) <$Developer is logged in.
$> else <$Developer is NOT logged in.
$> } DoInclude() { Include(IncludeFile); } CheckInclude() { if (CheckCookie()) DoInclude(); else <$You must be logged in as a developer to go to this page.
$> }