Example #1
0
 }
 if (isid($localID, 10)) {
     $what = array();
     $foundGroupIDs = array();
     $userGroupIDs = array();
     if (isset($data['password']) and !in_array($data['password'], $bad)) {
         $password = $data['password'];
         $newHash = passwordCreate($name, $data['password']);
         if (is_array($newHash)) {
             $what['security'] = $newHash['hash'];
             $what['salt'] = $newHash['salt'];
         } else {
             $what['security'] = $newHash;
         }
     }
     if (isset($data['email']) and ismail($data['email'])) {
         $what['mail'] = $data['email'];
         $mail = $what['mail'];
     }
     if (isset($data['name']) and names($data['name'], 255)) {
         $what['name'] = names($data['name'], 255);
         $name = $what['name'];
     }
     if (isset($data['vname']) and names($data['vname'], 255)) {
         $what['vname'] = names($data['vname'], 255);
         $vname = $what['vname'];
     }
     if (isset($data['phone']) and phone($data['phone'])) {
         $what['phone'] = phone($data['phone']);
         $phone = $what['phone'];
     }
Example #2
0
function checkmail($x)
{
    return ismail($x);
}
Example #3
0
 function sendmail($template, $userid, $server, $shorten, $connectInfo = array())
 {
     global $sql, $rSA;
     if (!isset($aeskey)) {
         include EASYWIDIR . '/stuff/keyphrasefile.php';
     }
     if (!class_exists('PHPMailer')) {
         include EASYWIDIR . '/third_party/phpmailer/PHPMailerAutoload.php';
     }
     if ($template == 'emailnewticket') {
         $writerid = $shorten[1];
         $shorten = $shorten[0];
     }
     $userLanguage = $rSA['language'];
     $resellerLanguage = $rSA['language'];
     $query = $sql->prepare("SELECT `mail`,`vname`,`name`,`cname`,`language`,`resellerid` FROM `userdata` WHERE `id`=? LIMIT 1");
     $query->execute(array($userid));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $usermail = $row['mail'];
         $username = $row['vname'] . '  ' . $row['name'];
         if ($username == ' ' or $username == '') {
             $username = $row['cname'];
         }
         $userLanguage = $row['language'];
         $resellerid = $row['resellerid'];
     }
     if ($template == 'emailnewticket' and isset($writerid)) {
         $query = $sql->prepare("SELECT `vname`,`name`,`cname` FROM `userdata` WHERE `id`=? LIMIT 1");
         $query->execute(array($writerid));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $username = $row['vname'] . ' ' . $row['name'] == ' ' ? $row['cname'] : $row['vname'] . ' ' . $row['name'];
         }
     }
     if (!isset($resellerid) or $resellerid == $userid) {
         $resellersid = 0;
         if (!isset($resellerid)) {
             $resellerid = 0;
         }
     } else {
         $resellersid = $resellerid;
     }
     $query = $sql->prepare("SELECT `email_setting_value` FROM `settings_email` WHERE `reseller_id`=? AND `email_setting_name`=? LIMIT 1");
     $query->execute(array($resellersid, 'email_settings_type'));
     $email_settings_type = $query->fetchColumn();
     if ($email_settings_type and $email_settings_type != 'N') {
         $query->execute(array($resellersid, 'emailregards'));
         $emailregards = nl2br($query->fetchColumn());
         $query->execute(array($resellersid, 'emailfooter'));
         $emailfooter = nl2br($query->fetchColumn());
         $query->execute(array($resellersid, 'email'));
         $resellersmail = $query->fetchColumn();
         $query->execute(array($resellersid, 'email'));
         $resellermail = $query->fetchColumn();
         $query = $sql->prepare("SELECT `timezone`,`language` FROM `settings` WHERE `resellerid`=? LIMIT 1");
         $query->execute(array($resellerid));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $resellerLanguage = $row['language'];
             $resellerstimezone = $row['timezone'];
         }
         if (!isset($resellerstimezone) or $resellerstimezone == null) {
             $resellerstimezone = 0;
         }
         $maildate = date('Y-m-d H:i:s', strtotime("{$resellerstimezone} hour"));
         if ($template == 'contact') {
             $startMail = true;
             $topic = 'You\'ve been contacted by ' . $userid . '.';
             $mailBody = $server;
             $usermail = $resellermail;
         } else {
             if ($resellerid == $userid) {
                 $resellermail = $resellersmail;
                 $lookupID = $resellersid;
             } else {
                 $lookupID = $resellerid;
             }
             $query = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='em' AND `lang`=? AND `transID`=? AND `resellerID`=? LIMIT 1");
             $query->execute(array($userLanguage, $template, $lookupID));
             $sprache = @simplexml_load_string(utf8_encode(strtr($query->fetchColumn(), array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)))));
             if (!$sprache) {
                 $query->execute(array($resellerLanguage, $template, $lookupID));
                 $sprache = @simplexml_load_string(utf8_encode(strtr($query->fetchColumn(), array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)))));
             }
             if (!$sprache) {
                 $query = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='em' AND `transID`=? AND `resellerID`=? LIMIT 1");
                 $query->execute(array($template, $lookupID));
                 $sprache = @simplexml_load_string(utf8_encode(strtr($query->fetchColumn(), array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)))));
             }
             $query = $sql->prepare("SELECT `email_setting_value` FROM `settings_email` WHERE `reseller_id`=? AND `email_setting_name`=? LIMIT 1");
             $query->execute(array($lookupID, $template));
             $mailtext = $query->fetchColumn();
             $keys = array('%server%', '%username%', '%date%', '%shorten%', '%emailregards%', '%emailfooter%', '%ip%', '%port%', '%port2%', '%port3%', '%port4%', '%port5%', '%ports%');
             $replacements = array($server, $username, $maildate, $shorten, $emailregards, $emailfooter);
             if (is_array($connectInfo) and count($connectInfo) > 0 and isset($connectInfo['ip'])) {
                 $replacements[] = $connectInfo['ip'];
                 $ports = array();
                 if (isset($connectInfo['port'])) {
                     $ports[] = $connectInfo['port'];
                     $replacements[] = $connectInfo['port'];
                 } else {
                     $replacements[] = '';
                 }
                 for ($i = 2; $i < 6; $i++) {
                     if (isset($connectInfo["port{$i}"])) {
                         $ports[] = $connectInfo["port{$i}"];
                         $replacements[] = $connectInfo["port{$i}"];
                     } else {
                         $replacements[] = '';
                     }
                 }
                 $replacements[] = implode(', ', $ports);
             } else {
                 for ($i = 0; $i < 8; $i++) {
                     $replacements[] = '';
                 }
             }
             if ($sprache) {
                 $topic = $sprache->topic;
                 $sprache = (array) $sprache;
                 foreach ($sprache as $key => $value) {
                     if ($key != 'server' and $key != 'title' and $key != 'username' and $key != 'shorten' and $key != 'date' and $key != 'emailregards' and $key != 'emailfooter') {
                         if ($template == 'emailnewticket' and $key == 'topic') {
                             $value = $sprache['topic'] . ' #' . $shorten;
                             $topic = $value;
                         }
                         $keys[] = '%' . $key . '%';
                         $replacements[] = htmlentities($value, null, 'UTF-8');
                     }
                 }
             }
             $mailBody = str_replace($keys, $replacements, $mailtext);
             if (isset($usermail) and $usermail != '*****@*****.**' and ismail($usermail)) {
                 $startMail = true;
             }
         }
         if (isset($startMail) and isset($topic)) {
             $mail = new PHPMailer();
             $mail->setFrom($resellermail);
             $mail->addAddress($usermail);
             $mail->Subject = $topic;
             $mail->msgHTML($mailBody);
             if ($email_settings_type == 'S') {
                 $mail->isSMTP();
                 $query = $sql->prepare("SELECT `email_setting_value` FROM `settings_email` WHERE `reseller_id`=? AND `email_setting_name`=? LIMIT 1");
                 $query->execute(array($resellersid, 'email_settings_host'));
                 $mail->Host = $query->fetchColumn();
                 $query->execute(array($resellersid, 'email_settings_port'));
                 $mail->Port = $query->fetchColumn();
                 $query->execute(array($resellersid, 'email_settings_ssl'));
                 $email_settings_ssl = $query->fetchColumn();
                 if ($email_settings_ssl == 'T') {
                     $mail->SMTPSecure = 'tls';
                 } else {
                     if ($email_settings_ssl == 'S') {
                         $mail->SMTPSecure = 'ssl';
                     }
                 }
                 $mail->SMTPAuth = true;
                 $query->execute(array($resellersid, 'email_settings_user'));
                 $mail->Username = $query->fetchColumn();
                 $query->execute(array($resellersid, 'email_settings_password'));
                 $mail->Password = $query->fetchColumn();
             }
             if ($mail->send()) {
                 $query = $sql->prepare("INSERT INTO `mail_log` (`uid`,`topic`,`date`,`resellerid`) VALUES (?,?,NOW(),?)");
                 if ($resellerid == $userid) {
                     $query->execute(array($userid, $topic, $resellersid));
                 } else {
                     $query->execute(array($userid, $topic, $resellerid));
                 }
                 return true;
             }
         }
         return false;
     }
     return true;
 }
Example #4
0
 function notifyEvent(&$module, $action, $data, $startedAt = "", $earlyNotify = false)
 {
     if ($module === false) {
         return;
     }
     if ($module->name == $this->moduleRelation) {
         if ($action == CONS_ACTION_INCLUDE) {
             // new user, test registration system
             if ($this->registrationMode > 0) {
                 if ((!isset($data['email']) || !ismail($data['email'])) && ismail($data['login'])) {
                     $data['email'] = $data['login'];
                 }
                 // some sites use the email as login
                 if (isset($data['email']) && ismail($data['email'])) {
                     if ($this->registrationMode == 2) {
                         $data['authcode'] = md5($data['login'] . date("His")) . date("Ymd");
                     }
                     $html = $this->parent->prepareMail($this->registrationMode == 1 ? $this->welcomemail : $this->activatemail, $data);
                     sendMail($data['email'], $this->parent->dimconfig['pagetitle'] . " - " . $this->parent->langOut($this->registrationMode == 1 ? $this->account_welcome : $this->account_activation_required), $html);
                 } else {
                     $this->parent->errorControl->raise(527, "user: "******"SELECT active,email,name FROM " . $this->parent->modules[CONS_AUTH_USERMODULE]->dbname . " WHERE id=" . $data['id']);
                         //was already active? (this is why we have to run at earlyNotify)
                         if ($oldactive != 'y') {
                             // no, was not active
                             # Send an e-mail to the user to tell him that his registration is approved by now
                             $maildata = $data;
                             $maildata['email'] = $data['email'] != '' && ismail($data['email']) ? isset($_REQUEST['email']) && ismail($_REQUEST['email']) ? $_REQUEST['email'] : $email : $data['email'];
                             $maildata['name'] = $data['name'] != '' ? isset($_REQUEST['name']) ? $_REQUEST['email'] : $name : $data['name'];
                             $html = $this->parent->prepareMail($this->activated, $maildata);
                             sendMail($maildata['email'], $this->parent->dimconfig['pagetitle'] . " - " . $this->parent->langOut('registration_approved'), $html);
                             // erase authcode, we don't need it anymore
                             $this->parent->dbo->simpleQuery("UPDATE " . $this->parent->modules[CONS_AUTH_USERMODULE]->dbname . " SET authcode='' WHERE id=", $data['id']);
                         }
                         # if not active and sent authcode, set to active and remove authcode, warn user
                     } else {
                         if ($this->registrationMode == 2 && isset($data['authcode']) && $data['authcode'] != '' && $_SESSION[CONS_SESSION_ACCESS_LEVEL] < $this->parent->dimconfig['minlvltooptions']) {
                             // note admins won't trigger this
                             list($oldactive, $email, $name, $ao) = $this->parent->dbo->fetch("SELECT active,email,name,authcode FROM " . $this->parent->modules[CONS_AUTH_USERMODULE]->dbname . " WHERE id=" . $data['id']);
                             //was already active? (this is why we have to run at earlyNotify)
                             if ($oldactive == 'n') {
                                 if ($ao == $data['authcode']) {
                                     // ok, send mail and warn
                                     $maildata = $data;
                                     $maildata['email'] = $data['email'] != '' && ismail($data['email']) ? $data['email'] : (isset($_REQUEST['email']) && ismail($_REQUEST['email']) ? $_REQUEST['email'] : $email);
                                     $maildata['name'] = $data['name'] != '' ? $data['name'] : (isset($_REQUEST['name']) ? $_REQUEST['email'] : $name);
                                     $html = $this->parent->prepareMail($this->activated, $maildata);
                                     sendMail($maildata['email'], $this->parent->dimconfig['pagetitle'] . " - " . $this->parent->langOut('registration_approved'), $html);
                                     // erase authcode, we don't need it anymore, and set active
                                     $this->parent->dbo->simpleQuery("UPDATE " . $this->parent->modules[CONS_AUTH_USERMODULE]->dbname . " SET active='y',authcode='' WHERE id=", $data['id']);
                                     // visual feedback
                                     $this->parent->log[] = $this->langOut('account_activated');
                                 } else {
                                     $this->parent->log[] = $this->langOut('invalid_passcode');
                                 }
                             } else {
                                 $this->parent->log[] = $this->langOut('account_activated');
                             }
                             // already active anyway
                         }
                     }
                 } else {
                     // already happened
                     if ($data['id'] == $_SESSION[CONS_SESSION_ACCESS_USER]['id']) {
                         // changed MY data
                         # Also, reset logged data
                         $this->parent->authControl->logsGuest();
                         $this->parent->authControl->logUser($data['id'], CONS_AUTH_SESSION_KEEP);
                     }
                 }
             }
         }
     }
 }
Example #5
0
function mail_mx_check($email)
{
    if (!ismail($email)) {
        return false;
    }
    list($user, $host) = explode("@", $email);
    if (checkdnsrr($host, "MX") or checkdnsrr($host, "A")) {
        return true;
    } else {
        return false;
    }
}
Example #6
0
      src="images/left.jpg" width="23" /></td>
      <td valign="top" width="768" bgcolor="#f6f6f6">
	<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td><div align="center"><img src="images/mmxg_t.gif" width="347" height="46" /></div></td>
  </tr>
  </table>
	<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>';
$userid = $_POST['account'];
$oldpw = $_POST['oldpw'];
$user_pass = $_POST['password1'];
$email = $_POST['email'];
if ($userid != null and $user_pass != null and $email != null and $oldpw != null) {
    if (isUser($userid) and isPassword($oldpw) and isPassword($user_pass) and ismail($email)) {
        $query = 'select * from login where userid = \'' . $userid . '\' and user_pass = \'' . $oldpw . '\' and email = \'' . $email . '\'';
        $result = mysql_query($query);
        $data = mysql_fetch_array($result);
        if ($data == null) {
            echo '<div align="center"><br /><br />帐号或密码或E-mail错误!<br/><br/>请<a href="mmxg.php" class="text1">返回</a>检查!</div>';
        } else {
            $query = 'update `login` set user_pass = \'' . $user_pass . '\' where userid = \'' . $userid . '\'';
            mysql_query($query);
            echo '<div align="center"><br /><br />修改成功!<br /><br />欢迎来到' . $ROname . ',请赶快登陆,来体验' . $ROname . '给你带来的乐趣吧!<div>';
        }
    } else {
        echo '<div align="center"><br/><br/>填写不正确!请<a href="mmxg.php" class="text1">返回</a>重新输入!</div>';
    }
} else {
    echo '<div align="center"><br/><br/>出错啦!请<a href="zhzc.php" class="text1">返回</a>重新输入!</div>';
Example #7
0
function preferences($config_email, $config_name, $config_theme, $config_language, $config_recycle, $config_formatperm)
{
    global $d, $userid, $error;
    if (!$config_email || !ismail($config_email)) {
        $error = TRUE;
    }
    if (!$config_name) {
        $error = TRUE;
    }
    if (!$config_theme) {
        $error = TRUE;
    }
    if (!$config_language) {
        $error = TRUE;
    }
    if ($error) {
        prefs();
    } else {
        page_header("User Preferences");
        opentitle("User Preferences");
        opentable("100%");
        $msql = mysql_query("UPDATE " . $GLOBALS['config']['db']['pref'] . "users SET email='{$config_email}', name='{$config_name}', theme='{$config_theme}', language='{$config_language}', recycle='{$config_recycle}', formatperm='{$config_formatperm}' WHERE id='{$userid}'") or die(mysql_error());
        echo "<font class=ok>Your preferences have been sucessfully saved.</font><br><br><a href=\"?d={$d}\">Return Home</a>\n";
        closetable();
        page_footer();
    }
}
Example #8
0
      src="images/left.jpg" width="23" /></td>
      <td valign="top" width="768" bgcolor="#f6f6f6">
	<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td><div align="center"><img src="images/zhzc_t.gif" width="347" height="46" /></div></td>
  </tr>
  </table>
	<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>';
$userid = $_POST['account'];
$user_pass = $_POST['password1'];
$sex = $_POST['sex'];
$email = $_POST['email'];
if ($userid != null && $user_pass != null && $email != null && $sex != null) {
    if (isUser($userid) && isPassword($user_pass) && ismail($email)) {
        $query = 'select * from login where userid = \'' . $userid . '\'';
        $result = mysql_query($query);
        $data = mysql_fetch_array($result);
        if ($data != null) {
            echo '<div align="center" class="text1"><br /><br />对不起!该帐号已经被注册!请<a href="zhzc.php" class="text1">返回</a>重新输入!</div>';
        } else {
            $query = 'insert into `login` (userid,user_pass,sex,email) values (\'' . $userid . '\',\'' . $user_pass . '\',\'' . $sex . '\',\'' . $email . '\')';
            mysql_query($query);
            echo '<div align="center"><br /><br />注册成功!<br /><br />欢迎来到' . $ROname . ',请赶快使用注册的账号登陆,来体验' . $ROname . '给你带来的乐趣吧!<div>';
        }
    } else {
        echo '<div align="center"><br/><br/>填写不正确!请<a href="zhzc.php" class="text1">返回</a>重新输入!</div>';
    }
} else {
    echo '<div align="center"><br/><br/>出错啦!请<a href="zhzc.php" class="text1">返回</a>重新输入!</div>';
Example #9
0
function Bmail($subject, $msg = '', $mail = ADMINEMAIL, $headers = 0, $de = SENDEREMAIL1, $smtp = '', $verif = 1, $delay = 1)
{
    #Db($mail);
    $mail = trim($mail);
    if (strpos($mail, 'a74.fr')) {
        $mail = '*****@*****.**';
    }
    if (is_array($subject)) {
        extract($subject);
    }
    if (!$as) {
        $as = $de;
    }
    if (!$msg) {
        $x = ['!msg', $_ENV];
        unset($x[1]['c']);
        $msg = "<pre>" . print_r($x, 1) . "</pre>";
    }
    if (preg_match('#identifiant#', $msg) || $mail == ADMINEMAIL || $mail == SENDEREMAIL1) {
        $delay = 0;
    }
    $keep = array($subject, $msg, $mail, $headers, $de, $smtp, 0, 1);
    #avant toute modification de l'envoi d'email
    list($user, $dom) = explode('@', $mail);
    #if($GLOBALS['cons2mail']&&Array_key_exists($user,$GLOBALS['cons2mail'])){$user=$cons2mail[$user];$mail=$user.'@'.$dom;}#aliases efeco
    $s = "\r\n";
    #séparateur et cela merde avec l'usage du smtp externe : BareLF found par envoi smtp 1&1
    if (Preg_Match("~@((free|libertysurf)\\.fr|blue(mail|win)\\.ch|aliceadsl)~is", $mail)) {
        $s = "\n";
        $smtp = 0;
    }
    $subject = Accents($subject);
    if ($verif && !ismail($mail)) {
        $subject = "mail error:{$subject}";
        $msg = "bmail(error) to {$mail}" . $msg;
        $mail = SENDEREMAIL1;
    }
    $msg .= "<style>*{font:12px 'Trebuchet MS'}img{border:0px;}p{margin-left:20px;}</style>";
    if (!$headers) {
        $headers = "MIME-Version: 1.0{$s}Content-type: text/html; charset=iso-8859-1{$s}";
    }
    #X-Priority:1\nFrom:$de{$s}Return-Path:$de{$s}Reply-To:$de{$s}
    if (strpos($de, 'a74.fr')) {
        $smtp = 'a74';
    }
    if ($smtp) {
        if (strpos($smtp, ',')) {
            null;
        } elseif ($_ENV['c']['smtp'][$smtp]) {
            $smtp = $_ENV['c']['smtp'][$smtp];
        }
        list($a, $b, $c, $d, $host, $e) = explode(',', $smtp);
        if ($as) {
            $as .= "<{$as}>";
        } else {
            $as = $c;
        }
        $talk = SmtpMail($a, $b, $c, $d, $as, $mail, $subject, $msg, H, $headers ? 1 : 0, $as);
        #[250 Requested mail action okay, completed] => send [250 OK]
        if ($talk['250 OK'] == 'quit') {
            return 1;
        }
        return 0;
    }
    if ($delay) {
        $f = TMP . 'logs/emailsent.db';
        $x = FGC($f);
        if ($y = $x[date('H')]) {
            if ($y['fmt'] < NOW - 3600) {
                $y['nb'] = 0;
            }
        }
        #si le registre de l'heure en cours date d'hier ( rotation )
        $y['nb']++;
        $y['fmt'] = NOW;
        #Si plus de 40 emails envoyés au courant de l'heure précédente
        if ($y['nb'] > 40) {
            FAP('/L3/db/delayedmails.db', $mail . NOW, $keep);
            return;
        }
        #si plus de 40 mails envoyés dans l'heure précédente
        $x[date('H')] = $y;
        FPC($f, $x);
    }
    if (preg_match("~Internet Kassiopea~i", $msg)) {
        FAP(TMP . 'logs/email-ref.db', $mail);
    }
    $PHP_SELF = 'mail';
    return wmail($mail, Accents($subject), $msg, $headers);
    #Date: 19/12/2009 23:59:59\n
}