Example #1
0
 function sendnewpassword($mail)
 {
     global $lang;
     $ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '" . $mail . "' LIMIT 1;", 'users', true);
     if (empty($ExistMail['email'])) {
         message($lang['mail_not_exist'], "index.php?page=lostpassword", 2, false, false);
     } else {
         $Caracters = "aazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN1234567890";
         $Count = strlen($Caracters);
         $NewPass = "";
         $Taille = 6;
         srand((double) microtime() * 1000000);
         for ($i = 0; $i < $Taille; $i++) {
             $CaracterBoucle = rand(0, $Count - 1);
             $NewPass = $NewPass . substr($Caracters, $CaracterBoucle, 1);
         }
         $Title = $lang['mail_title'];
         $Body = "Hallo ShadoX,\n\n";
         $Body .= "dein Passwort für " . $game_config['game_name'] . " lautet:\n\n";
         $Body .= $NewPass . "\n\n";
         $Body .= "Du kannst dich damit unter " . REGURL . " einloggen.\n\n";
         $Body .= "Wir verschicken Passwörter nur an die von dir im Spiel angegebenen Mailadressen. Solltest du diese Mail nicht angefordert haben kannst du sie also einfach ignorieren.\n\n";
         $Body .= "Wir wünschen dir weiterhin viel Erfolg beim Spielen von " . $game_config['game_name'] . "!\n\n";
         $Body .= "Dein " . $game_config['game_name'] . "-Team\n\n";
         mymail($mail, $Title, $Body, ADMINEMAIL);
         $NewPassSql = md5($NewPass);
         $QryPassChange = "UPDATE {{table}} SET ";
         $QryPassChange .= "`password` ='" . $NewPassSql . "' ";
         $QryPassChange .= "WHERE `email`='" . $mail . "' LIMIT 1;";
         doquery($QryPassChange, 'users');
     }
 }
Example #2
0
function sendemail($message, $address, $title)
{
    global $lang;
    $uni = $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    $uni = ereg_replace("[^0-9]", "", $uni);
    $lang['mail_welcome'] = '<table width="100%" height="100%" bgcolor="Black" border="1">';
    $lang['mail_welcome'] .= '<tr valign="top">';
    $lang['mail_welcome'] .= '<td valign="top">';
    $lang['mail_welcome'] .= '<center>';
    $lang['mail_welcome'] .= '<img src="http://darkevo.org/images/header.jpg" alt="Censtudios Gaming Portal" /><br />';
    $lang['mail_welcome'] .= '<table width="80%" height="220"><tr><td valign="top">';
    $lang['mail_welcome'] .= '<font color="White"><br /><br />';
    $lang['mail_welcome'] .= $message;
    $lang['mail_welcome'] .= '</font>';
    $lang['mail_welcome'] .= '</td></tr></table>';
    $lang['mail_welcome'] .= '</center>';
    $lang['mail_welcome'] .= '</td>';
    $lang['mail_welcome'] .= '</tr>';
    $lang['mail_welcome'] .= '</table>';
    $parse['gameurl'] = GAMEURL;
    $parse['uni'] = $uni;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($address, $title, $email);
    return $status;
}
Example #3
0
function sendpassemail($emailaddress, $password)
{
    global $game_config, $lang;
    $email = parsetemplate($lang['reg_mail_text_part1'] . $password . $lang['reg_mail_text_part2'] . GAMEURL, $parse);
    $status = mymail($emailaddress, $lang['register_at'] . $game_config['game_name'], $email);
    return $status;
}
Example #4
0
function sendpassemail($emailaddress, $password)
{
    global $lang;
    $parse['gameurl'] = GAMEURL;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $email);
    return $status;
}
function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false)
{
    global $config, $user, $sn_message_class_list;
    if (!$owners) {
        return;
    }
    $timestamp = $timestamp ? $timestamp : SN_TIME_NOW;
    $sender = intval($sender);
    if (!is_array($owners)) {
        $owners = array($owners);
    }
    if (!$escaped) {
        $from = db_escape($from);
        $subject = db_escape($subject);
        $text = db_escape($text);
    }
    $text_unescaped = stripslashes(str_replace(array('\\r\\n', "\r\n"), "<br />", $text));
    $message_class = $sn_message_class_list[$message_type];
    $message_class_email = $message_class['email'];
    $message_class_switchable = $message_class['switchable'];
    $message_class_name = $message_class['name'];
    $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name'];
    if ($owners[0] == '*') {
        if ($user['authlevel'] < 3) {
            return false;
        }
        // TODO Добавить $timestamp - рассылка может быть и отсроченной
        // TODO Добавить $sender - рассылка может быть и от кого-то
        db_message_insert_all($message_type, $from, $subject, $text);
        $owners = array();
    } else {
        $insert_values = array();
        $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')");
        foreach ($owners as $owner) {
            if ($user['id'] != $owner) {
                $owner_row = db_user_by_id($owner);
            } else {
                $owner_row = $user;
            }
            sys_user_options_unpack($owner_row);
            if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) {
                $insert_values[] = sprintf($insert_template, $owner);
            }
            if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) {
                @($result = mymail($owner_row['email'], $subject, $text_unescaped, '', true));
            }
        }
        if (empty($insert_values)) {
            return;
        }
        doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . 'VALUES ' . implode(',', $insert_values));
    }
    db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1");
    if (in_array($user['id'], $owners) || $owners[0] == '*') {
        $user[$message_class_name]++;
        $user[$message_class_name_total]++;
    }
}
Example #6
0
function sendpassemail($emailaddress, $password, $username)
{
    global $lang, $Code;
    $parse['gameurl'] = GAMEURL;
    $parse['password'] = $password;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $username, $password);
    return $status;
}
function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false)
{
    global $config, $user, $sn_message_class_list, $time_now;
    $timestamp = $timestamp ? $timestamp : $time_now;
    $sender = intval($sender);
    if (!is_array($owners)) {
        $owners = array($owners);
    }
    if (!$escaped) {
        $from = mysql_real_escape_string($from);
        $subject = mysql_real_escape_string($subject);
        $text = mysql_real_escape_string($text);
    }
    $text_unescaped = stripslashes(str_replace(array('\\r\\n', "\r\n"), "<br />", $text));
    $message_class = $sn_message_class_list[$message_type];
    $message_class_email = $message_class['email'];
    $message_class_switchable = $message_class['switchable'];
    $message_class_name = $message_class['name'];
    $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name'];
    $QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ';
    $QryUpdateUser = "******";
    if ($owners[0] == '*') {
        if ($user['authlevel'] < 3) {
            return false;
        }
        $QryInsertMessage .= "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}; ";
    } else {
        $insert_values = array();
        $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')");
        foreach ($owners as $owner) {
            if ($user['id'] != $owner) {
                $owner_row = doquery("SELECT * FROM {{users}} WHERE id = {$owner} LIMIT 1;", '', true);
                sys_user_options_unpack($owner_row);
            } else {
                $owner_row =& $user;
            }
            if (!$message_class_switchable || $owner_row["opt_{$message_class_name}"]) {
                $insert_values[] = sprintf($insert_template, $owner);
            }
            if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) {
                @($result = mymail($owner_row['email'], $subject, $text_unescaped, '', true));
            }
        }
        if (empty($insert_values)) {
            return;
        }
        $QryInsertMessage .= 'VALUES ' . implode(',', $insert_values) . ';';
        $QryUpdateUser .= 'WHERE `id` IN (' . implode(',', $owners) . ');';
    }
    doquery($QryInsertMessage);
    doquery($QryUpdateUser);
    if (in_array($user['id'], $owners) || $owners[0] == '*') {
        $user[$message_class_name]++;
        $user[$message_class_name_total]++;
    }
}
Example #8
0
function sendpassemail($emailaddress, $password)
{
    $gamename = "Ugamela";
    $staff = "The Rout Team ";
    $email = ADMINEMAIL;
    $gameurl = GAMEURL;
    $email = "Tu o alguien se registro en {$gamename} ({$gameurl}).\r\n\r\nLa siguiente contrase&ntilde;a se te envia para poder ingresar en el juego.\r\n\r\nTu nueva contrase&ntilde;a es: {$password}\r\n\r\nGracias por jugar, {$staff}.\r\n{$gameurl}";
    $status = mymail($emailaddress, "Registro en {$gamename}", $email);
    return $status;
}
Example #9
0
function sendpassemail($emailaddress, $password)
{
    global $lang;
    //Cojemos la variable $lang
    $parse['gameurl'] = GAMEURL;
    $parse['password'] = $password;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $email);
    return $status;
    //Devolvemos status
}
Example #10
0
function sendpassemail($emailaddress, $password, $UserName)
{
    global $lang, $kod;
    $parse['gameurl'] = GAMEURL;
    $parse['password'] = $password;
    $parse['character'] = $UserName;
    $parse['kod'] = $kod;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $email);
    return $status;
}
Example #11
0
function sendpassemail($emailaddress, $password, $username)
{
    global $lang;
    $uni = $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    $uni = ereg_replace("[^0-9]", "", $uni);
    $parse['gameurl'] = GAMEURL;
    $parse['password'] = $password;
    $parse['username'] = $username;
    $parse['uni'] = $uni;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $email);
    return $status;
}
Example #12
0
function sendpassemail($emailaddress, $password, $username, $code)
{
    global $lang, $game_config;
    $parse = $lang;
    $parse['password'] = $password;
    $parse['username'] = $username;
    $parse['uni'] = UNIVERSE;
    $parse['game'] = $game_config['game_name'];
    $parse['GAMEURL'] = GAMEURL;
    $parse['ADMIN_NAME'] = ADMIN_NAME;
    $parse['validate_url'] = GAMEURL . '/login.php?GET_LOGIN=1&username='******'&password='******'&UNI=' . UNIVERSE . '&go=./?page=validate--code=' . $code;
    $status = mymail($emailaddress, $lang['mail_title'] . $parse['game'], parsetemplate(gettemplate('emails/reg'), $parse));
    return $status;
}
Example #13
0
function mymail_attach($to, $subject, $body, $attach, $attachdata)
{
    if (!count($attach) && !count($attachdata)) {
        return mymail($to, $subject, $body);
    }
    require_once "Mail/mime.php";
    $json = json_decode(file_get_contents("/home/abhishek/Desktop/GenApp/abhishektest/appconfig.json"));
    $headers = array('From' => 'abhishektest@' . $json->mail->from, 'To' => $to, 'Subject' => $subject);
    $mime = new Mail_mime(array('eol' => "\n"));
    $mime->setTXTBody($body);
    if (count($attachdata)) {
        ob_start();
        foreach ($attach as $f) {
            if (!$mime->addAttachment($f, 'text/plain')) {
                $mime->addAttachment("could not attach {$f}", 'text/plain', "error-{$f}", false);
            }
        }
        ob_end_clean();
    }
    if (count($attachdata)) {
        ob_start();
        foreach ($attachdata as $d) {
            if (isset($d['data']) && isset($d['name'])) {
                if (!$mime->addAttachment($d['data'], 'text/plain', $d['name'], false)) {
                    $mime->addAttachment("could not attach data", 'text/plain', $d['name'], false);
                }
            } else {
                $mime->addAttachment("data data or name not set", 'text/plain', "unknown", false);
            }
        }
        ob_end_clean();
    }
    $body = $mime->get();
    $headers = $mime->headers($headers);
    if (isset($json->mail->smtp)) {
        $smtp = Mail::factory('smtp', array('host' => $json->mail->smtp->host, 'auth' => true, 'username' => $json->mail->smtp->user, 'password' => rtrim(base64_decode($json->mail->smtp->password))));
        $mail = $smtp->send($to, $headers, $body);
        return PEAR::isError($mail);
    }
    $phpmail = Mail::factory('mail');
    $mail = $phpmail->send($to, $headers, $body);
    return PEAR::isError($mail);
}
Example #14
0
function sendregmail($emailaddress, $vercode)
{
    $controlrow = getcontrol();
    $verurl = $controlrow["gameurl"] . "?do=verify";
    $email = <<<END
You or someone using your email address recently signed up for an account on the {$controlrow["gamename"]} server, located at {$controlrow["gameurl"]}.

This email is sent to verify your registration email. In order to begin using your account, you must verify your email address.
Please visit the Verification Page ({$verurl}) and enter the code below to activate your account.
Verification code: {$vercode}

If you were not the person who signed up for the game, please disregard this message. You will not be emailed again.
END;
    $status = mymail($emailaddress, $controlrow["gamename"] . " Account Verification", $email);
    return $status;
}
function sendregmail($emailaddress, $vercode)
{
    $controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
    $controlrow = mysql_fetch_array($controlquery);
    extract($controlrow);
    $verurl = $gameurl . "?do=verify";
    $email = <<<END
You or someone using your email address recently signed up for an account on the {$gamename} server, located at {$gameurl}.

This email is sent to verify your registration email. In order to begin using your account, you must verify your email address. 
Please visit the Verification Page ({$verurl}) and enter the code below to activate your account.
Verification code: {$vercode}

If you were not the person who signed up for the game, please disregard this message. You will not be emailed again.
END;
    $status = mymail($emailaddress, "{$gamename} Account Verification", $email);
    return $status;
}
Example #16
0
#!/usr/local/bin/php
<?php 
$notes = "\n" . "--------------------\n" . "\n" . "usage: {$argv['0']} email-address\n" . "prints current mail config\n" . "sends test message\n" . "\n";
require_once "/var/www/html/abhishektest/ajax/mail.php";
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "PEAR::Mail error: %s\n");
$json = json_decode(file_get_contents("/home/abhishek/Desktop/GenApp/abhishektest/appconfig.json"));
echo "from /home/abhishek/Desktop/GenApp/abhishektest/appconfig.json:\n";
print_r($json->mail);
if (!isset($argv[1])) {
    echo $notes;
    exit;
}
if (isset($json->mail->smtp)) {
    $smtp = "smtp";
} else {
    $smtp = "sendmail";
}
echo "test message to {$argv['1']} using {$smtp}\n";
$host = gethostname();
if (mymail($argv[1], "[{$host}][abhishektest][test message][{$smtp}]", "This is a abhishektest test message from host named {$host} send by {$argv['0']} using {$smtp}")) {
    echo "error found in sending\n";
} else {
    echo "send looks ok, now check the mail for {$argv['1']} to make sure it went throgh\n";
}
exit;
?>

    
Example #17
0
function dhvc_form_get_mymail_subscribers_list($selected = array())
{
    $Subscribers_list = array();
    if (defined('DHVC_FORM_SUPORT_MYMAIL')) {
        $lists = mymail('lists')->get();
        if (!empty($lists)) {
            foreach ($lists as $list) {
                if (!empty($selected) && in_array($list->ID, $selected)) {
                    $Subscribers_list[$list->ID] = $list->name;
                } else {
                    $Subscribers_list[$list->ID] = $list->name;
                }
            }
        }
    }
    return $Subscribers_list;
}
function exec_ogp_module()
{
    global $db, $view, $settings;
    $adminEmailList = '';
    // Get email address of all admins to inform him when a user has registered.
    $admins = $db->getAdmins();
    if (is_array($admins) && count($admins) > 0) {
        foreach ($admins as $admin) {
            $adminEmail = $admin['users_email'];
            $adminEmailList .= $adminEmail . ',';
        }
    }
    //Array to store validation errors
    $errmsg_arr = array();
    //Array to store input values
    $input = array();
    //Validation error flag
    $errflag = false;
    //Function to sanitize values received from the form. Prevents SQL injection
    function clean($str)
    {
        $str = @trim($str);
        if (get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return $str;
    }
    //Sanitize the POST values
    $users_fname = $_POST['users_fname'];
    $users_fname = str_replace('"', '', $users_fname);
    $users_fname = str_replace("'", "", $users_fname);
    $users_lname = $_POST['users_lname'];
    $users_lname = str_replace('"', '', $users_lname);
    $users_lname = str_replace("'", "", $users_lname);
    $users_login = $_POST['login_name'];
    $users_login = str_replace('"', '', $users_login);
    $users_login = str_replace("'", "", $users_login);
    $users_passwd = clean($_POST['users_passwd']);
    $users_cpasswd = clean($_POST['users_cpasswd']);
    $users_email = clean($_POST['users_email']);
    $users_comment = clean($_POST['users_comment']);
    if (!empty($users_fname)) {
        $input['users_fname'] = $users_fname;
    }
    if (!empty($users_lname)) {
        $input['users_lname'] = $users_lname;
    }
    if (!empty($users_login)) {
        $input['users_login'] = $users_login;
    }
    if (!empty($users_email)) {
        $input['users_email'] = $users_email;
    }
    $lang_switch = (isset($_GET['lang']) and $_GET['lang'] != "-") ? "lang=" . $_GET['lang'] : "";
    //Input Validations
    if ($users_fname == '') {
        $errmsg_arr[] = get_lang('err_first_name');
        $errflag = true;
    }
    if ($users_lname == '') {
        $errmsg_arr[] = get_lang('err_last_name');
        $errflag = true;
    }
    if ($users_email == '' or !checkEmail($users_email)) {
        $errmsg_arr[] = get_lang('err_email_address');
        $errflag = true;
    } elseif ($db->getUserByEmail($users_email) != FALSE) {
        $user = $db->getUserByEmail($users_email);
        $errmsg_arr[] = get_lang_f('err_email_address_already_in_use_by', $user['users_login']);
        $errflag = true;
    }
    if ($users_login == '') {
        $errmsg_arr[] = get_lang('err_login_name');
        $errflag = true;
    }
    if ($users_passwd == '') {
        $errmsg_arr[] = get_lang('err_password');
        $errflag = true;
    } else {
        // 6 char password minimum
        if (strlen($users_passwd) < 6) {
            $errmsg_arr[] = get_lang('passwd_len');
            $errflag = true;
        }
    }
    if ($users_cpasswd == '') {
        $errmsg_arr[] = get_lang('err_confirm_password');
        $errflag = true;
    }
    if (strcmp($users_passwd, $users_cpasswd) != 0) {
        $errmsg_arr[] = get_lang('err_password_mismatch');
        $errflag = true;
    }
    require_once 'recaptchalib.php';
    require_once 'captchakeys.php';
    $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
    if (!$resp->is_valid) {
        $errmsg_arr[] = get_lang('err_captcha');
        $errflag = true;
    }
    //Create INSERT query
    if (!$errflag) {
        if (!$db->addUser($users_login, $users_passwd, "user", $users_email)) {
            $errmsg_arr[] = get_lang('err_login_name');
            $errflag = true;
        } else {
            $user = $db->getUser($users_login);
            $user_id = $user['user_id'];
            $fields['users_fname'] = $users_fname;
            $fields['users_lname'] = $users_lname;
            $fields['users_comment'] = $users_comment;
            if (isset($_GET['lang'])) {
                $fields['users_lang'] = $_GET['lang'];
            } else {
                $fields['users_lang'] = $settings['panel_language'];
            }
            if ($db->editUser($fields, $user_id)) {
                if (isset($adminEmailList) && !empty($adminEmailList)) {
                    $to = $adminEmailList . $users_email;
                } else {
                    $to = $users_email;
                }
                if (empty($settings['panel_name'])) {
                    $subject = get_lang_f('subject', "Open Game Panel");
                } else {
                    $subject = get_lang_f('subject', $settings['panel_name']);
                }
                $message = get_lang_f('register_message', $users_login, $_POST['users_passwd']);
                $mail = mymail($to, $subject, $message, $settings);
                if ($mail) {
                    print_success(get_lang_f('your_account_details_has_been_sent_by_email_to', $users_email));
                    $view->refresh("index.php?" . $lang_switch, 8);
                }
            } else {
                $user = $db->getUser($users_login);
                $user_id = $user['user_id'];
                $db->delUser($user_id);
                print_failure('FAILURE: Unable to set user details, try again.');
                $view->refresh("index.php?m=register&p=form&" . $lang_switch, 8);
            }
        }
    }
    //If there are input validations, redirect back to the registration form
    if ($errflag) {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        $_SESSION['INPUT'] = $input;
        $view->refresh("index.php?m=register&p=form&" . $lang_switch, 0);
    }
}
Example #19
0
function sendregmail($emailaddress, $vercode)
{
    $controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
    $controlrow = mysql_fetch_array($controlquery);
    extract($controlrow);
    $verurl = $gameurl . "?do=verify";
    $email = <<<END
Você ou alguém usando sua conta de e-mail, recentemente se registrou no jogo {$gamename}, localizado em {$gameurl}.

Esse e-mail é enviado para verificar seu e-mail de registro. Para começar a utilizar a sua conta, você deve verificar o seu e-mail. 
Por favor visite a Página de Verificação: ({$verurl}) e preencha com o código de ativação abaixo:
Código de Ativação: {$vercode}

Se você não é a pessoa que se registrou no jogo, por favor ignore essa mensagem. Você não receberá outro e-mail.
END;
    $status = mymail($emailaddress, "{$gamename} Verificação da Conta", $email);
    return $status;
}
Example #20
0
function exec_ogp_module()
{
    global $db, $view, $settings;
    $view->setCharset(get_lang('lang_charset'));
    $errorCount = 0;
    if (isset($errors)) {
        unset($errors);
    }
    $moduleLink = "index.php?m=lostpwd";
    $lang_switch = (isset($_GET['lang']) and $_GET['lang'] != "") ? '&lang=' . $_GET['lang'] : "";
    echo '<h2>' . get_lang("recover") . '</h2>';
    // We either need to show the form or process the email address input
    if (!isset($_GET['user_id']) and !isset($_GET['ch_pass_uid'])) {
        if (isset($_POST['email_address'])) {
            /* Start of Process User Input */
            $email_address = trim($_POST['email_address']);
            if (empty($email_address)) {
                $errorCount++;
                $errors[] = get_lang('incomplete');
            }
            if (!stristr($email_address, "@") or !stristr($email_address, ".")) {
                $errorCount++;
                $errors[] = get_lang('errormail');
            }
            if ($errorCount == 0) {
                // Check to see if email address is in the database
                $user_info = $db->getUserByEmail($email_address);
                if (empty($user_info)) {
                    $errorCount++;
                    $errors[] = get_lang('errormail');
                }
                // Still no errors?
                if ($errorCount == 0) {
                    $user_id = $user_info['user_id'];
                    $ch_pass_uid = $user_info['users_passwd'];
                    $subject = get_lang('confirm_change_subject');
                    $s = isset($_SERVER['HTTPS']) ? "s" : "";
                    $recover_link = '<a href="http' . $s . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "&user_id=" . $user_id . '&ch_pass_uid=' . $ch_pass_uid . '" >http' . $s . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "&user_id=" . $user_id . '&ch_pass_uid=' . $ch_pass_uid . '</a>';
                    $message = get_lang_f('confirm_change_password_message', $recover_link);
                    if (mymail($email_address, $subject, $message, $settings) == TRUE) {
                        echo "<p>" . get_lang('confirm_send') . "</p>";
                    } else {
                        echo "<p>" . get_lang('mail_failed') . "</p>";
                    }
                    unset($_POST['email_address']);
                }
            }
        } else {
            // Show form
            $showForm = 1;
        }
        // Any errors?  If so, show the form
        if ($errorCount > 0) {
            $showForm = 1;
        }
        if (isset($showForm) and $showForm == 1) {
            echo '<table style="width:200px" align="center" >
					<tr>
						<td colspan=2 >';
            // Print errors if there are any
            if (isset($errors) && is_array($errors)) {
                foreach ($errors as $error) {
                    echo '<p style="color: red;">' . $error . '</p>';
                }
            }
            echo '<form method="post" action="?m=lostpwd' . $lang_switch . '">
							<label for="email_address">' . get_lang("email") . '</label>
						</td>
					</tr>
					<tr>
						<td>
							<input type="text" title="' . get_lang("enter_email") . '" name="email_address" size="30" value="';
            if (isset($email_address)) {
                echo $email_address;
            }
            echo '"/>
						</td>
					</tr>
					<tr>
						<td style="text-align:right;">
							<input type="submit" value="' . get_lang("submit") . '" class="submit-button"/>
							</form>
						</td>
					</tr>
					<tr>
						<td style="text-align:left;">
							<form method="post" action="index.php' . str_replace("&", "?", $lang_switch) . '" style="margin-top:-28px;">
							<input type="submit" value="<<&nbsp;' . get_lang("back") . '" class="submit-button"/>
							</form>
						</td>
					</tr></table>';
        }
    } else {
        if (isset($_GET['user_id']) and isset($_GET['ch_pass_uid'])) {
            $user_id = trim($_GET['user_id']);
            $ch_pass_uid = trim($_GET['ch_pass_uid']);
            $user_info = $db->getUserById($user_id);
            if (empty($user_info)) {
                print_failure(get_lang('errormail'));
                echo "<p><a href='" . $moduleLink . "'>&lt;&lt; " . get_lang('back') . "</a></p>";
                return;
            }
            $email_address = $user_info['users_email'];
            $random_password = makeRandomPassword();
            $db_password = md5($random_password);
            $old_pass_md5_hash = $user_info['users_passwd'];
            if ($old_pass_md5_hash != $ch_pass_uid) {
                print_failure("Failed to update password for user.");
                echo "<p><a href='" . $moduleLink . "'>&lt;&lt; " . get_lang('back') . "</a></p>";
                return;
            }
            $random_password = makeRandomPassword();
            $db_password = md5($random_password);
            if ($db->updateUsersPassword($user_id, $db_password) === FALSE) {
                print_failure("Failed to update password for user.");
                echo "<p><a href='" . $moduleLink . "'>&lt;&lt; " . get_lang('back') . "</a></p>";
                return;
            }
            $subject = get_lang('subject');
            $message = get_lang_f('password_message', $random_password);
            if (mymail($email_address, $subject, $message, $settings) == TRUE) {
                echo "<p>" . get_lang('send') . "</p>";
            } else {
                echo "<p>" . get_lang('mail_failed') . "</p>";
            }
            echo "<p>" . get_lang('click') . " <a href='index.php'>" . get_lang('here') . "</a> " . get_lang('to_login') . "</p>";
        } else {
            print_failure("Security alert.");
        }
    }
}
Example #21
0
 function sendpassemail($emailaddress, $password)
 {
     global $lang;
     $parse['gameurl'] = GAMEURL;
     $parse['password'] = $password;
     $email = parsetemplate($lang['anmelden']['0001'], $parse);
     $status = mymail($emailaddress, $lang['anmelden']['0002'], $email);
     return $status;
 }
function snp_popup_submit()
{
    global $wpdb;
    $result = array();
    $errors = array();
    $_POST['email'] = trim($_POST['email']);
    if (isset($_POST['name'])) {
        $_POST['name'] = trim($_POST['name']);
    }
    if (!snp_is_valid_email($_POST['email'])) {
        $errors['email'] = 1;
    }
    if (isset($_POST['name']) && !$_POST['name']) {
        $errors['name'] = 1;
    }
    $post_id = intval($_POST['popup_ID']);
    if ($post_id) {
        $POPUP_META = get_post_meta($post_id);
    }
    $cf_data = array();
    if (isset($POPUP_META['snp_cf']) && $post_id) {
        $cf = unserialize($POPUP_META['snp_cf'][0]);
        if (isset($cf) && is_array($cf)) {
            foreach ($cf as $f) {
                if (isset($f['name'])) {
                    if (strpos($f['name'], '[')) {
                        $f['name'] = substr($f['name'], 0, strpos($f['name'], '['));
                    }
                    if (!empty($_POST[$f['name']])) {
                        $cf_data[$f['name']] = $_POST[$f['name']];
                    }
                }
                if (isset($f['required']) && $f['required'] == 'Yes' && !$cf_data[$f['name']]) {
                    $errors[$f['name']] = 1;
                }
            }
        }
    }
    if (count($errors) > 0) {
        $result['Errors'] = $errors;
        $result['Ok'] = false;
    } else {
        $Done = 0;
        if (!empty($_POST['name'])) {
            $names = snp_detect_names($_POST['name']);
        } else {
            $names = array('first' => '', 'last' => '');
        }
        $api_error_msg = '';
        if (snp_get_option('ml_manager') == 'directmail') {
            require_once SNP_DIR_PATH . '/include/directmail/class.directmail.php';
            $form_id = snp_get_option('ml_dm_form_id');
            if ($form_id) {
                $api = new DMSubscribe();
                $retval = $api->submitSubscribeForm($form_id, $_POST['email'], $error_message);
                if ($retval) {
                    $Done = 1;
                } else {
                    // Error... Send by email?
                    $api_error_msg = $error_message;
                }
            }
        } elseif (snp_get_option('ml_manager') == 'sendy') {
            $list_id = $POPUP_META['snp_ml_sendy_list'][0];
            if (!$list_id) {
                $list_id = snp_get_option('ml_sendy_list');
            }
            if ($list_id) {
                $options = array('list' => $list_id, 'boolean' => 'true');
                $args['email'] = $_POST['email'];
                if (!empty($_POST['name'])) {
                    $args['name'] = $_POST['name'];
                }
                if (count($cf_data) > 0) {
                    $args = array_merge($args, (array) $cf_data);
                }
                $content = array_merge($args, $options);
                $postdata = http_build_query($content);
                $ch = curl_init(snp_get_option('ml_sendy_url') . '/subscribe');
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
                $api_result = curl_exec($ch);
                curl_close($ch);
                if (strval($api_result) == 'true' || strval($api_result) == '1' || strval($api_result) == 'Already subscribed.') {
                    $Done = 1;
                } else {
                    $api_error_msg = $api_result;
                }
            }
        } elseif (snp_get_option('ml_manager') == 'mailchimp') {
            require_once SNP_DIR_PATH . '/include/mailchimp/Mailchimp.php';
            $ml_mc_list = $POPUP_META['snp_ml_mc_list'][0];
            if (!$ml_mc_list) {
                $ml_mc_list = snp_get_option('ml_mc_list');
            }
            if (snp_get_option('ml_mc_apikey') && $ml_mc_list) {
                $api = new Mailchimp(snp_get_option('ml_mc_apikey'));
                $args = array();
                if (!empty($_POST['name'])) {
                    $args = array('FNAME' => $names['first'], 'LNAME' => $names['last']);
                }
                if (count($cf_data) > 0) {
                    $args = array_merge($args, (array) $cf_data);
                }
                try {
                    $double_optin = snp_get_option('ml_mc_double_optin');
                    if ($double_optin == 1) {
                        $double_optin = true;
                    } else {
                        $double_optin = false;
                    }
                    $double_optin = snp_get_option('ml_mc_double_optin');
                    if ($double_optin == 1) {
                        $double_optin = true;
                    } else {
                        $double_optin = false;
                    }
                    $send_welcome = snp_get_option('ml_mc_send_welcome');
                    if ($send_welcome == 1) {
                        $send_welcome = true;
                    } else {
                        $send_welcome = false;
                    }
                    $retval = $api->lists->subscribe($ml_mc_list, array('email' => $_POST['email']), $args, 'html', $double_optin, false, true, $send_welcome);
                    $Done = 1;
                } catch (Exception $e) {
                    if ($e->getCode() == 214) {
                        $Done = 1;
                    } else {
                        $api_error_msg = $e->getMessage();
                    }
                }
            }
        } elseif (snp_get_option('ml_manager') == 'egoi') {
            $ml_egoi_apikey = snp_get_option('ml_egoi_apikey');
            $client = new SoapClient('http://api.e-goi.com/v2/soap.php?wsdl');
            try {
                $ml_egoi_list = $POPUP_META['snp_ml_egoi_list'][0];
                if (!$ml_egoi_list) {
                    $ml_egoi_list = snp_get_option('ml_egoi_list');
                }
                $args = array('apikey' => $ml_egoi_apikey, 'listID' => $ml_egoi_list, 'email' => $_POST['email']);
                if (!empty($_POST['name'])) {
                    $args['first_name'] = $names['first'];
                    $args['last_name'] = $names['last'];
                }
                if (count($cf_data) > 0) {
                    $CustomFields = array();
                    foreach ($cf_data as $k => $v) {
                        $args[$k] = $v;
                    }
                }
                $res = $client->addSubscriber($args);
                if (isset($res['UID'])) {
                    $Done = 1;
                }
            } catch (Exception $e) {
                // Error...
                // We'll send this by email.
            }
        } elseif (snp_get_option('ml_manager') == 'getresponse') {
            $ml_gr_apikey = snp_get_option('ml_gr_apikey');
            require_once SNP_DIR_PATH . '/include/getresponse/jsonRPCClient.php';
            $api = new jsonRPCClient('http://api2.getresponse.com');
            try {
                $ml_gr_list = $POPUP_META['snp_ml_gr_list'][0];
                if (!$ml_gr_list) {
                    $ml_gr_list = snp_get_option('ml_gr_list');
                }
                $args = array('campaign' => $ml_gr_list, 'email' => $_POST['email']);
                if (!empty($_POST['name'])) {
                    $args['name'] = $_POST['name'];
                }
                if (count($cf_data) > 0) {
                    $CustomFields = array();
                    foreach ($cf_data as $k => $v) {
                        $CustomFields[] = array('name' => $k, 'content' => $v);
                    }
                    $args['customs'] = $CustomFields;
                }
                $res = $api->add_contact($ml_gr_apikey, $args);
                $Done = 1;
            } catch (Exception $e) {
                // Error...
                // We'll send this by email.
                $api_error_msg = $e->getMessage();
            }
        } elseif (snp_get_option('ml_manager') == 'campaignmonitor') {
            require_once SNP_DIR_PATH . '/include/campaignmonitor/csrest_subscribers.php';
            $ml_cm_list = $POPUP_META['snp_ml_cm_list'][0];
            if (!$ml_cm_list) {
                $ml_cm_list = snp_get_option('ml_cm_list');
            }
            $wrap = new CS_REST_Subscribers($ml_cm_list, snp_get_option('ml_cm_apikey'));
            $args = array('EmailAddress' => $_POST['email'], 'Resubscribe' => true);
            if (!empty($_POST['name'])) {
                $args['Name'] = $_POST['name'];
            }
            if (count($cf_data) > 0) {
                $CustomFields = array();
                foreach ($cf_data as $k => $v) {
                    $CustomFields[] = array('Key' => $k, 'Value' => $v);
                }
                $args['CustomFields'] = $CustomFields;
            }
            $res = $wrap->add($args);
            if ($res->was_successful()) {
                $Done = 1;
            } else {
                // Error...
                // We'll send this by email.
                $api_error_msg = 'Failed with code ' . $res->http_status_code;
            }
        } elseif (snp_get_option('ml_manager') == 'icontact') {
            require_once SNP_DIR_PATH . '/include/icontact/iContactApi.php';
            iContactApi::getInstance()->setConfig(array('appId' => snp_get_option('ml_ic_addid'), 'apiPassword' => snp_get_option('ml_ic_apppass'), 'apiUsername' => snp_get_option('ml_ic_username')));
            $oiContact = iContactApi::getInstance();
            $res1 = $oiContact->addContact($_POST['email'], null, null, isset($names['first']) ? $names['first'] : '', isset($names['last']) ? $names['last'] : '', null, null, null, null, null, null, null, null, null);
            if ($res1->contactId) {
                $ml_ic_list = $POPUP_META['snp_ml_ic_list'][0];
                if (!$ml_ic_list) {
                    $ml_ic_list = snp_get_option('ml_ic_list');
                }
                if ($oiContact->subscribeContactToList($res1->contactId, $ml_ic_list, 'normal')) {
                    $Done = 1;
                }
            } else {
                // Error...
                // We'll send this by email.
                $api_error_msg = 'iContact Problem!';
            }
        } elseif (snp_get_option('ml_manager') == 'constantcontact') {
            require_once SNP_DIR_PATH . '/include/constantcontact/class.cc.php';
            $cc = new cc(snp_get_option('ml_cc_username'), snp_get_option('ml_cc_pass'));
            $send_welcome = snp_get_option('ml_cc_send_welcome');
            if ($send_welcome == 1) {
                $cc->set_action_type('contact');
            }
            $email = $_POST['email'];
            $contact_list = $POPUP_META['snp_ml_cc_list'][0];
            if (!$contact_list) {
                $contact_list = snp_get_option('ml_cc_list');
            }
            $extra_fields = array();
            if (!empty($names['first'])) {
                $extra_fields['FirstName'] = $names['first'];
            }
            if (!empty($names['last'])) {
                $extra_fields['LastName'] = $names['last'];
            }
            if (count($cf_data) > 0) {
                $extra_fields = array_merge($extra_fields, (array) $cf_data);
            }
            $contact = $cc->query_contacts($email);
            if ($contact) {
                $status = $cc->update_contact($contact['id'], $email, $contact_list, $extra_fields);
                if ($status) {
                    $Done = 1;
                } else {
                    $api_error_msg = "Contact Operation failed: " . $cc->http_get_response_code_error($cc->http_response_code);
                }
            } else {
                $new_id = $cc->create_contact($email, $contact_list, $extra_fields);
                if ($new_id) {
                    $Done = 1;
                } else {
                    $api_error_msg = "Contact Operation failed: " . $cc->http_get_response_code_error($cc->http_response_code);
                }
            }
        } elseif (snp_get_option('ml_manager') == 'madmimi') {
            require_once SNP_DIR_PATH . '/include/madmimi/MadMimi.class.php';
            if (snp_get_option('ml_madm_username') && snp_get_option('ml_madm_apikey')) {
                $mailer = new MadMimi(snp_get_option('ml_madm_username'), snp_get_option('ml_madm_apikey'));
                $user = array('email' => $_POST['email']);
                if (!empty($names['first'])) {
                    $user['FirstName'] = $names['first'];
                }
                if (!empty($names['last'])) {
                    $user['LastName'] = $names['last'];
                }
                if (count($cf_data) > 0) {
                    $user = array_merge($user, (array) $cf_data);
                }
                $ml_madm_list = $POPUP_META['snp_ml_madm_list'][0];
                if (!$ml_madm_list) {
                    $ml_madm_list = snp_get_option('ml_madm_list');
                }
                $user['add_list'] = $ml_madm_list;
                $res = $mailer->AddUser($user);
                $Done = 1;
            }
        } elseif (snp_get_option('ml_manager') == 'infusionsoft') {
            require_once SNP_DIR_PATH . '/include/infusionsoft/infusionsoft.php';
            if (snp_get_option('ml_inf_subdomain') && snp_get_option('ml_inf_apikey')) {
                $infusionsoft = new Infusionsoft(snp_get_option('ml_inf_subdomain'), snp_get_option('ml_inf_apikey'));
                $user = array('Email' => $_POST['email']);
                if (!empty($names['first'])) {
                    $user['FirstName'] = $names['first'];
                }
                if (!empty($names['last'])) {
                    $user['LastName'] = $names['last'];
                }
                if (count($cf_data) > 0) {
                    $user = array_merge($user, (array) $cf_data);
                }
                $ml_inf_list = $POPUP_META['snp_ml_inf_list'][0];
                if (!$ml_inf_list) {
                    $ml_inf_list = snp_get_option('ml_inf_list');
                }
                $contact_id = $infusionsoft->contact('add', $user);
                $r = $infusionsoft->APIEmail('optIn', $_POST['email'], "Ninja Popups on " . get_bloginfo());
                if ($contact_id && $ml_inf_list) {
                    $infusionsoft->contact('addToGroup', $contact_id, $ml_inf_list);
                }
                if ($contact_id) {
                    $Done = 1;
                }
            }
        } elseif (snp_get_option('ml_manager') == 'aweber') {
            require_once SNP_DIR_PATH . '/include/aweber/aweber_api.php';
            if (get_option('snp_ml_aw_auth_info')) {
                $aw = get_option('snp_ml_aw_auth_info');
                try {
                    $aweber = new AWeberAPI($aw['consumer_key'], $aw['consumer_secret']);
                    $account = $aweber->getAccount($aw['access_key'], $aw['access_secret']);
                    $aw_list = $POPUP_META['snp_ml_aw_lists'][0];
                    if (!$aw_list) {
                        $aw_list = snp_get_option('ml_aw_lists');
                    }
                    $list = $account->loadFromUrl('/accounts/' . $account->id . '/lists/' . $aw_list);
                    $subscriber = array('email' => $_POST['email'], 'ip' => $_SERVER['REMOTE_ADDR']);
                    if (!empty($_POST['name'])) {
                        $subscriber['name'] = $_POST['name'];
                    }
                    if (count($cf_data) > 0) {
                        $subscriber['custom_fields'] = $cf_data;
                    }
                    $r = $list->subscribers->create($subscriber);
                    $Done = 1;
                } catch (AWeberException $e) {
                    $api_error_msg = $e->getMessage();
                }
            }
        } elseif (snp_get_option('ml_manager') == 'wysija' && class_exists('WYSIJA')) {
            $ml_wy_list = $POPUP_META['snp_ml_wy_list'][0];
            if (!$ml_wy_list) {
                $ml_wy_list = snp_get_option('ml_wy_list');
            }
            $userData = array('email' => $_POST['email'], 'firstname' => $names['first'], 'lastname' => $names['last']);
            $data = array('user' => $userData, 'user_list' => array('list_ids' => array($ml_wy_list)));
            $userHelper =& WYSIJA::get('user', 'helper');
            if ($userHelper->addSubscriber($data)) {
                $Done = 1;
            } else {
                $api_error_msg = 'MailPoet Problem!';
            }
        } elseif (snp_get_option('ml_manager') == 'sendpress') {
            $ml_sp_list = $POPUP_META['snp_ml_sp_list'][0];
            if (!$ml_sp_list) {
                $ml_sp_list = snp_get_option('ml_sp_list');
            }
            try {
                SendPress_Data::subscribe_user($ml_sp_list, $_POST['email'], $names['first'], $names['last'], 2);
                $Done = 1;
            } catch (Exception $e) {
                $api_error_msg = 'SendPress Problem!';
            }
        } elseif (snp_get_option('ml_manager') == 'mymail') {
            $userdata = array('firstname' => $names['first'], 'lastname' => $names['last']);
            $ml_mm_list = $POPUP_META['snp_ml_mm_list'][0];
            if (!$ml_mm_list) {
                $ml_mm_list = snp_get_option('ml_mm_list');
            }
            $lists = array($ml_mm_list);
            if (function_exists('mymail')) {
                $entry = $userdata;
                $entry['email'] = $_POST['email'];
                $double_optin = snp_get_option('ml_mm_double_optin');
                if ($double_optin == 1) {
                    $entry['status'] = 0;
                } else {
                    $entry['status'] = 1;
                }
                if (count($cf_data) > 0) {
                    foreach ($cf_data as $k => $v) {
                        $entry[$k] = $v;
                    }
                }
                $subscriber_id = mymail('subscribers')->add($entry, true);
                if (!is_wp_error($subscriber_id)) {
                    $success = mymail('subscribers')->assign_lists($subscriber_id, $lists, false);
                }
                if ($success) {
                    $Done = 1;
                } else {
                    $api_error_msg = 'MyMail Problem!';
                }
            } else {
                $return = mymail_subscribe($_POST['email'], $userdata, $lists);
                if (!is_wp_error($return)) {
                    $Done = 1;
                } else {
                    $api_error_msg = 'MyMail Problem!';
                }
            }
        } elseif (snp_get_option('ml_manager') == 'csv' && snp_get_option('ml_csv_file') && is_writable(SNP_DIR_PATH . 'csv/')) {
            if (!isset($_POST['name'])) {
                $_POST['name'] = '';
            }
            if (count($cf_data) > 0) {
                $CustomFields = '';
                foreach ($cf_data as $k => $v) {
                    $CustomFields .= $k . ' = ' . $v . ';';
                }
            }
            $data = $_POST['email'] . ";" . $_POST['name'] . ";" . $CustomFields . get_the_title($_POST['popup_ID']) . " (" . $_POST['popup_ID'] . ");" . date('Y-m-d H:i') . ";" . $_SERVER['REMOTE_ADDR'] . ";\n";
            if (file_put_contents(SNP_DIR_PATH . 'csv/' . snp_get_option('ml_csv_file'), $data, FILE_APPEND | LOCK_EX) !== FALSE) {
                $Done = 1;
            } else {
                $api_error_msg = 'CSV Problem!';
            }
        }
        if (snp_get_option('ml_manager') == 'email' || !$Done) {
            $Email = snp_get_option('ml_email');
            if (!$Email) {
                $Email = get_bloginfo('admin_email');
            }
            if (!isset($_POST['name'])) {
                $_POST['name'] = '--';
            }
            $error_mgs = '';
            if ($api_error_msg != '') {
                $error_mgs .= "IMPORTANT! You have received this message because connection to your e-mail marketing software failed. Please check connection setting in the plugin configuration.\n";
                $error_mgs .= $api_error_msg . "\n";
            }
            $cf_msg = '';
            if (count($cf_data) > 0) {
                foreach ($cf_data as $k => $v) {
                    $cf_msg .= $k . ": " . $v . "\n";
                }
            }
            $msg = "New subscription on " . get_bloginfo() . "\n" . $error_mgs . "\n" . "E-mail: " . $_POST['email'] . "\n" . "Name: " . $_POST['name'] . "\n" . $cf_msg . "\n" . "Form: " . get_the_title($_POST['popup_ID']) . " (" . $_POST['popup_ID'] . ")\n" . "\n" . "Date: " . date('Y-m-d H:i') . "\n" . "IP: " . $_SERVER['REMOTE_ADDR'] . "";
            wp_mail($Email, "New subscription on " . get_bloginfo(), $msg);
        }
        $result['Ok'] = true;
    }
    echo json_encode($result);
    die('');
}
Example #23
0
function sendPassMail($emailaddress, $password)
{
    global $lang;
    $parse['gameurl'] = GAMEURL;
    $parse['password'] = $password;
    $email = parsetemplate($lang['Reg_WelcomeMail'], $parse);
    $status = mymail($emailaddress, $lang['Reg_MailTitle'], $email);
    return $status;
}
Example #24
0
function sendpassemail($emailaddress, $password)
{
    global $lang, $kod;
    $parse['SN_ROOT_VIRTUAL'] = SN_ROOT_VIRTUAL;
    $parse['password'] = $password;
    $parse['kod'] = $kod;
    $email = parsetemplate($lang['mail_welcome'], $parse);
    $status = mymail($emailaddress, $lang['mail_title'], $email);
    return $status;
}
 public function indeed_getMyMailLists()
 {
     //return mymail lists
     if (function_exists('mymail')) {
         //my mail >=2
         $lists = mymail('lists')->get();
         if (isset($lists) && count($lists) > 0) {
             foreach ($lists as $v) {
                 if (isset($v->slug) && isset($v->name)) {
                     $list_arr[$v->slug] = $v->name;
                 }
             }
             return $list_arr;
         }
         return FALSE;
     } else {
         $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), 'fields' => 'all', 'hierarchical' => true, 'child_of' => 0, 'pad_counts' => false, 'cache_domain' => 'core');
         $lists = get_terms('newsletter_lists', $args);
         if (isset($lists)) {
             foreach ($lists as $v) {
                 if (isset($v->slug) && isset($v->name)) {
                     $list_arr[$v->slug] = $v->name;
                 }
             }
             if (!isset($list_arr) || count($list_arr) == 0) {
                 $list_arr[0] = 'none';
             }
             return $list_arr;
         } else {
             return 0;
         }
     }
 }
Example #26
0
<?php

include './helpers.php';
mymail();
Example #27
0
 function changePassword($uname)
 {
     $sql = "select * from `users` where username='******'";
     $result = mysql_query($sql, $cn) or die("ERROR :" . mysql_error());
     $num = mysql_num_rows($result);
     //$ans=array();
     if ($num > 0) {
         $userdata = mysql_fetch_assoc($result);
         $pass = $userdata['password'];
         //		$ans=true;
         $to['name'] = $userdata['firstname'];
         $to['email'] = $userdata['email'];
         $from['name'] = "Support";
         $from['email'] = getadminemail();
         $subject = getsitename() . " Password Recovery Service";
         $filename = "email/forget.tpl";
         $data['fname'] = $userdata['firstname'] . " " . $userdata['lastname'];
         $data['myname'] = getsitename();
         $data['username'] = $userdata['username'];
         $data['password'] = $userdata['password'];
         $data['from'] = getadminemail();
         mymail($to, $subject, $data, $filename, $from);
         $ans = true;
     } else {
         $ans = false;
     }
     disconnect_db($cn);
     return $ans;
 }
             $results['error'] .= "Email address change request but it is not changed. ";
         } else {
             $ok_to_update = 1;
         }
     } else {
         $results['error'] .= "Email addresses do not match. ";
     }
     if ($ok_to_update == 1) {
         $update['$set']['email'] = $email1;
         $update['$set']['emailchangewhen'] = $now;
         $update['$set']['emailchangeip'] = $_SERVER['REMOTE_ADDR'];
         $update['$push']['previousemail'] = $doc['email'];
         require_once "../mail.php";
         date_default_timezone_set('UTC');
         $json = json_decode(file_get_contents("/home/abhishek/Desktop/GenApp/abhishektest/appconfig.json"));
         mymail($doc['email'], 'email change notice abhishektest', "Your email address has been changed\n" . 'new email:   ' . $email1 . "\n" . 'remoteip:    ' . $update['$set']['emailchangeip'] . "\n" . 'when:        ' . date('Y-m-d H:i:s', $update['$set']['emailchangewhen']->sec) . " UTC\n" . "\n" . 'If you do not recognize this change please forward this email with a comment to ' . $json->mail->admin . "\n" . '');
         admin_mail("[abhishektest][new email address] {$email1}", "User: "******"\nEmail: {$email1}\n");
         $results['status'] .= "Changing email address to {$email1}. ";
         $do_update = 1;
     }
 }
 if ($do_update) {
     try {
         $coll->update(array("name" => $_SESSION[$window]['logon']), $update);
     } catch (MongoCursorException $e) {
         $results['error'] .= "Error updating the database. " . $e->getMessage();
         $results['status'] .= "Unable to update user record. ";
         echo json_encode($results);
         exit;
     }
     $results['status'] .= "Update ok.";
Example #29
0
            message($message, $lang['log_lost_header']);
        } else {
            message($lang['log_lost_err_change'], $lang['sys_error']);
        }
    } else {
        message($lang['log_lost_err_code'], $lang['sys_error']);
    }
} elseif ($email) {
    $user_id = doquery("SELECT `id` FROM {{users}} WHERE `email_2` = '{$email}' LIMIT 1;", '', true);
    if (!$user_id['id']) {
        message($lang['log_lost_err_email'], $lang['sys_error']);
    } else {
        $last_confirm = doquery("SELECT *, UNIX_TIMESTAMP(`create_time`) as `unix_time` FROM {{confirmations}} WHERE `id_user`= '{$user_id['id']}' AND `type` = '{$confirm_password_reset}' LIMIT 1;", '', true);
        if ($last_confirm['unix_time']) {
            doquery("DELETE FROM {{confirmations}} WHERE `id` = '{$last_confirm['id']}' LIMIT 1;");
        }
        $confirm_code = sys_random_string();
        @($result = mymail($email, $lang['log_lost_email_title'], sprintf($lang['log_lost_email_code'], SN_ROOT_VIRTUAL . $_SERVER['PHP_SELF'], $confirm_code, date(FMT_DATE_TIME, $time_now + 3 * 24 * 60 * 60))));
        doquery("INSERT INTO {{confirmations}} SET `id_user`= '{$user_id['id']}', `type` = '{$confirm_password_reset}', `code` = '{$confirm_code}', `email` = '{$email}';");
        if ($result) {
            message($lang['log_lost_sent_code'], $lang['log_lost_header']);
        } else {
            message($lang['log_lost_err_sending'], $lang['sys_error']);
        }
    }
    message('Le nouveau mot de passe a &eacute;t&eacute; envoy&eacute; avec succ&egrave;s !', 'OK');
}
$template = gettemplate('lostpassword', true);
$template->assign_vars(array('URL_RULES' => $config->url_rules, 'URL_FORUM' => $config->url_forum, 'URL_FAQ' => $config->url_faq));
tpl_login_lang($template, $id_ref);
display(parsetemplate($template), $lang['system'], false, '', false, false);
Example #30
0
function mymail1($email, $subject, $activate)
{
    mymail($email, $subject, $activate);
}