本文整理汇总了PHP中security::valid_email方法的典型用法代码示例。如果您正苦于以下问题:PHP security::valid_email方法的具体用法?PHP security::valid_email怎么用?PHP security::valid_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::valid_email方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aggiungiutente
function aggiungiutente()
{
global $SITENAME, $SITEEMAIL, $db, $BASEURL, $VALIDATION, $USERLANG, $USE_IMAGECODE;
$utente = $db->real_escape_string($_POST["user"]);
$pwd = $db->real_escape_string($_POST["pwd"]);
$pwd1 = $db->real_escape_string($_POST["pwd1"]);
$email = $db->real_escape_string($_POST["email"]);
$idlangue = intval($_POST["language"]);
$idstyle = intval($_POST["style"]);
$idflag = intval($_POST["flag"]);
$timezone = intval($_POST["timezone"]);
if (utf8::strtoupper($utente) == utf8::strtoupper("Guest")) {
print ERROR . " " . ERR_GUEST_EXISTS . "<br />\n";
print "<a href='account.php'>" . BACK . "</a>";
block_end();
stdfoot();
exit;
}
if ($pwd != $pwd1) {
print ERROR . " " . DIF_PASSWORDS . "<br />\n";
print "<a href='account.php'>" . BACK . "</a>";
block_end();
stdfoot();
exit;
}
if ($VALIDATION == "none") {
$idlevel = 3;
} else {
$idlevel = 2;
}
# Create Random number
$floor = 100000;
$ceiling = 999999;
srand((double) microtime() * 1000000);
$random = mt_rand($floor, $ceiling);
if ($utente == "" || $pwd == "" || $email == "") {
return -1;
exit;
}
$res = $db->query("SELECT email FROM users WHERE email = '" . $email . "'");
if ($res->num_rows > 0) {
return -2;
exit;
}
if (!security::valid_email($email)) {
return -3;
exit;
}
// duplicate username
$res = $db->query("SELECT username FROM users WHERE username = '" . $utente . "'");
if ($res->num_rows > 0) {
return -4;
exit;
}
// duplicate username
if (strpos($db->real_escape_string($utente), " ") == true) {
return -7;
exit;
}
if ($USE_IMAGECODE) {
if (extension_loaded('gd')) {
$arr = gd_info();
if ($arr['FreeType Support'] == 1) {
$public = $_POST['public_key'];
$private = $_POST['private_key'];
$p = new ocr_captcha();
if ($p->check_captcha($public, $private) != true) {
err_msg(ERROR, ERR_IMAGE_CODE);
block_end();
stdfoot();
exit;
}
}
}
}
$bannedchar = array("\\", "/", ":", "*", "?", "\"", "@", "\$", "'", "`", ",", ";", ".", "<", ">", "!", "£", "%", "^", "&", "(", ")", "+", "=", "#", "~");
if (straipos($db->real_escape_string($utente), $bannedchar) == true) {
return -8;
exit;
}
if (utf8::strlen($db->real_escape_string($pwd)) < 4) {
return -9;
exit;
}
@$db->query("INSERT INTO users (username, password, random, id_level, email, style, language, flag, joined, lastconnect, pid, time_offset) VALUES ('" . $utente . "', '" . md5($pwd) . "', " . $random . ", " . $idlevel . ", '" . $email . "', " . $idstyle . ", " . $idlangue . ", " . $idflag . ", NOW(), NOW(), '" . md5(uniqid(mt_rand(), true)) . "', '" . $timezone . "')");
if ($VALIDATION == "user") {
ini_set("sendmail_from", "");
if ($db->errno == 0) {
mail($email, ACCOUNT_CONFIRM, ACCOUNT_MSG . "\n\n" . $BASEURL . "/account.php?act=confirm&confirm=" . $random . "&language=" . $idlangue . "", "From: " . $SITENAME . " <" . $SITEEMAIL . ">");
write_log("Signup new User " . $utente . " (" . $email . ")", "add");
} else {
die($db->error);
}
}
return $db->errno;
}