Пример #1
0
<?php

require '../setup.php';
require $paths["dbObjects"] . "anonymous_users.php";
$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)) {
    echo "<p>Message successfully sent!</p>";
} else {
    echo "<p>Message delivery failed...</p>";
}
$user = new DataObjects_Anonymous_Users();
$user->anonuser_id = 1;
$user->get('email', '*****@*****.**');
while ($user->fetch()) {
    echo $user->email . '<br/>';
    echo $user->hash . '<br/>';
    echo $user->joinDate . '<br/>';
}
?>

Пример #2
0
$userReplyMsgs = array();
$userErrorMsgs = array();
$anonUser = null;
$sub = null;
if (!isset($_REQUEST['ffEmail']) || $_REQUEST['ffEmail'] == null) {
    //Can't do anything so error out.
    array_push($userErrorMsgs, ERROR_NO_EMAIL);
} else {
    if (!isset($_REQUEST['ffCategoryId']) || $_REQUEST['ffCategoryId'] == null) {
        //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);
                }
            }