Esempio n. 1
0
function invite($email)
{
    global $CURUSER;
    global $SITENAME;
    global $BASEURL;
    global $SITEEMAIL;
    global $lang_takeinvite;
    $id = $CURUSER[id];
    $email = unesc(htmlspecialchars(trim($email)));
    $email = safe_email($email);
    if (!$email) {
        bark($lang_takeinvite['std_must_enter_email']);
    }
    if (!check_email($email)) {
        bark($lang_takeinvite['std_invalid_email_address']);
    }
    if (EmailBanned($email)) {
        bark($lang_takeinvite['std_email_address_banned']);
    }
    if (!EmailAllowed($email)) {
        bark($lang_takeinvite['std_wrong_email_address_domains'] . allowedemails());
    }
    $body = "\n你好,\n\n我邀请你加入 {$SITENAME}, 这是一个拥有丰富资源的非开放社区. \n如果你有兴趣加入我们请阅读规则并确认邀请.最后,确保维持一个良好的分享率 \n分享允许的资源.\n\n欢迎到来! :)\n";
    $body = str_replace("<br />", "<br />", nl2br(trim(strip_tags($body))));
    if (!$body) {
        bark($lang_takeinvite['std_must_enter_personal_message']);
    }
    // check if email addy is already in use
    $a = @mysql_fetch_row(@sql_query("select count(*) from users where email=" . sqlesc($email))) or die(mysql_error());
    if ($a[0] != 0) {
        bark($lang_takeinvite['std_email_address'] . htmlspecialchars($email) . $lang_takeinvite['std_is_in_use']);
    }
    $b = @mysql_fetch_row(@sql_query("select count(*) from invites where invitee=" . sqlesc($email))) or die(mysql_error());
    if ($b[0] != 0) {
        bark($lang_takeinvite['std_invitation_already_sent_to'] . htmlspecialchars($email) . $lang_takeinvite['std_await_user_registeration']);
    }
    $ret = sql_query("SELECT username FROM users WHERE id = " . sqlesc($id)) or sqlerr();
    $arr = mysql_fetch_assoc($ret);
    $hash = md5(mt_rand(1, 10000) . $CURUSER['username'] . TIMENOW . $CURUSER['passhash']);
    $title = $SITENAME . $lang_takeinvite['mail_tilte'];
    $message = <<<EOD
{$lang_takeinvite['mail_one']}{$arr[username]}{$lang_takeinvite['mail_two']}
<b><a href="http://{$BASEURL}/signup.php?type=invite&invitenumber={$hash}" target="_blank">{$lang_takeinvite['mail_here']}</a></b><br />
http://{$BASEURL}/signup.php?type=invite&invitenumber={$hash}
<br />{$lang_takeinvite['mail_three']}{$invite_timeout}{$lang_takeinvite['mail_four']}{$arr[username]}{$lang_takeinvite['mail_five']}<br />
{$body}
<br /><br />{$lang_takeinvite['mail_six']}
EOD;
    sent_mail($email, $SITENAME, $SITEEMAIL, change_email_encode(get_langfolder_cookie(), $title), change_email_encode(get_langfolder_cookie(), $message), "invitesignup", false, false, '', get_email_encode(get_langfolder_cookie()));
    //this email is sent only when someone give out an invitation
    sql_query("INSERT INTO invites (inviter, invitee, hash, time_invited) VALUES ('" . mysql_real_escape_string($id) . "', '" . mysql_real_escape_string($email) . "', '" . mysql_real_escape_string($hash) . "', " . sqlesc(date("Y-m-d H:i:s")) . ")");
}
Esempio n. 2
0
         $securelogin_indentity_cookie = false;
     }
     if ($_COOKIE["c_secure_ssl"] == base64("yeah")) {
         $ssl = true;
     } else {
         $ssl = false;
     }
     logincookie($CURUSER["id"], $passh, 1, 0x7fffffff, $securelogin_indentity_cookie, $ssl);
     //sessioncookie($CURUSER["id"], $passh);
     $passupdated = 1;
 }
 if ($disableemailchange != 'no' && $smtptype != 'none' && $email != $CURUSER["email"]) {
     if (EmailBanned($email)) {
         bark($lang_usercp['std_email_address_banned']);
     }
     if (!EmailAllowed($email)) {
         bark($lang_usercp['std_wrong_email_address_domains'] . allowedemails());
     }
     if (!validemail($email)) {
         stderr($lang_usercp['std_error'], $lang_usercp['std_wrong_email_address_format'] . goback("-2"), 0);
         die;
     }
     $r = sql_query("SELECT id FROM users WHERE email=" . sqlesc($email)) or sqlerr();
     if (mysql_num_rows($r) > 0) {
         stderr($lang_usercp['std_error'], $lang_usercp['std_email_in_use'] . goback("-2"), 0);
         die;
     }
     $changedemail = 1;
 }
 if ($resetpasskey == 1) {
     $passkey = md5($CURUSER['username'] . date("Y-m-d H:i:s") . $CURUSER['passhash']);