Good bye."; include "include/footer.inc.php"; exit; } if($_GET['cmd'] == "approve" && $_GET['email'] && $_GET['code']) { $email=$_GET['email']; $code=$_GET['code']; // this one either works or fails... enableuser($email, $code); include "include/header2.inc.php"; echo "Your account has been enabled. You can login now."; $_POST['email']=$email; // include "include/footer.inc.php"; // exit; } if($_GET['cmd'] == "reallyunregister" && $_GET['email'] && $_GET['code']) { $email=$_GET['email']; $code=$_GET['code']; if($code == md5("SWI".$email.$DB_PASSWORD)) { disableuser($email); include "include/header2.inc.php"; echo "Your account has been permanently deleted. If you ever want to come back, please register again."; include "include/footer.inc.php"; exit; } } else if($_GET['cmd'] == "unregister" && $_GET['email'] && $_GET['code']) { $email=$_GET['email']; $code=$_GET['code']; if($code == md5("SWI".$email.$DB_PASSWORD)) { disableuser($email); include "include/header2.inc.php"; if(manage()) { echo "Manager accounts can't be deleted this way."; } else { echo "You have choosen to permanently delete your account. Please confirm."; echo "
"; echo "Yes, I confirm to be unregistered."; echo "
";
echo "No, I want to keep my account.";
}
include "include/footer.inc.php";
exit;
}
}
else if($_GET['cmd'] == "create")
{
$dest=$_POST['email'];
// look if already defined!!! - or we can overwrite an existing record
$passwd=$_POST['passcode'];
include "include/header2.inc.php";
// should check that dest has one @ and at least one . in it
if($dest && $passwd)
{
$code=createuser($dest, $passwd);
$subject="$TITLE - Account approval";
$body="Thank you very much for registering the account $dest for access to $TITLE.\n\n";
$body.="To finally enable your account, please follow this link: ";
$body.="$URL/login.php?cmd=approve&email=".htmlentities($dest)."&code=".htmlentities($code)."\n\n";
$body.="If you did not want to register (again), please ignore and delete this mail.";
sendmail($dest, $subject, $body);
echo "You have been registered and an email has been sent to your e-mail address.
Please follow the link in the mail to finally enable your account.";
include "include/footer.inc.php";
exit;
}
else
{ // allow to retype
echo "You must enter an email address and choose a password.";
$_GET['cmd']="reregister";
}
}
if(isloggedin())
{
dologout();
include "include/header2.inc.php";
if(!manage())
{
$code=md5("SWI".$_POST['email'].$DB_PASSWORD);
echo "You are already logged in.";
echo "[Unregister]";
}
else
echo "You are already logged in as Manager.";
include "include/footer.inc.php";
exit;
}
if($_GET['cmd'] == "login" && $_POST['email'] && $_POST['passcode'])
{
if(dologin($_POST['email'], $_POST['passcode']))
{
include "include/header2.inc.php";
$code=md5("SWI".$_POST['email'].$DB_PASSWORD);
echo "[Unregister]";
echo "
"; echo "Successsfully logged in for approx. 1 hour."; include "include/footer.inc.php"; exit; } } if($_GET['cmd'] == "approve") ; else if($_GET['cmd'] == "reregister") $_GET['cmd']="register"; else if($_GET['cmd'] == "register") { include "include/header2.inc.php"; echo "Please use your e-mail address as the account name and choose a (new) password."; } else { include "include/header2.inc.php"; echo "Please log in with your e-mail address and password. To change the password, simply re-register."; } ?>