示例#1
0
文件: comments.php 项目: scirelli/bod
$adminErrorMsgs = array();
if (!isset($_REQUEST['ffEmail'])) {
    //Can't do anything so error out.
    array_push($errorMsgs, 'No email value received.');
    array_push($adminErrorMsgs, 'No email value received.');
} else {
    if (!isset($_REQUEST['ffCategoryId'])) {
        //Can't do anything so error out.
        array_push($errorMsgs, 'No letter category value received. <br/> This is an internal error and an Admin has been notified.');
        array_push($adminErrorMsgs, 'No letter category value received. _REQUEST[] = ' . var_export($_REQUEST, true));
    } else {
        //We have the info we need so lets process it.
        try {
            //If possible create a user and get an id
            $tmp = new DataObjects_Anonymous_Users($_REQUEST['ffEmail']);
            if ($tmp->insertAnonUser() === false) {
                array_push($errorMsgs, 'Could not insert new user. An administrator has been notified');
                array_push($adminErrorMsgs, 'Could not insert user. <br/> Insert returned false. $tmp = ' . var_export($tmp, true));
            }
        } catch (Exception $e) {
            array_push($errorMsgs, 'Unable to create a user with email address \'' . $_REQUEST['ffEmail'] . '\'. User possibly already exists. An administrator has been notified.');
            array_push($adminErrorMsgs, 'Email: ' . $_REQUEST['ffEmail'] . ' Exception: ' . $e->getMessage());
        }
    }
}
var_dump($errorMsgs);
var_dump($adminErrorMsgs);
$to = "testuser@127.0.0.1";
$subject = "This is a TEST this is only a TEST";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
示例#2
0
     //Can't do anything so error out.
     array_push($userErrorMsgs, ERROR_NO_CATEGORY);
 } else {
     //We have the info we need so lets process it.
     try {
         //If possible create a user and get an id
         $anonUser = new DataObjects_Anonymous_Users();
         if ($anonUser->createAnonUser($_REQUEST['ffEmail']) === false) {
             //The user exsits already
             if (!$anonUser->validated) {
                 //The user exists but has not validated their email yet. Notify them that they need to validate their email and give them the option to resend validation email.
                 array_push($userReplyMsgs, REPLY_ALREADY_EXISTS);
             }
         } else {
             //The user did not exist so insert them.
             if ($anonUser->insertAnonUser() === false) {
                 array_push($userErrorMsgs, ERROR_NO_INSERT);
             } else {
                 //New user created, Notify them that an email has been set to the email address provided, and that they need to validate that email. Once validated they will recieve the news letters
                 array_push($userReplyMsgs, REPLY_VALIDATE_EMAIL);
             }
         }
         //$anonUser now holds the id of a user. Attempt to subscribe them to a news letter. Note to the user that They will only receive news letters if their email was validated.
         try {
             //echo 'About to create  DataObjects_Anonymoususers_NewslettersCategories. anonUser= '******'ffCategoryId']);
             //echo '<br/>DataObjects_Anonymoususers_NewslettersCategories created sub = '; var_dump($sub);
             if ($sub->insertSubscription() === false) {
                 array_push($userErrorMsgs, ERROR_NO_CREATE);
             } else {
                 //echo '<br/>DataObjects_Anonymoususers_NewslettersCategories inserted sub = '; var_dump($sub);