Пример #1
0
 //Construct a user auth object
 $auth = new RedcapAuth($username, NULL, $email, $fname, $lname, $zip, $city, $state, $actualage);
 //Checking this flag tells us whether there were any errors such as possible data duplication occured
 if ($auth->emailExists()) {
     $tempu = getUserByEmail($email);
     $olduser = new RedcapPortalUser($tempu->user_id);
     if ($olduser->isActive()) {
         //CURRENT ACCOUNT + ACTIVE (LINK ALREADY CLICKED)
         $errors[] = lang("ACCOUNT_EMAIL_IN_USE_ACTIVE", array($email));
     } else {
         //CURRENT ACCOUTN NOT ACTIVE
         if ($oldenough && $nextyear && $optin && $actualage >= 18) {
             //WAS FORMERLY INELIGIBLE NOW ELIGIBLE, SEND ACTIVATION LINK
             $errors[] = lang("ACCOUNT_NEW_ACTIVATION_SENT", array($email));
             //SEND NEW ACTIVATION LINK
             $olduser->updateUser(array(getRF("zip") => $zip, getRF("city") => $city, getRF("state") => $state, getRF("age") => $actualage));
             $olduser->createEmailToken();
             $olduser->emailEmailToken();
             //CLEAN UP
             unset($fname, $lname, $email, $zip, $city);
         } else {
             //WAS FORMERLY AND STILL IS INELIGIBLE
             addSessionMessage(lang("ACCOUNT_NOT_YET_ELIGIBLE", array("")), "notice");
         }
     }
 } else {
     //IF THEY DONT PASS ELIGIBILITY THEN THEY GET A THANK YOU , BUT NO ACCOUNT CREATION
     //BUT NEED TO STORE THEIR STUFF FOR CONTACT
     if ($oldenough && $nextyear && $optin && $actualage >= 18) {
         //Attempt to add the user to the database, carry out finishing  tasks like emailing the user (if required)
         if ($auth->createNewUser($password)) {