コード例 #1
0
function upload($user_name, $email, $message, $file)
{
    global $dbstamian;
    if (empty($user_name)) {
        echo 'Sorry Username empty';
    } elseif (empty($email)) {
        echo 'Sorry Email empty';
    } elseif (empty($message)) {
        echo 'Sorry Message empty';
    } elseif (empty($file)) {
        echo 'Sorry File Empty';
    } elseif ($file['file_attach']['size'] > 41943040) {
        echo 'Sorry File limit 40 MB';
    } else {
        $file_dir = 'file/';
        $file_name = rand(00, 9999) . "_" . ereg_replace('[[:space:]]+', '_', trim(addslashes(strip_tags($file['file_attach']['name']))));
        $file_size = $file['file_attach']['size'];
        $file_tmp = $file['file_attach']['tmp_name'];
        $file_type = $file['file_attach']['type'];
        $file_ext = strtolower(end(explode('.', $file_name)));
        $regex = "/^([0-9])+_?([0-9a-zA-Z\\_\\-]+).{1}(jpeg|jpg|png|pdf|doc|docx)+/";
        $match = preg_match($regex, $file_name);
        $file_allow = array("jpeg", "jpg", "png", "pdf", "doc", "docx");
        $mim_type = array("image/jpeg", "image/jpg", "image/png", "application/pdf", "application/doc", "application/docx");
        if (in_array($file_ext, $file_allow) === true and in_array($file_type, $mim_type) === true and !file_exists($file_dir, $file_name) and checkemail($email) == true and $match == true) {
            $sql = "INSERT INTO contact(contact.contact_name,contact.contact_email,contact.contact_file,contact.contact_date,contact.contact_message) VALUES('" . $user_name . "','" . $email . "','" . $file_name . "',NOW(),'" . $message . "')";
            $result = mysql_query($sql, $dbstamian);
            mysql_insert_id();
            $send = sendmail($user_name, $email, $message, $file_name, $file_tmp, $file_size, $file_type);
            if (!$result and !$send) {
                echo 'Echec de telechargement, Meri de renvoyer votre fichier';
            } else {
                if ($file['file_attach']['error'] == 1) {
                    echo 'file upload max file size over limit php.ini';
                } elseif ($file['file_attach']['error'] == 2) {
                    echo 'File Max_file_SIZE for form';
                } elseif ($file['file_attach']['error'] == 3) {
                    echo 'upload file not a connect server';
                } elseif ($file['file_attach']['error'] == 4) {
                    echo 'Not a file';
                } elseif ($file['file_attach']['error'] == 0) {
                    @move_uploaded_file($file_tmp, $file_dir . $file_name);
                    echo "Merci votre fichier a été envoyé";
                }
            }
        } else {
            echo 'Echec, votre fichier doit etre au format pdf';
        }
    }
}
コード例 #2
0
ファイル: edit.php プロジェクト: buxiaoyang/EmailArchive
 private function validate()
 {
     if (isset($this->request->post['password']) && strlen($this->request->post['password']) > 1) {
         if (strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH || strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {
             $this->error['password'] = $this->data['text_invalid_password'];
         }
         if ($this->request->post['password'] != $this->request->post['password2']) {
             $this->error['password2'] = $this->data['text_password_mismatch'];
         }
     }
     if (!isset($this->request->post['uid']) || !is_numeric($this->request->post['uid']) || (int) $this->request->post['uid'] < 0) {
         $this->error['uid'] = $this->data['text_invalid_uid'];
     }
     if (strlen(@$this->request->post['email']) < 4) {
         $this->error['email'] = $this->data['text_invalid_email'];
     } else {
         $emails = explode("\n", $this->request->post['email']);
         foreach ($emails as $email) {
             $email = rtrim($email);
             if ($email == '') {
                 continue;
             }
             $ret = checkemail($email, $this->domains);
             if ($ret == 0) {
                 $this->error['email'] = $this->data['text_invalid_email'] . ": *{$email}*";
             } else {
                 if ($ret == -1) {
                     $this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": *{$email}*";
                 }
             }
         }
     }
     if (!isset($this->request->post['username']) || strlen($this->request->post['username']) < 2) {
         $this->error['username'] = $this->data['text_invalid_username'];
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
コード例 #3
0
ファイル: upload2.php プロジェクト: sdgdsffdsfff/crm
 if (checkMobile($mobile) == "2") {
     $tel = $mobile;
     $mobile = "";
 }
 if (checkemail($email) == "3") {
     $email = "";
 }
 $isvalid = true;
 $errmsg = "";
 if (trim($companyName) == "") {
     //公司名字
     $errmsg = $errmsg . "公司名字不能为空;";
     $isvalid = false;
 }
 //三个多不是的话,就不要导入
 if (checkMobile($phone) == "3" && checkMobile($mobile) == "3" && checkemail($email) == "3") {
     $errmsg = $errmsg . "电话和手机和电子邮件三者不能为空;";
     $isvalid = false;
 }
 $sql = get_sql("select id from {pre}pool where companyName='" . $companyName . "'");
 $rows = $db->getRowsNum($sql);
 if ($rows > 0) {
     $errmsg = $errmsg . "公司名字存在了;";
     $isvalid = false;
     $data = $db->getonerow($sql);
     //更新电话等信息
     $record = array('companyName' => $companyName, 'name' => $name, 'addr' => $addr, 'tel' => $tel, 'mobile' => $mobile, 'email' => $email, 'qq' => $qq, 'url' => $url, 'remark' => $remark, 'createTime' => date('Y-m-d h-m-s'));
     $db->update($GLOBALS[databasePrefix] . 'pool', $record, 'id=' . $data["id"]);
 }
 if (trim($email) != "") {
     $sql = get_sql("select id from {pre}pool where email='" . $email . "'");
コード例 #4
0
ファイル: config.php プロジェクト: eferuzi/kiGM
    $connection->query($query) or die($connection->error);
    return TRUE;
}
function insteringDefaultsInfo($langcode)
{
    global $connection;
    if ($stmt = $connection->prepare("SELECT en_id,en_tag FROM gm_en ORDER BY en_id")) {
        $stmt->execute();
        $stmt->bind_result($en_id, $en_tag);
        $query = "INSERT INTO gm_" . $langcode . "(id, status) VALUES";
        while ($stmt->fetch()) {
            $query .= "(" . $en_id . ",0),";
        }
        $stmt->close();
        $query = substr_replace($query, "", -1);
        $connection->query($query) or die($connection->error);
        return TRUE;
    }
}
$langcode = trim($_POST['langcode']);
$groupemail = $connection->real_escape_string(trim($_POST['groupemail']));
if (checkemail($groupemail)) {
    $success = insterConfigInfo($langcode, $groupemail);
    $success = createTranslationTables($langcode);
    $success = insteringDefaultsInfo($langcode);
} else {
    $error = array();
    $error['email'] = "Invalid Translators Group Email";
    $_SESSION['config_error'] = $error;
}
header("Location: ../index.php");
コード例 #5
0
ファイル: exam2.php プロジェクト: Setthawut/bla
<?php

include "sc1.php";
$email1 = "*****@*****.**";
$email2 = "jerasith#hotmail.com";
echo $email1 . checkemail($email1);
echo $email2 . checkemail($email2);
コード例 #6
0
ファイル: edit2.php プロジェクト: nung421/phpworkshop1
<?php

include "chksession.php";
$email_edit = $_POST[email_edit];
$tel_edit = $_POST[tel_edit];
$address_edit = $_POST[address_edit];
include "function.php";
if (!checkemail($email_edit)) {
    echo "<h3>ERROR : цы╩А╨╨муЮае╥уХ║цм║ДаХ╤ы║╣Им╖╧п╓ця╨ </h3>";
    exit;
}
include "connect.php";
$sql = "update tb_member set  email='{$email_edit}', telephone='{$tel_edit}' ,address='{$address_edit}' where username='******' ";
$result = mysql_db_query($dbname, $sql);
if ($result) {
    echo "<h3>╒Имаые╒м╖╥Хр╧╤ы║А║ИД╒Юцуб╨цИмбАеИг</h3>";
    echo "[ <a href=main.php>║ея╨к╧Иркея║</a> ] ";
} else {
    echo "<h3>ДаХйрарц╤А║ИД╒╒ИмаыеД╢И</h3>";
}
mysql_close();
コード例 #7
0
ファイル: forum_ajax.php プロジェクト: vanloswang/DiscuzX
    } elseif ($ucresult == -2) {
        showmessage('profile_username_protect', '', array(), array('handle' => false));
    } elseif ($ucresult == -3) {
        if (C::t('common_member')->fetch_by_username($username) || C::t('common_member_archive')->fetch_by_username($username)) {
            showmessage('register_check_found', '', array(), array('handle' => false));
        } else {
            showmessage('register_activation', '', array(), array('handle' => false));
        }
    }
    $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($_G['setting']['censoruser'] = trim($_G['setting']['censoruser']), '/')) . ')$/i';
    if ($_G['setting']['censoruser'] && @preg_match($censorexp, $username)) {
        showmessage('profile_username_protect', '', array(), array('handle' => false));
    }
} elseif ($_GET['action'] == 'checkemail') {
    require_once libfile('function/member');
    checkemail($_GET['email']);
} elseif ($_GET['action'] == 'checkinvitecode') {
    $invitecode = trim($_GET['invitecode']);
    if (!$invitecode) {
        showmessage('no_invitation_code', '', array(), array('handle' => false));
    }
    $result = array();
    if ($invite = C::t('common_invite')->fetch_by_code($invitecode)) {
        if (empty($invite['fuid']) && (empty($invite['endtime']) || $_G['timestamp'] < $invite['endtime'])) {
            $result['uid'] = $invite['uid'];
            $result['id'] = $invite['id'];
            $result['appid'] = $invite['appid'];
        }
    }
    if (empty($result)) {
        showmessage('wrong_invitation_code', '', array(), array('handle' => false));
コード例 #8
0
ファイル: phpdisk.p.inc.php プロジェクト: saintho/phpdisk
function auth_task_guest()
{
    global $db, $tpf, $pd_uid, $pd_gid;
    form_auth(gpc('formhash', 'P', ''), formhash());
    $username = trim(gpc('username', 'P', ''));
    $password = trim(gpc('password', 'P', ''));
    $confirm_password = trim(gpc('confirm_password', 'P', ''));
    $email = trim(gpc('email', 'P', ''));
    $ref = trim(gpc('ref', 'P', ''));
    if (checklength($username, 2, 60)) {
        $error = true;
        $sysmsg[] = __('invalid_username');
    } elseif (is_bad_chars($username)) {
        $error = true;
        $sysmsg[] = __('username_has_bad_chars');
    } else {
        $rs = $db->fetch_one_array("select username from {$tpf}users where username='******' and userid<>'{$pd_uid}' limit 1");
        if ($rs) {
            if (strcasecmp($username, $rs['username']) == 0) {
                $error = true;
                $sysmsg[] = __('username_already_exists');
            }
        }
        unset($rs);
    }
    if (checklength($password, 6, 20)) {
        $error = true;
        $sysmsg[] = __('invalid_password');
    } else {
        if ($password == $confirm_password) {
            $md5_pwd = md5($password);
        } else {
            $error = true;
            $sysmsg[] = __('confirm_password_invalid');
        }
    }
    if (!checkemail($email)) {
        $error = true;
        $sysmsg[] = __('invalid_email');
    } else {
        $rs = $db->fetch_one_array("select email from {$tpf}users where email='{$email}' and userid<>'{$pd_uid}' limit 1");
        if ($rs) {
            if (strcasecmp($email, $rs['email']) == 0) {
                $error = true;
                $sysmsg[] = __('email_already_exists');
            }
            unset($rs);
        }
    }
    if (!$error) {
        $ins = array('username' => $username, 'password' => $md5_pwd, 'email' => $email, 'space_name' => $username . __('file'), 'can_edit' => 0);
        $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$pd_uid}'");
        pd_setcookie('phpdisk_zcore_info', pd_encode("{$pd_uid}\t{$pd_gid}\t{$username}\t{$md5_pwd}\t{$email}"), 86400 * 3);
        $sysmsg[] = __('guest_set_account_success');
        tb_redirect($ref, $sysmsg);
    } else {
        tb_redirect('back', $sysmsg);
    }
}
コード例 #9
0
ファイル: users.inc.php プロジェクト: saintho/phpdisk
         $sysmsg[] = __('invalid_password');
     } else {
         $income_pwd = md5($income_pwd);
     }
 } else {
     $income_pwd = @$db->result_first("select income_pwd from {$tpf}users where userid='{$uid}'");
 }
 if ($gid > 1) {
     $rs = $db->fetch_one_array("select count(*) as total from {$tpf}users where gid=1 and userid<>'{$uid}'");
     if (!$rs['total']) {
         $error = true;
         $sysmsg[] = __('only_one_admin');
     }
     unset($rs);
 }
 if (!checkemail($email)) {
     $error = true;
     $sysmsg[] = __('invalid_email');
 } else {
     $rs = $db->fetch_one_array("select email from {$tpf}users where email='{$email}' and userid<>'{$uid}'");
     if ($rs) {
         if (strcasecmp($email, $rs['email']) == 0) {
             $error = true;
             $sysmsg[] = __('email_already_exists');
         }
         unset($rs);
     }
 }
 $user_store_space = $user_store_space ? $user_store_space : 0;
 if ($user_file_types && substr($user_file_types, strlen($user_file_types) - 1, 1) == ',') {
     $user_file_types = substr($user_file_types, 0, -1);
コード例 #10
0
ファイル: email.inc.php プロジェクト: saintho/phpdisk
             redirect('back', $sysmsg);
         }
     } else {
         $setting = $settings;
         $setting['email_pwd'] = encode_pwd($setting['email_pwd']);
         require_once template_echo($item, $admin_tpl_dir, '', 1);
     }
     break;
 case 'mail_test':
     admin_no_power($task, 12, $pd_uid);
     if ($task == 'mail_test') {
         form_auth(gpc('formhash', 'P', ''), formhash());
         $receive_address = trim(gpc('receive_address', 'P', ''));
         $mail_subject = trim(gpc('mail_subject', 'P', ''));
         $mail_content = trim(gpc('mail_content', 'P', ''));
         if (!checkemail($receive_address)) {
             $error = true;
             $sysmsg[] = __('email_address_error');
         }
         if (checklength($mail_subject, 2, 80)) {
             $error = true;
             $sysmsg[] = __('email_subject_error');
         }
         if (checklength($mail_content, 2, 250)) {
             $error = true;
             $sysmsg[] = __('email_content_error');
         }
         if (!$error) {
             $to = $receive_address;
             $subject = $mail_subject;
             $body = $mail_content;
コード例 #11
0
 function on_register()
 {
     global $_G;
     $_GET['username'] = $_GET['' . $this->setting['reginput']['username']];
     $_GET['password'] = $_GET['' . $this->setting['reginput']['password']];
     $_GET['password2'] = $_GET['' . $this->setting['reginput']['password2']];
     $_GET['email'] = $_GET['' . $this->setting['reginput']['email']];
     if ($_G['uid']) {
         $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
         $url_forward = dreferer();
         if (strpos($url_forward, $this->setting['regname']) !== false) {
             $url_forward = 'forum.php';
         }
         showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array('extrajs' => $ucsynlogin));
     } elseif (!$this->setting['regclosed'] && (!$this->setting['regstatus'] || !$this->setting['ucactivation'])) {
         if ($_GET['action'] == 'activation' || $_GET['activationauth']) {
             if (!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) {
                 showmessage('register_disable_activation');
             }
         } elseif (!$this->setting['regstatus']) {
             if ($this->setting['regconnect']) {
                 dheader('location:connect.php?mod=login&op=init&referer=forum.php&statfrom=login_simple');
             }
             showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage']));
         }
     }
     $bbrules =& $this->setting['bbrules'];
     $bbrulesforce =& $this->setting['bbrulesforce'];
     $bbrulestxt =& $this->setting['bbrulestxt'];
     $welcomemsg =& $this->setting['welcomemsg'];
     $welcomemsgtitle =& $this->setting['welcomemsgtitle'];
     $welcomemsgtxt =& $this->setting['welcomemsgtxt'];
     $regname = $this->setting['regname'];
     if ($this->setting['regverify']) {
         if ($this->setting['areaverifywhite']) {
             $location = $whitearea = '';
             $location = trim(convertip($_G['clientip'], "./"));
             if ($location) {
                 $whitearea = preg_quote(trim($this->setting['areaverifywhite']), '/');
                 $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                 $whitearea = '.*' . $whitearea . '.*';
                 $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                 if (@preg_match($whitearea, $location)) {
                     $this->setting['regverify'] = 0;
                 }
             }
         }
         if ($_G['cache']['ipctrl']['ipverifywhite']) {
             foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $this->setting['regverify'] = 0;
                     break;
                 }
             }
         }
     }
     $invitestatus = false;
     if ($this->setting['regstatus'] == 2) {
         if ($this->setting['inviteconfig']['inviteareawhite']) {
             $location = $whitearea = '';
             $location = trim(convertip($_G['clientip'], "./"));
             if ($location) {
                 $whitearea = preg_quote(trim($this->setting['inviteconfig']['inviteareawhite']), '/');
                 $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                 $whitearea = '.*' . $whitearea . '.*';
                 $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                 if (@preg_match($whitearea, $location)) {
                     $invitestatus = true;
                 }
             }
         }
         if ($this->setting['inviteconfig']['inviteipwhite']) {
             foreach (explode("\n", $this->setting['inviteconfig']['inviteipwhite']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $invitestatus = true;
                     break;
                 }
             }
         }
     }
     $groupinfo = array();
     if ($this->setting['regverify']) {
         $groupinfo['groupid'] = 8;
     } else {
         $groupinfo['groupid'] = $this->setting['newusergroupid'];
     }
     $seccodecheck = $this->setting['seccodestatus'] & 1;
     $secqaacheck = $this->setting['secqaa']['status'] & 1;
     $fromuid = !empty($_G['cookie']['promotion']) && $this->setting['creditspolicy']['promotion_register'] ? intval($_G['cookie']['promotion']) : 0;
     $username = isset($_GET['username']) ? $_GET['username'] : '';
     $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
     $auth = $_GET['auth'];
     if (!$invitestatus) {
         $invite = getinvite();
     }
     $sendurl = $this->setting['sendregisterurl'] ? true : false;
     if ($sendurl) {
         if (!empty($_GET['hash'])) {
             $_GET['hash'] = preg_replace("/[^\\[A-Za-z0-9_\\]%]/", '', $_GET['hash']);
             $hash = explode("\t", authcode($_GET['hash'], 'DECODE', $_G['config']['security']['authkey']));
             if (is_array($hash) && isemail($hash[0]) && TIMESTAMP - $hash[1] < 259200) {
                 $sendurl = false;
             }
         }
     }
     if (!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) {
         if ($_GET['action'] == 'activation') {
             $auth = explode("\t", authcode($auth, 'DECODE'));
             if (FORMHASH != $auth[1]) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
             $username = $auth[0];
             $activationauth = authcode("{$auth['0']}\t" . FORMHASH, 'ENCODE');
             $sendurl = false;
         }
         if (!$sendurl) {
             if ($fromuid) {
                 $member = getuserbyuid($fromuid);
                 if (!empty($member)) {
                     $fromuser = dhtmlspecialchars($member['username']);
                 } else {
                     dsetcookie('promotion');
                 }
             }
             if ($_GET['action'] == 'activation') {
                 $auth = dhtmlspecialchars($auth);
             }
             if ($seccodecheck) {
                 $seccode = random(6, 1);
             }
             $username = dhtmlspecialchars($username);
             $htmls = $settings = array();
             foreach ($_G['cache']['fields_register'] as $field) {
                 $fieldid = $field['fieldid'];
                 $html = profile_setting($fieldid, array(), false, false, true);
                 if ($html) {
                     $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
                     $htmls[$fieldid] = $html;
                 }
             }
             $navtitle = $this->setting['reglinkname'];
             if ($this->extrafile && file_exists($this->extrafile)) {
                 require_once $this->extrafile;
             }
         }
         $bbrulestxt = nl2br("\n{$bbrulestxt}\n\n");
         $dreferer = dreferer();
         include template($this->template);
     } else {
         $activationauth = array();
         if (isset($_GET['activationauth']) && $_GET['activationauth']) {
             $activationauth = explode("\t", authcode($_GET['activationauth'], 'DECODE'));
             if ($activationauth[1] != FORMHASH) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
             $sendurl = false;
         }
         if (!$activationauth && ($sendurl || !$_G['setting']['forgeemail'])) {
             checkemail($_GET['email']);
         }
         if ($sendurl) {
             $hashstr = urlencode(authcode("{$_GET['email']}\t{$_G['timestamp']}", 'ENCODE', $_G['config']['security']['authkey']));
             $registerurl = "{$_G[siteurl]}member.php?mod=" . $this->setting['regname'] . "&amp;hash={$hashstr}&amp;email={$_GET[email]}";
             $email_register_message = lang('email', 'email_register_message', array('bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $registerurl));
             if (!sendmail("{$_GET['email']} <{$_GET['email']}>", lang('email', 'email_register_subject'), $email_register_message)) {
                 runlog('sendmail', "{$_GET['email']} sendmail failed.");
             }
             showmessage('register_email_send_succeed', dreferer(), array('bbname' => $this->setting['bbname']), array('showdialog' => false, 'msgtype' => 3, 'closetime' => 10));
         }
         $emailstatus = 0;
         if ($this->setting['sendregisterurl'] && !$sendurl) {
             $_GET['email'] = strtolower($hash[0]);
             $this->setting['regverify'] = $this->setting['regverify'] == 1 ? 0 : $this->setting['regverify'];
             if (!$this->setting['regverify']) {
                 $groupinfo['groupid'] = $this->setting['newusergroupid'];
             }
             $emailstatus = 1;
         }
         if ($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) {
             showmessage('not_open_registration_invite');
         }
         if ($bbrules && $bbrulehash != $_POST['agreebbrule']) {
             showmessage('register_rules_agree');
         }
         $activation = array();
         if (isset($_GET['activationauth']) && $activationauth && is_array($activationauth)) {
             if ($activationauth[1] == FORMHASH && !($activation = uc_get_user($activationauth[0]))) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
         }
         if (!$activation) {
             $usernamelen = dstrlen($username);
             if ($usernamelen < 3) {
                 showmessage('profile_username_tooshort');
             } elseif ($usernamelen > 15) {
                 showmessage('profile_username_toolong');
             }
             if (uc_get_user(addslashes($username)) && !C::t('common_member')->fetch_uid_by_username($username) && !C::t('common_member_archive')->fetch_uid_by_username($username)) {
                 if ($_G['inajax']) {
                     showmessage('profile_username_duplicate');
                 } else {
                     showmessage('register_activation_message', 'member.php?mod=logging&action=login', array('username' => $username));
                 }
             }
             if ($this->setting['pwlength']) {
                 if (strlen($_GET['password']) < $this->setting['pwlength']) {
                     showmessage('profile_password_tooshort', '', array('pwlength' => $this->setting['pwlength']));
                 }
             }
             if ($this->setting['strongpw']) {
                 $strongpw_str = array();
                 if (in_array(1, $this->setting['strongpw']) && !preg_match("/\\d+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_1');
                 }
                 if (in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_2');
                 }
                 if (in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_3');
                 }
                 if (in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_4');
                 }
                 if ($strongpw_str) {
                     showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str));
                 }
             }
             $email = strtolower(trim($_GET['email']));
             if (empty($email) && $_G['setting']['forgeemail']) {
                 $_GET['email'] = $email = strtolower(random(6)) . '@' . $_SERVER['HTTP_HOST'];
             }
             if (empty($this->setting['ignorepassword'])) {
                 if ($_GET['password'] !== $_GET['password2']) {
                     showmessage('profile_passwd_notmatch');
                 }
                 if (!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
                     showmessage('profile_passwd_illegal');
                 }
                 $password = $_GET['password'];
             } else {
                 $password = md5(random(10));
             }
         }
         $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($this->setting['censoruser'] = trim($this->setting['censoruser']), '/')) . ')$/i';
         if ($this->setting['censoruser'] && @preg_match($censorexp, $username)) {
             showmessage('profile_username_protect');
         }
         if ($this->setting['regverify'] == 2 && !trim($_GET['regmessage'])) {
             showmessage('profile_required_info_invalid');
         }
         if ($_G['cache']['ipctrl']['ipregctrl']) {
             foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $ctrlip = $ctrlip . '%';
                     $this->setting['regctrl'] = $this->setting['ipregctrltime'];
                     break;
                 } else {
                     $ctrlip = $_G['clientip'];
                 }
             }
         } else {
             $ctrlip = $_G['clientip'];
         }
         if ($this->setting['regctrl']) {
             if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $this->setting['regctrl'] * 3600)) {
                 showmessage('register_ctrl', NULL, array('regctrl' => $this->setting['regctrl']));
             }
         }
         $setregip = null;
         if ($this->setting['regfloodctrl']) {
             $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
             if ($regip) {
                 if ($regip['count'] >= $this->setting['regfloodctrl']) {
                     showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $this->setting['regfloodctrl']));
                 } else {
                     $setregip = 1;
                 }
             } else {
                 $setregip = 2;
             }
         }
         $profile = $verifyarr = array();
         foreach ($_G['cache']['fields_register'] as $field) {
             if (defined('IN_MOBILE')) {
                 break;
             }
             $field_key = $field['fieldid'];
             $field_val = $_GET['' . $field_key];
             if ($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) {
                 $field_val = true;
             }
             if (!profile_check($field_key, $field_val)) {
                 $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday';
                 showmessage($field['title'] . lang('message', 'profile_illegal'), '', array(), array('showid' => 'chk_' . $showid, 'extrajs' => $field['title'] . lang('message', 'profile_illegal') . ($field['formtype'] == 'text' ? '<script type="text/javascript">' . '$(\'registerform\').' . $field['fieldid'] . '.className = \'px er\';' . '$(\'registerform\').' . $field['fieldid'] . '.onblur = function () { if(this.value != \'\') {this.className = \'px\';$(\'chk_' . $showid . '\').innerHTML = \'\';}}' . '</script>' : '')));
             }
             if ($field['needverify']) {
                 $verifyarr[$field_key] = $field_val;
             } else {
                 $profile[$field_key] = $field_val;
             }
         }
         if (!$activation) {
             $uid = uc_user_register(addslashes($username), $password, $email, $questionid, $answer, $_G['clientip']);
             if ($uid <= 0) {
                 if ($uid == -1) {
                     showmessage('profile_username_illegal');
                 } elseif ($uid == -2) {
                     showmessage('profile_username_protect');
                 } elseif ($uid == -3) {
                     showmessage('profile_username_duplicate');
                 } elseif ($uid == -4) {
                     showmessage('profile_email_illegal');
                 } elseif ($uid == -5) {
                     showmessage('profile_email_domain_illegal');
                 } elseif ($uid == -6) {
                     showmessage('profile_email_duplicate');
                 } else {
                     showmessage('undefined_action');
                 }
             }
         } else {
             list($uid, $username, $email) = $activation;
         }
         $_G['username'] = $username;
         if (getuserbyuid($uid, 1)) {
             if (!$activation) {
                 uc_user_delete($uid);
             }
             showmessage('profile_uid_duplicate', '', array('uid' => $uid));
         }
         $password = md5(random(10));
         $secques = $questionid > 0 ? random(8) : '';
         if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
             $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
         }
         if (isset($_POST['birthyear'])) {
             $profile['zodiac'] = get_zodiac($_POST['birthyear']);
         }
         if ($_FILES) {
             $upload = new discuz_upload();
             foreach ($_FILES as $key => $file) {
                 $field_key = 'field_' . $key;
                 if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
                     $upload->init($file, 'profile');
                     $attach = $upload->attach;
                     if (!$upload->error()) {
                         $upload->save();
                         if (!$upload->get_image_info($attach['target'])) {
                             @unlink($attach['target']);
                             continue;
                         }
                         $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
                         if ($_G['cache']['fields_register'][$field_key]['needverify']) {
                             $verifyarr[$key] = $attach['attachment'];
                         } else {
                             $profile[$key] = $attach['attachment'];
                         }
                     }
                 }
             }
         }
         if ($setregip !== null) {
             if ($setregip == 1) {
                 C::t('common_regip')->update_count_by_ip($_G['clientip']);
             } else {
                 C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
             }
         }
         if ($invite && $this->setting['inviteconfig']['invitegroupid']) {
             $groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid'];
         }
         $init_arr = array('credits' => explode(',', $this->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus);
         C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
         if ($emailstatus) {
             updatecreditbyaction('realemail', $uid);
         }
         if ($verifyarr) {
             $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => serialize($verifyarr), 'dateline' => TIMESTAMP);
             C::t('common_member_verify_info')->insert($setverify);
             C::t('common_member_verify')->insert(array('uid' => $uid));
         }
         require_once libfile('cache/userstats', 'function');
         build_cache_userstats();
         if ($this->extrafile && file_exists($this->extrafile)) {
             require_once $this->extrafile;
         }
         if ($this->setting['regctrl'] || $this->setting['regfloodctrl']) {
             C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($this->setting['regctrl'] > 72 ? $this->setting['regctrl'] : 72) * 3600);
             if ($this->setting['regctrl']) {
                 C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
             }
         }
         $regmessage = dhtmlspecialchars($_GET['regmessage']);
         if ($this->setting['regverify'] == 2) {
             C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => $regmessage, 'remark' => ''), false, true);
             manage_addnotify('verifyuser');
         }
         setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0);
         include_once libfile('function/stat');
         updatestat('register');
         if ($invite['id']) {
             $result = C::t('common_invite')->count_by_uid_fuid($invite['uid'], $uid);
             if (!$result) {
                 C::t('common_invite')->update($invite['id'], array('fuid' => $uid, 'fusername' => $_G['username'], 'regdateline' => $_G['timestamp'], 'status' => 2));
                 updatestat('invite');
             } else {
                 $invite = array();
             }
         }
         if ($invite['uid']) {
             if ($this->setting['inviteconfig']['inviteaddcredit']) {
                 updatemembercount($uid, array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['inviteaddcredit']));
             }
             if ($this->setting['inviteconfig']['invitedaddcredit']) {
                 updatemembercount($invite['uid'], array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['invitedaddcredit']));
             }
             require_once libfile('function/friend');
             friend_make($invite['uid'], $invite['username'], false);
             notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1);
             space_merge($invite, 'field_home');
             if (!empty($invite['privacy']['feed']['invite'])) {
                 require_once libfile('function/feed');
                 $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>');
                 feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']);
             }
             if ($invite['appid']) {
                 updatestat('appinvite');
             }
         }
         if ($welcomemsg && !empty($welcomemsgtxt)) {
             $welcomemsgtitle = replacesitevar($welcomemsgtitle);
             $welcomemsgtxt = replacesitevar($welcomemsgtxt);
             if ($welcomemsg == 1) {
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
                 notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
             } elseif ($welcomemsg == 2) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
             } elseif ($welcomemsg == 3) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
                 notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
             }
         }
         if ($fromuid) {
             updatecreditbyaction('promotion_register', $fromuid);
             dsetcookie('promotion', '');
         }
         dsetcookie('loginuser', '');
         dsetcookie('activationauth', '');
         dsetcookie('invite_auth', '');
         $url_forward = dreferer();
         $refreshtime = 3000;
         switch ($this->setting['regverify']) {
             case 1:
                 $idstring = random(6);
                 $authstr = $this->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : '';
                 C::t('common_member_field_forum')->update($_G['uid'], array('authstr' => $authstr));
                 $verifyurl = "{$_G[siteurl]}member.php?mod=activate&amp;uid={$_G[uid]}&amp;id={$idstring}";
                 $email_verify_message = lang('email', 'email_verify_message', array('username' => $_G['member']['username'], 'bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl));
                 if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) {
                     runlog('sendmail', "{$email} sendmail failed.");
                 }
                 $message = 'register_email_verify';
                 $locationmessage = 'register_email_verify_location';
                 $refreshtime = 10000;
                 break;
             case 2:
                 $message = 'register_manual_verify';
                 $locationmessage = 'register_manual_verify_location';
                 break;
             default:
                 $message = 'register_succeed';
                 $locationmessage = 'register_succeed_location';
                 break;
         }
         $param = array('bbname' => $this->setting['bbname'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']);
         if (strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) {
             $url_forward = 'forum.php';
         }
         $href = str_replace("'", "\\'", $url_forward);
         $extra = array('showid' => 'succeedmessage', 'extrajs' => '<script type="text/javascript">' . 'setTimeout("window.location.href =\'' . $href . '\';", ' . $refreshtime . ');' . '$(\'succeedmessage_href\').href = \'' . $href . '\';' . '$(\'main_message\').style.display = \'none\';' . '$(\'main_succeed\').style.display = \'\';' . '$(\'succeedlocation\').innerHTML = \'' . lang('message', $locationmessage) . '\';' . '</script>', 'striptags' => false);
         showmessage($message, $url_forward, $param, $extra);
     }
 }
コード例 #12
0
ファイル: class_user.php プロジェクト: druphliu/dzzoffice
 function on_register()
 {
     global $_G;
     $_GET['username'] = $_GET['username'];
     $_GET['nickname'] = $_GET['nickname'];
     $_GET['password'] = $_GET['password'];
     $_GET['password2'] = $_GET['password2'];
     $_GET['email'] = $_GET['email'];
     if ($_G['uid']) {
         $url_forward = dreferer();
         if (strpos($url_forward, 'reg') !== false) {
             $url_forward = 'index.php';
         }
         showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array());
     } elseif (!$this->setting['regclosed']) {
         if ($_GET['action'] == 'activation' || $_GET['activationauth']) {
             if (!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) {
                 showmessage('register_disable_activation');
             }
         } elseif (!$this->setting['regstatus']) {
             showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage']));
         }
     }
     $bbrules =& $this->setting['bbrules'];
     $bbrulesforce =& $this->setting['bbrulesforce'];
     $bbrulestxt =& $this->setting['bbrulestxt'];
     $welcomemsg =& $this->setting['welcomemsg'];
     $welcomemsgtitle =& $this->setting['welcomemsgtitle'];
     $welcomemsgtxt =& $this->setting['welcomemsgtxt'];
     $regname = $this->setting['regname'];
     $username = isset($_GET['username']) ? $_GET['username'] : '';
     $invitestatus = false;
     $seccodecheck = $this->setting['seccodestatus'] & 1;
     $secqaacheck = 0;
     $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
     $auth = $_GET['auth'];
     if (!$invitestatus) {
         $invite = getinvite();
     }
     if (!submitcheck('regsubmit', 0, $seccodecheck)) {
         if ($seccodecheck) {
             $seccode = random(6, 1);
         }
         $username = dhtmlspecialchars($username);
         $htmls = $settings = array();
         foreach ($_G['cache']['fields_register'] as $field) {
             $fieldid = $field['fieldid'];
             $html = profile_setting($fieldid, array(), false, false, true);
             if ($html) {
                 $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
                 $htmls[$fieldid] = $html;
             }
         }
         $navtitle = $this->setting['reglinkname'];
         if ($this->extrafile && file_exists($this->extrafile)) {
             require_once $this->extrafile;
         }
         $bbrulestxt = nl2br("\n{$bbrulestxt}\n\n");
         $dreferer = dreferer();
         include template($this->template);
     } else {
         $emailstatus = 0;
         if ($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) {
             showmessage('not_open_registration_invite');
         }
         //验证同意协议
         if ($bbrules && $bbrulehash != $_POST['agreebbrule']) {
             showmessage('register_rules_agree');
         }
         //验证用户姓名
         $usernamelen = dstrlen($username);
         if ($usernamelen < 3) {
             showmessage('profile_username_tooshort');
         }
         if ($usernamelen > 30) {
             showmessage('profile_username_toolong');
         }
         //验证用户名
         if ($nickname = trim($_GET['nickname'])) {
             $nicknamelen = dstrlen($nickname);
             if ($nicknamelen < 3) {
                 showmessage('profile_nickname_tooshort');
             }
             if ($nicknamelen > 30) {
                 showmessage('profile_nickname_toolong');
             }
         } else {
             $nickname = '';
         }
         //验证邮箱
         $email = strtolower(trim($_GET['email']));
         checkemail($email);
         //验证密码长度
         if ($this->setting['pwlength']) {
             if (strlen($_GET['password']) < $this->setting['pwlength']) {
                 showmessage('profile_password_tooshort', '', array('pwlength' => $this->setting['pwlength']));
             }
         }
         //验证密码强度
         if ($this->setting['strongpw']) {
             $strongpw_str = array();
             if (in_array(1, $this->setting['strongpw']) && !preg_match("/\\d+/", $_GET['password'])) {
                 $strongpw_str[] = lang('user/template', 'strongpw_1');
             }
             if (in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) {
                 $strongpw_str[] = lang('user/template', 'strongpw_2');
             }
             if (in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) {
                 $strongpw_str[] = lang('user/template', 'strongpw_3');
             }
             if (in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) {
                 $strongpw_str[] = lang('user/template', 'strongpw_4');
             }
             if ($strongpw_str) {
                 showmessage(lang('user/template', 'password_weak') . implode(',', $strongpw_str));
             }
         }
         //验证两次密码一致性
         if ($_GET['password'] !== $_GET['password2']) {
             showmessage('两次密码不匹配');
         }
         if (!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
             showmessage('profile_passwd_illegal');
         }
         $password = $_GET['password'];
         $ctrlip = $_G['clientip'];
         $setregip = null;
         $profile = $verifyarr = array();
         foreach ($_G['cache']['fields_register'] as $field) {
             /*if(defined('IN_MOBILE')) {
             			break;
             		}*/
             $field_key = $field['fieldid'];
             $field_val = $_GET['' . $field_key];
             if ($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) {
                 $field_val = true;
             }
             if (!profile_check($field_key, $field_val)) {
                 $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday';
                 showmessage($field['title'] . lang('message', 'profile_illegal'), '', array(), array('showid' => 'chk_' . $showid, 'extrajs' => $field['title'] . lang('message', 'profile_illegal') . ($field['formtype'] == 'text' ? '<script type="text/javascript">' . '$(\'registerform\').' . $field['fieldid'] . '.parentNode.parentNode.className = \'form-group warning\';' . '$(\'registerform\').' . $field['fieldid'] . '.onblur = function () { if(this.value != \'\') {this.parentNode.parentNode.className = \'form-group\';$(\'chk_' . $showid . '\').innerHTML = \'\';}}' . '</script>' : '')));
             }
             if ($field['needverify']) {
                 $verifyarr[$field_key] = $field_val;
             } else {
                 $profile[$field_key] = $field_val;
             }
         }
         $groupinfo = array();
         $addorg = 0;
         if ($this->setting['regverify']) {
             $groupinfo['groupid'] = 8;
         } else {
             $groupinfo['groupid'] = $this->setting['newusergroupid'];
             $addorg = 1;
         }
         $result = uc_user_register(addslashes($username), $password, $email, addslashes($nickname), $questionid, $answer, $_G['clientip'], $addorg);
         if (is_array($result)) {
             $uid = $result['uid'];
             $password = $result['password'];
         } else {
             $uid = $result;
         }
         if ($uid <= 0) {
             if ($uid == -1) {
                 showmessage('profile_nickname_illegal');
             } elseif ($uid == -2) {
                 showmessage('profile_nickname_protect');
             } elseif ($uid == -3) {
                 showmessage('profile_nickname_duplicate');
             } elseif ($uid == -4) {
                 showmessage('profile_email_illegal');
             } elseif ($uid == -5) {
                 showmessage('profile_email_domain_illegal');
             } elseif ($uid == -6) {
                 showmessage('profile_email_duplicate');
             } elseif ($uid == -7) {
                 showmessage('profile_username_illegal');
             } else {
                 showmessage('undefined_action');
             }
         }
         $_G['username'] = $username;
         if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
             $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
         }
         if (isset($_POST['birthyear'])) {
             $profile['zodiac'] = get_zodiac($_POST['birthyear']);
         }
         if ($_FILES) {
             foreach ($_FILES as $key => $file) {
                 $field_key = 'field_' . $key;
                 if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
                     if ($attachment = uploadtolocal($file, 'profile', '')) {
                         if (@getimagesize($_G['setting']['attachdir'] . $attachment)) {
                             //判断是否为图片文件
                             @unlink($_G['setting']['attachdir'] . $attachment);
                             continue;
                         }
                         if ($_G['cache']['fields_register'][$field_key]['needverify']) {
                             $verifyarr[$key] = $attachment;
                         } else {
                             $profile[$key] = $attachment;
                         }
                     }
                 }
             }
         }
         $init_arr = array('profile' => $profile, 'emailstatus' => $emailstatus);
         C::t('user')->insert($uid, $_G['clientip'], $groupinfo['groupid'], $init_arr);
         if ($verifyarr) {
             $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => serialize($verifyarr), 'dateline' => TIMESTAMP);
             C::t('user_verify_info')->insert($setverify);
             C::t('user_verify')->insert(array('uid' => $uid));
         }
         require_once libfile('cache/userstats', 'function');
         build_cache_userstats();
         if ($this->extrafile && file_exists($this->extrafile)) {
             require_once $this->extrafile;
         }
         setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0);
         include_once libfile('function/stat');
         if ($welcomemsg && !empty($welcomemsgtxt)) {
             $welcomemsgtitle = replacesitevar($welcomemsgtitle);
             $welcomemsgtxt = replacesitevar($welcomemsgtxt);
             if ($welcomemsg == 1) {
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
             } elseif ($welcomemsg == 2) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
             } elseif ($welcomemsg == 3) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
             }
         }
         dsetcookie('loginuser', '');
         dsetcookie('invite_auth', '');
         $url_forward = dreferer();
         $refreshtime = 3000;
         switch ($this->setting['regverify']) {
             case 1:
                 $idstring = random(6);
                 $authstr = $this->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : '';
                 C::t('user')->update($_G['uid'], array('authstr' => $authstr));
                 $verifyurl = "{$_G[siteurl]}user.php?mod=activate&amp;uid={$_G[uid]}&amp;id={$idstring}";
                 $email_verify_message = lang('email', 'email_verify_message', array('username' => $_G['member']['username'], 'sitename' => $this->setting['sitename'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl));
                 if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) {
                     runlog('sendmail', "{$email} sendmail failed.");
                 }
                 $message = 'register_email_verify';
                 $locationmessage = 'register_email_verify_location';
                 $refreshtime = 10000;
                 break;
             case 2:
                 $message = 'register_manual_verify';
                 $locationmessage = 'register_manual_verify_location';
                 break;
             default:
                 $message = 'register_succeed';
                 $locationmessage = 'register_succeed_location';
                 break;
         }
         $param = daddslashes(array('sitename' => $this->setting['sitename'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']));
         if (strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) {
             $url_forward = 'index.php';
         }
         $extra = array('showdialog' => true, 'locationtime' => false, 'extrajs' => '');
         showmessage('', $url_forward, array(), array('showid' => 'succeedmessage', 'extrajs' => '<script type="text/javascript">' . 'setTimeout("window.location.href =\'' . $url_forward . '\';", 3000);' . '$(\'succeedmessage_href\').href = \'' . $url_forward . '\';' . '$(\'register_form\').style.display = \'none\';' . '$(\'main_succeed\').style.display = \'\';' . '$(\'succeedlocation\').innerHTML = \'' . lang('message', $message, $param) . '\';</script>', 'striptags' => false, 'showdialog' => false));
         //showmessage($message, $url_forward, $param, $extra);
     }
 }
コード例 #13
0
ファイル: ajax.php プロジェクト: saintho/phpdisk
     if (checklength($r_username, 2, 60)) {
         echo __('username_length_error');
     } elseif (is_bad_chars($r_username)) {
         echo __('username_has_bad_chars');
     } else {
         $num = @$db->result_first("select count(*) from {$tpf}users where username='******'");
         if ($num) {
             echo __('username_already_exists');
         } else {
             echo 'true|' . __('username_can_reg');
         }
     }
     break;
 case 'chk_email':
     $r_email = trim(gpc('r_email', 'P', ''));
     if (!checkemail($r_email)) {
         echo __('invalid_email');
     } else {
         $num = @$db->result_first("select count(*) from {$tpf}users where email='{$r_email}'");
         if ($num) {
             echo __('email_already_exists');
         } else {
             echo 'true|' . __('email_can_reg');
         }
     }
     break;
 case 'fd_stat':
     $folder_id = (int) gpc('folder_id', 'P', 0);
     if ($folder_id) {
         $file_size = (int) @$db->result_first("select sum(file_size) from {$tpf}files where folder_id='{$folder_id}'");
         $db->query_unbuffered("update {$tpf}folders set folder_size='{$file_size}' where folder_id='{$folder_id}'");
コード例 #14
0
ファイル: news.php プロジェクト: rekysda/tcms
     $biodata = $data['biodata'];
     $avatar = '<img src="mod/profile/images/' . $data['avatar'] . '">';
     $avatar = $data['avatar'] == '' ? '' : '<div style="float:left; padding:3px; border:1px solid #cccccc; background:#f2f2f2; margin-right:10px;"><img src="mod/profile/images/' . $data['avatar'] . '" width="50" border="0" alt="' . $user . '" /></div>';
     $tengah .= '<div class="border"><table><tr><td>' . $avatar . '' . $biodata . '</td></tr></table></div>';
 }
 ////////////Komentar////////////////////////////////////
 if ($widgetkomentar == 2) {
     // Komentar Berita
     if ($_POST['submit'] == 'comment') {
         $nama = cleantext(hapuspetik($_POST['nama']));
         $kontenkomentar = cleantext(hapuspetik($_POST['kontenkomentar']));
         $emailkomentar = $_POST['emailkomentar'];
         $tgl = date('Y-m-d');
         $artikelid = $_POST['artikelid'];
         $ip = getenv("REMOTE_ADDR");
         checkemail($emailkomentar);
         $gfx_check = $_POST['gfx_check'];
         if ($gfx_check != $_SESSION['Var_session'] or !isset($_SESSION['Var_session'])) {
             $error .= "Error: Security Code Invalid<br />";
         }
         if (!$nama) {
             $error .= "Error: Silahkan isi Namanya<br />";
         }
         if (!$emailkomentar) {
             $error .= "Error: Silahkan isi Emailnya<br />";
         }
         if (!$kontenkomentar) {
             $error .= "Error: Silahkan isi Komentarnya<br />";
         }
         if ($error) {
             $tengah .= '<div class="error">' . $error . '</div>';
コード例 #15
0
ファイル: settings.inc.php プロジェクト: saintho/phpdisk
 }
 if (checklength($settings['site_title'], 2, 100)) {
     $error = true;
     $sysmsg[] = __('site_title_error');
 }
 if (substr($settings['phpdisk_url'], 0, 7) != 'http://' && substr($settings['phpdisk_url'], 0, 8) != 'https://') {
     $error = true;
     $sysmsg[] = __('phpdisk_url_error');
 } else {
     $settings['phpdisk_url'] = substr($settings['phpdisk_url'], -1) == '/' ? $settings['phpdisk_url'] : $settings['phpdisk_url'] . '/';
 }
 if (checklength($settings['encrypt_key'], 8, 20) || preg_match("/[^a-z0-9]/i", $settings['encrypt_key'])) {
     $error = true;
     $sysmsg[] = __('encrypt_key_error');
 }
 if (!checkemail($settings['contact_us'])) {
     $error = true;
     $sysmsg[] = __('contact_us_error');
 }
 if (!$settings['allow_access']) {
     if (checklength($settings['close_access_reason'], 2, 200)) {
         $error = true;
         $sysmsg[] = __('close_access_reason_error');
     }
 }
 if (!$settings['allow_register']) {
     if (checklength($settings['close_register_reason'], 2, 200)) {
         $error = true;
         $sysmsg[] = __('close_register_reason_error');
     }
 }
コード例 #16
0
ファイル: add2.php プロジェクト: nung421/phpworkshop2
	exit;
}

if ($msn=="" AND $yahoo=="" AND $icq=="" AND $qq=="") {
	echo "<H3> ERROR : ��سҡ�͡�������������͹�Ź� ���ҧ���� 1 ����� </H3>";
	exit;
}

include "function.php";

if ($msn<>"" AND !checkemail($msn)) {
	echo "<H3> ERROR : �ٻẺ����� MSN �ͧ��ҹ���١��ͧ </H3>";
	exit;
}

if ($yahoo<>"" AND !checkemail($yahoo)) {
	echo "<H3> ERROR : �ٻẺ����� YAHOO �ͧ��ҹ���١��ͧ </H3>";
	exit;
}

$ip = $_SERVER['REMOTE_ADDR']; 
$now = date("Y-m-d H:i:s");

include "connect.php";
$sql="insert into tb_online values(NULL,'$fname','$sex','$province','','$msn','$yahoo','$icq','$qq','$suggest','$ip','$now')";
$result=mysql_db_query($dbname,$sql);

if ($fileupload) {

	$array_last=explode(".",$fileupload_name);
	$c=count($array_last)-1; 
コード例 #17
0
ファイル: add.php プロジェクト: buxiaoyang/EmailArchive
 private function validate()
 {
     //password is required and must be greater than the MIN_PASSWORD_LENGTH
     if (!isset($this->request->post['password'])) {
         $this->error['password'] = $this->data['text_missing_password'];
     } elseif (strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH) {
         $this->error['password'] = $this->data['text_too_short_password'];
     }
     //password2 is required and must be greater than the MIN_PASSWORD_LENGTH
     if (!isset($this->request->post['password2'])) {
         $this->error['password2'] = $this->data['text_missing_password'];
     } elseif (strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {
         $this->error['password2'] = $this->data['text_too_short_password'];
     }
     //passwords must match (put here to override the password2 missing message, if also present)
     if ($this->request->post['password'] != $this->request->post['password2']) {
         $this->error['password2'] = $this->data['text_password_mismatch'];
     }
     //uid is required and must be numeric & 0 or greater
     if (!isset($this->request->post['uid']) || !is_numeric($this->request->post['uid']) || $this->request->post['uid'] < 0) {
         $this->error['uid'] = $this->data['text_invalid_uid'];
     }
     //email address is required and must be in the proper format
     if (!isset($this->request->post['email']) || strlen($this->request->post['email']) < 3) {
         $this->error['email'] = $this->data['text_invalid_email'];
     } else {
         $emails = explode("\n", $this->request->post['email']);
         foreach ($emails as $email) {
             $email = rtrim($email);
             if ($email == '') {
                 continue;
             }
             $ret = checkemail($email, $this->domains);
             if ($ret == 0) {
                 $this->error['email'] = $this->data['text_invalid_email'] . ": *{$email}*";
             } else {
                 if ($ret == -1) {
                     $this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": *{$email}*";
                 }
             }
         }
     }
     //username is required and must be greater than 2 chars
     if (!isset($this->request->post['username']) || strlen($this->request->post['username']) < 2) {
         $this->error['username'] = $this->data['text_invalid_username'];
     }
     //username is required and must be unique
     if (isset($this->request->post['username']) && $this->model_user_user->get_uid_by_name($this->request->post['username']) > 0) {
         $this->error['username'] = $this->data['text_existing_user'];
     }
     //primary domain is required
     if (!isset($this->request->post['domain'])) {
         $this->error['domain'] = $this->data['text_missing_data'];
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
コード例 #18
0
ファイル: index.php.php プロジェクト: webdevtoolkit/phpcourse
 $email_regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}\$/";
 $password_regexp = "/[0-9]/";
 //Create variables
 //Uppercase letters
 //Create associative array for outputting errors
 if (!$recordData['firstname']) {
     $errors['firstname'] = "First name is required!";
     //echo $errors['firstname'];
     $error_flag++;
 }
 if (!$lastname) {
     $errors['lastname'] = "Last name is required!";
     //echo "Last name is required!";
     $error_flag++;
 }
 if ($email_flag = checkemail($recordData['email'])) {
     $errors['email'] = "Please provide valid email address";
     $error_flag++;
 }
 if ($recordData['password1'] && $password2) {
     if (strcmp($recordData['password1'], $password2) == 0) {
         if (!preg_match($password_regexp, $recordData['password1'])) {
             $errors['password'] = "******";
             //echo "Password must contain at least one digit.";
             $error_flag++;
         }
     } else {
         $errors['password'] = "******";
         $error_flag++;
     }
 } else {
コード例 #19
0
 $idcard = checkidcard($idcard);
 $email1 = checkemail($email1, 'email1');
 $email2 = $email2 ? checkemail($email2, 'email2') : '';
 $qq = checkqq($qq);
 $msn = $msn ? checkemail($msn, 'msn') : '';
 $tel3 = $tel3 != $lang['insenz_register_extension'] ? intval($tel3) : '';
 $tel = checktel($tel1, $tel2, $tel3, 'tel');
 $fax = $fax2 ? checktel($fax1, $fax2, $fax3, 'fax') : '';
 $mobile = checkmobile($mobile);
 $cpc = checkcpc($country, $province, $city);
 $country = $cpc[0];
 $province = $cpc[1];
 $city = $cpc[2];
 $address = checkaddress($address);
 $postcode = checkpostcode($postcode);
 $alipay = checkemail($alipay, $lang['insenz_register_alipay']);
 $response = insenz_request('<cmd id="checkHandle"><handle>' . $username . '</handle></cmd>');
 if ($response['status']) {
     insenz_alert($response['data']);
 } else {
     $response = $response['data']['response'][0]['data'][0]['VALUE'];
 }
 if ($response == 'handle_exists') {
     insenz_alert('insenz_usernameexists', 'username');
 }
 foreach ($items as $item) {
     $insenz['profile'][$item] = ${$item};
 }
 $insenz['step'] = 2;
 $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('insenz', '" . addslashes(serialize($insenz)) . "')");
 insenz_cpmsg('insenz_regstep2', '&operation=register&agreelicense=yes&step=2');
コード例 #20
0
ファイル: check_c.php プロジェクト: ATS001/MRN_ERP
{
    if ($jscheck == 1) {
        exit('JS enabled');
    }
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'rib') {
    echo checkrib($_REQUEST['rib']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'ida') {
    echo checkida($_REQUEST['ida']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'nom') {
    echo checknom($_REQUEST['nom'], $_REQUEST['id']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'email') {
    echo checkemail($_REQUEST['email'], $_REQUEST['id']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'pseudo') {
    echo checkpseudo($_REQUEST['username'], $_REQUEST['id']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'user1') {
    echo checkuser($_REQUEST['captcha']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'user') {
    echo checkuser($_REQUEST['username']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'mail') {
    echo checkmail($_REQUEST['email']);
}
if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'userc') {
    echo checkuserc($_REQUEST['username']);
コード例 #21
0
ファイル: member.php プロジェクト: beyondkeysystem/testone
 public function setMemberValue()
 {
     $this->member_id = $_REQUEST['id'];
     $this->first_name = $_REQUEST['first_name'];
     $this->last_name = $_REQUEST['last_name'];
     $this->address = $_REQUEST['address'];
     $this->city = $_REQUEST['city'];
     $this->state = $_REQUEST['state'];
     $this->zip = $_REQUEST['zip'];
     $this->country_id = $_REQUEST['country_id'];
     $this->email = $_REQUEST['email'];
     $this->paypalID = $_REQUEST['paypalID'];
     $this->contact_no = $_REQUEST['contact_no'];
     $this->about_me = $_REQUEST['about_me'];
     $this->user_name = $_REQUEST['user_name'];
     $this->username = $_REQUEST['username'];
     $this->password = $_REQUEST['password'];
     $this->con_pass = $_REQUEST['con_pass'];
     $this->is_banned = $_REQUEST['is_banned'];
     $this->old_profile_image_file = $_REQUEST['old_profile_image_file'];
     $this->shipping_fname = $_REQUEST['ship_fname'];
     $this->shipping_lname = $_REQUEST['ship_lname'];
     $this->shipping_address = $_REQUEST['ship_address'];
     $this->shipping_country = $_REQUEST['ship_country'];
     $this->shipping_pcode = $_REQUEST['ship_pincode'];
     $this->billing_fname = $_REQUEST['bill_fname'];
     $this->billing_lname = $_REQUEST['bill_lname'];
     $this->billing_address = $_REQUEST['bill_address'];
     $this->billing_country = $_REQUEST['bill_country'];
     $this->billing_pcode = $_REQUEST['bill_pincode'];
     $this->show_online_status = $_REQUEST['show_online'];
     $this->upload_dir = "uploads";
     $this->upload_dir_main = $this->upload_dir . "/main/";
     $this->upload_dir_thumb = $this->upload_dir . "/thumb/";
     if (empty($this->email)) {
         $this->errmsg .= " Email Address cannot left empty <br>";
     }
     if (!empty($this->email)) {
         if (!checkemail($this->email)) {
             $this->errmsg .= " Email Value is not Valid<br>";
         }
     }
     if (empty($this->user_name)) {
         $this->errmsg .= " Username field is empty.<br>";
     }
     if ($this->username_available()) {
         $this->errmsg .= " Username Already taken.<br>";
     }
     if (empty($this->password)) {
         $this->errmsg .= " Password field is empty.<br>";
     }
     if (empty($this->con_pass)) {
         $this->errmsg .= " Confirm Password field is empty.<br>";
     }
     if (!empty($this->password) and !empty($this->con_pass)) {
         if (strcmp(trim($this->password), trim($this->con_pass)) != 0) {
             $this->errmsg .= " Password Mismatched";
         }
     }
     echo "Errmsg :" . $this->errmsg;
 }
コード例 #22
0
ファイル: modpass.php プロジェクト: Mushan3420/BigApp-PHP7
 function common()
 {
     global $_G;
     $space = getuserbyuid($_G['uid']);
     if (empty($space)) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'cant find user info'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'cant find user info'))));
         die(0);
     }
     $membersql = $memberfieldsql = $authstradd1 = $authstradd2 = $newpasswdadd = '';
     $setarr = array();
     $emailnew = dhtmlspecialchars($_GET['emailnew']);
     $ignorepassword = 0;
     if (empty($_GET['newpassword'])) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params'))));
         die(0);
     }
     if (!isset($_GET['questionidnew']) || $_GET['questionidnew'] === '') {
         $_GET['questionidnew'] = $_GET['answernew'] = '';
     } else {
         $secquesnew = $_GET['questionidnew'] > 0 ? random(8) : '';
     }
     //密码强度,取消
     $strongpw = false;
     if ($strongpw && !empty($_GET['newpassword']) && $_G['setting']['strongpw']) {
         $strongpw_str = array();
         if (in_array(1, $_G['setting']['strongpw']) && !preg_match("/\\d+/", $_GET['newpassword'])) {
             $strongpw_str[] = lang('member/template', 'strongpw_1');
         }
         if (in_array(2, $_G['setting']['strongpw']) && !preg_match("/[a-z]+/", $_GET['newpassword'])) {
             $strongpw_str[] = lang('member/template', 'strongpw_2');
         }
         if (in_array(3, $_G['setting']['strongpw']) && !preg_match("/[A-Z]+/", $_GET['newpassword'])) {
             $strongpw_str[] = lang('member/template', 'strongpw_3');
         }
         if (in_array(4, $_G['setting']['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['newpassword'])) {
             $strongpw_str[] = lang('member/template', 'strongpw_4');
         }
         if ($strongpw_str) {
             showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str));
         }
     }
     if (!empty($_GET['newpassword']) && $_GET['newpassword'] != addslashes($_GET['newpassword'])) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password illegal'))));
     }
     if (!empty($_GET['newpassword']) && $_GET['newpassword'] != $_GET['newpassword2']) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password notmatch'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password notmatch'))));
         die(0);
     }
     loaducenter();
     //检测email,可以省略
     if (false && $emailnew != $_G['member']['email']) {
         include_once libfile('function/member');
         checkemail($emailnew);
     }
     $ucresult = uc_user_edit(addslashes($_G['username']), $_GET['oldpassword'], $_GET['newpassword'], '', $ignorepassword, $_GET['questionidnew'], $_GET['answernew']);
     if ($ucresult == -1) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password wrong'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password wrong'))));
         die(0);
     } elseif ($ucresult == -4) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email illegal'))));
         die(0);
     } elseif ($ucresult == -5) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email domain illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email domain illegal'))));
         die(0);
     } elseif ($ucresult == -6) {
         echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email duplicate'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email duplicate'))));
         die(0);
     }
     if (!empty($_GET['newpassword']) || $secquesnew) {
         $setarr['password'] = md5(random(10));
     }
     $authstr = false;
     if (false && $emailnew != $_G['member']['email']) {
         $authstr = true;
         emailcheck_send($space['uid'], $emailnew);
         dsetcookie('newemail', "{$space['uid']}\t{$emailnew}\t{$_G['timestamp']}", 31536000);
     }
     if ($setarr) {
         if ($_G['member']['freeze'] == 1) {
             $setarr['freeze'] = 0;
         }
         C::t('common_member')->update($_G['uid'], $setarr);
     }
     if ($_G['member']['freeze'] == 2) {
         C::t('common_member_validate')->update($_G['uid'], array('message' => dhtmlspecialchars($_G['gp_freezereson'])));
     }
     echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'succ'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => '', 'messagestr' => lang('plugin/bigapp', 'succ'))));
     die(0);
 }
コード例 #23
0
ファイル: forum_ajax.php プロジェクト: v998/discuzx-en
    loaducenter();
    $ucresult = uc_user_checkname($username);
    if ($ucresult == -1) {
        showmessage('profile_username_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -2) {
        showmessage('profile_username_protect', '', array(), array('handle' => false));
    } elseif ($ucresult == -3) {
        if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='******'")) {
            showmessage('register_check_found', '', array(), array('handle' => false));
        } else {
            showmessage('register_activation', '', array(), array('handle' => false));
        }
    }
} elseif ($_G['gp_action'] == 'checkemail') {
    require_once libfile('function/member');
    checkemail($_G['gp_email']);
} elseif ($_G['gp_action'] == 'checkinvitecode') {
    $invitecode = trim($_G['gp_invitecode']);
    if (!$invitecode) {
        showmessage('no_invitation_code', '', array(), array('handle' => false));
    }
    $result = array();
    $query = DB::query("SELECT * FROM " . DB::table('common_invite') . " WHERE code='{$invitecode}'");
    if ($invite = DB::fetch($query)) {
        if (empty($invite['fuid']) && (empty($invite['endtime']) || $_G['timestamp'] < $invite['endtime'])) {
            $result['uid'] = $invite['uid'];
            $result['id'] = $invite['id'];
            $result['appid'] = $invite['appid'];
        }
    }
    if (empty($result)) {
コード例 #24
0
ファイル: creategroup.php プロジェクト: sensenChen/Studyr
function addemail()
{
    // does the adding of an email to the email array
    global $emailarray;
    $emailarray = unserialize($_POST['input_name']);
    // take the email array, unserialize it and prepare it to be pushed.
    if (checkemail($_POST['emails'])) {
        // checks the email that was submitted - if it exists push it into the email array.
        array_push($emailarray, $_POST['emails']);
        for ($i = 0; $i < count($emailarray); $i++) {
            //echo $emailarray[$i];
        }
    }
}
コード例 #25
0
         $strongpw_str[] = lang('member/template', 'strongpw_4');
     }
     if ($strongpw_str) {
         showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str));
     }
 }
 if (!empty($_GET['newpassword']) && $_GET['newpassword'] != addslashes($_GET['newpassword'])) {
     showmessage('profile_passwd_illegal', '', array(), array('return' => true));
 }
 if (!empty($_GET['newpassword']) && $_GET['newpassword'] != $_GET['newpassword2']) {
     showmessage('profile_passwd_notmatch', '', array(), array('return' => true));
 }
 loaducenter();
 if ($emailnew != $_G['member']['email']) {
     include_once libfile('function/member');
     checkemail($emailnew);
 }
 $ucresult = uc_user_edit(addslashes($_G['username']), $_GET['oldpassword'], $_GET['newpassword'], '', $ignorepassword, $_GET['questionidnew'], $_GET['answernew']);
 if ($ucresult == -1) {
     showmessage('profile_passwd_wrong', '', array(), array('return' => true));
 } elseif ($ucresult == -4) {
     showmessage('profile_email_illegal', '', array(), array('return' => true));
 } elseif ($ucresult == -5) {
     showmessage('profile_email_domain_illegal', '', array(), array('return' => true));
 } elseif ($ucresult == -6) {
     showmessage('profile_email_duplicate', '', array(), array('return' => true));
 }
 if (!empty($_GET['newpassword']) || $secquesnew) {
     $setarr['password'] = md5(random(10));
 }
 if ($_G['setting']['connect']['allow']) {
コード例 #26
0
$adminemail = '*****@*****.**';
$controlvars = ' thankspage submit ';
$messagetoadmin = $HTTP_POST_VARS['email'] . " has filled out a form with this content:\r\n";
$messagetosubmitter = "You have submitted a form with the content listed below. Your submission will be reviewed, please be patient in awaiting a response.\r\n";
while (list($key, $value) = each($HTTP_POST_VARS)) {
    if ($value != '') {
        if (!stristr($controlvars, ' ' . $key . ' ')) {
            $messagetoadmin .= $key . ': ' . $value . '
   ';
            $messagetosubmitter .= $key . ': ' . $value . '
   ';
        }
    }
}
if ($HTTP_POST_VARS['email']) {
    if (!checkemail($HTTP_POST_VARS['email'])) {
        $error = 'email';
    }
    $email_array = explode('@', $HTTP_POST_VARS['email']);
    if ($email_array[1] == 'lunaroma.com') {
        $error = 'email';
    }
}
//if (!$HTTP_POST_VARS['email']) {
// $error = 'email';
//}
//if (!$HTTP_POST_VARS['address']) {
// $error = 'address';
//}
if (!$HTTP_POST_VARS['name']) {
    $error = 'name';
コード例 #27
0
ファイル: news.php プロジェクト: rekysda/talsurabaya
     $perintah = "SELECT user,email FROM artikel WHERE id='{$id}' AND publikasi=1";
 } else {
     $perintah = "SELECT user,email FROM komentar WHERE id='{$id}'";
 }
 $hasil = $koneksi_db->sql_query($perintah);
 while ($data = mysql_fetch_array($hasil)) {
     $kontributor = $data['email'];
     $nama_kon = $data['user'];
 }
 $tengah .= '<h4 class="bg">Kirim Pesan Ke : ' . $nama_kon . '</h4>';
 if (isset($_POST['submit'])) {
     $nama = text_filter($_POST['nama']);
     $email = text_filter($_POST['email']);
     $subyek = text_filter($_POST['subyek']);
     $pesan = nl2br(text_filter($_POST['pesan'], 2));
     checkemail($email);
     $gfx_check = intval($_POST['gfx_check']);
     if (!$nama) {
         $error .= "Error: Please enter your name!<br />";
     }
     if (!$pesan) {
         $error .= "Error: Please enter a message!<br />";
     }
     if (!$subyek) {
         $error .= "Error: Please enter a Subject!<br />";
     }
     $code = substr(hexdec(md5("" . date("F j") . "" . $_POST['random_num'] . "" . $sitekey . "")), 2, 6);
     if (extension_loaded("gd") and $code != $_POST['gfx_check']) {
         $error .= "Error: Security Code Invalid<br />";
     }
     if ($error) {
コード例 #28
0
ファイル: Delivery.php プロジェクト: kordianbruck/MailQ
 $timecontrol_start = mktime();
 foreach ($emails as $email) {
     echo $email["id"] . ": Sending email to " . $email["to"] . " ... ";
     setsendingnow($email["id"]);
     if ($email["is_sendingnow"]) {
         echo "already being sent.";
         add_incidence($email["id"], "Try to send an email that is already being sent");
         $logger->add_log_incidence(array($email["id"], $email["to"], "Email skipped", "Try to send an email that is already being sent"));
     }
     if (!checkemail($email["to"])) {
         echo "bad recipient email address.";
         add_incidence($email["id"], "Incorrect recipient email address: " . $email["to"]);
         cancel($email["id"]);
         $logger->add_log_incidence(array($email["id"], $email["to"], "Email cancelled", "Incorrect recipient email address"));
     }
     if (!checkemail($email["from"])) {
         echo "bad addressee email address.";
         add_incidence($email["id"], "Incorrect addressee email address: " . $email["from"]);
         cancel($email["id"]);
         $logger->add_log_incidence(array($email["id"], $email["to"], "Email cancelled", "Incorrect addressee email address"));
     }
     // Check black list
     if (is_array($blacklisted_emails) and in_array(strtolower(trim($email["to"])), $blacklisted_emails)) {
         echo "recipient is on the black list.";
         add_incidence($email["id"], "Recipient is on the black list: " . $email["to"]);
         cancel($email["id"]);
         $logger->add_log_incidence(array($email["id"], $email["to"], "Email cancelled", "Recipient is on the black list"));
     }
     if (!IS_DEVEL_ENVIRONMENT || IS_DEVEL_ENVIRONMENT && in_array($email["to"], $devel_emails)) {
         // PHPMailer send
         // Create a phpmailer object
コード例 #29
0
$surname_reg = $_POST[surname_reg];
$idcode_reg = $_POST[idcode_reg];
$user_reg = $_POST[user_reg];
$email_reg = $_POST[email_reg];
$pass_reg = $_POST[pass_reg];
$date_reg = date("Y-m-d");
if ($pass_reg == "" or $email_reg == "") {
    ?>
		<script language="javascript" >
		alert("°√Ў≥“°√Ќ°¢йЌЅў≈гЋй§√Ї");
		window.history.back();
		</script>
	<?php 
    exit;
}
if (!checkemail($email_reg)) {
    ?>
		<script language="javascript" >
		alert("°√Ў≥“µ√«® ЌЇЌ’аЅ≈м");
		window.history.back();
		</script>
	<?php 
    exit;
}
$sql = "update tb_member set \npassword='******',\nemail='{$email_reg}' where id_member='{$id_members}' ";
$result = mysql_db_query($dbname, $sql);
if ($result) {
    if ($memtypes == 'A') {
        ?>
			<script language="javascript" >
			alert("б°йд¢¢йЌЅў≈а√’¬Ї√йЌ¬б≈й«");
コード例 #30
0
ファイル: sign.php プロジェクト: zhangwen9229/404-Not-Found
if ($_POST == null) {
    exit;
}
//valid signcode
if (post_data('signcode') != NULL) {
    $code = htmlspecialchars($_POST['signcode']);
    $total = count($DB->query("SELECT * FROM gift WHERE number=? and status=1", array($code)));
    if ($total == 1) {
        $result = array('valid' => 'true');
    } else {
        $result = array('valid' => 'false');
    }
}
//exit user
if (post_data('email') != NULL) {
    if (checkemail($email) == false) {
        echo '请输入一个正确的邮箱!';
        exit;
    }
    $email = htmlspecialchars($_POST['email']);
    $total = count($DB->query("SELECT * FROM user WHERE email=?", array($email)));
    if ($total != 1) {
        $result = array('valid' => 'true');
    } else {
        $result = array('valid' => 'false');
    }
}
if (post_data('password')) {
    $total == 0;
    //检查是否有相同用户
    // $sqlemail="SELECT * FROM user WHERE email='$email'";