本文整理汇总了PHP中Functions_Lib::valid_email方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::valid_email方法的具体用法?PHP Functions_Lib::valid_email怎么用?PHP Functions_Lib::valid_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::valid_email方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_user
/**
* method make_user
* param
* return a created user
*/
private function make_user()
{
$parse = $this->_lang;
$parse['level_combo'] = $this->build_level_combo();
if (isset($_POST['add_user']) && $_POST['add_user']) {
$name = (string) $_POST['name'];
$pass = (string) $_POST['password'];
$email = (string) $_POST['email'];
$galaxy = (int) $_POST['galaxy'];
$system = (int) $_POST['system'];
$planet = (int) $_POST['planet'];
$auth = (int) $_POST['authlevel'];
$time = time();
$i = 0;
$error = '';
$check_user = parent::$db->query_fetch("SELECT `user_name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['name']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
$check_email = parent::$db->query_fetch("SELECT `user_email`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_email` = '" . parent::$db->escape_value($_POST['email']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
$check_planet = parent::$db->query_fetch("SELECT COUNT(planet_id) AS count\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' LIMIT 1");
if (!is_numeric($galaxy) && !is_numeric($system) && !is_numeric($planet)) {
$error = $this->_lang['mk_user_only_numbers'];
$i++;
} elseif ($galaxy > MAX_GALAXY_IN_WORLD or $system > MAX_SYSTEM_IN_GALAXY || $planet > MAX_PLANET_IN_SYSTEM || $galaxy < 1 || $system < 1 || $planet < 1) {
$error = $this->_lang['mk_user_wrong_coords'];
$i++;
}
if (!$name or !$email or !$galaxy or !$system or !$planet) {
$error .= $this->_lang['mk_user_complete_all'];
$i++;
}
if (!Functions_Lib::valid_email(strip_tags($email))) {
$error .= $this->_lang['mk_user_invalid_email'];
$i++;
}
if ($check_user) {
$error .= $this->_lang['mk_user_existing_name'];
$i++;
}
if ($check_email) {
$error .= $this->_lang['mk_user_existing_email'];
$i++;
}
if ($check_planet['count'] != 0) {
$error .= $this->_lang['mk_user_existing_planet'];
$i++;
}
if (isset($_POST['password_check']) && $_POST['password_check']) {
$pass = $this->generate_password();
} else {
if (strlen($pass) < 4) {
$error .= $this->_lang['mk_user_invalid_password'];
$i++;
}
}
if ($i == 0) {
parent::$db->query("INSERT INTO " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_name` = '" . parent::$db->escape_value(strip_tags($name)) . "',\n\t\t\t\t\t\t\t\t\t\t`user_email` = '" . parent::$db->escape_value($email) . "',\n\t\t\t\t\t\t\t\t\t\t`user_email_permanent` = '" . parent::$db->escape_value($email) . "',\n\t\t\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '0',\n\t\t\t\t\t\t\t\t\t\t`user_register_time` = '" . $time . "',\n\t\t\t\t\t\t\t\t\t\t`user_onlinetime` = '" . $time . "',\n\t\t\t\t\t\t\t\t\t\t`user_authlevel` = '" . $auth . "',\n\t\t\t\t\t\t\t\t\t\t`user_password`='" . sha1($pass) . "';");
$last_user_id = parent::$db->insert_id();
$this->_creator->create_planet($galaxy, $system, $planet, $last_user_id, '', TRUE);
$last_planet_id = parent::$db->insert_id();
parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '" . $last_planet_id . "',\n\t\t\t\t\t\t\t\t\t\t`user_current_planet` = '" . $last_planet_id . "',\n\t\t\t\t\t\t\t\t\t\t`user_galaxy` = '" . $galaxy . "',\n\t\t\t\t\t\t\t\t\t\t`user_system` = '" . $system . "',\n\t\t\t\t\t\t\t\t\t\t`user_planet` = '" . $planet . "'\n\t\t\t\t\t\t\t\t\t\tWHERE `user_id` = '" . $last_user_id . "'\n\t\t\t\t\t\t\t\t\t\tLIMIT 1;");
parent::$db->query("INSERT INTO " . RESEARCH . " SET\n\t\t\t\t\t\t\t\t\t\t`research_user_id` = '" . $last_user_id . "';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_statistic_user_id` = '" . $last_user_id . "';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t`premium_user_id` = '" . $last_user_id . "';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '" . $last_user_id . "';");
$this->_alert = Administration_Lib::save_message('ok', str_replace('%s', $pass, $this->_lang['mk_user_added']));
} else {
$this->_alert = Administration_Lib::save_message('warning', '<br/>' . $error);
}
}
return parent::$page->parse_template(parent::$page->get_template('adm/maker_user_view'), $parse);
}
示例2: run_validations
/**
* method run_validations
* param
* return Run validations before insert data into the configuration file, if some data is not correctly validated it's not inserted.
*/
private function run_validations()
{
/*
* SERVER SETTINGS
*/
// NAME
if (isset($_POST['game_logo']) && $_POST['game_logo'] != '') {
$this->_game_config['game_logo'] = $_POST['game_logo'];
}
// LOGO
if (isset($_POST['game_name']) && $_POST['game_name'] != '') {
$this->_game_config['game_name'] = $_POST['game_name'];
}
// LANGUAGE
if (isset($_POST['language'])) {
$this->_game_config['lang'] = $_POST['language'];
} else {
$this->_game_config['lang'];
}
// GENERAL RATE
if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) {
$this->_game_config['game_speed'] = 2500 * $_POST['game_speed'];
}
// SPEED OF FLEET
if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) {
$this->_game_config['fleet_speed'] = 2500 * $_POST['fleet_speed'];
}
// SPEED OF PRODUCTION
if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) {
$this->_game_config['resource_multiplier'] = $_POST['resource_multiplier'];
}
// ADMIN EMAIL CONTACT
if (isset($_POST['admin_email']) && $_POST['admin_email'] != '' && Functions_Lib::valid_email($_POST['admin_email'])) {
$this->_game_config['admin_email'] = $_POST['admin_email'];
}
// FORUM LINK
if (isset($_POST['forum_url']) && $_POST['forum_url'] != '') {
$this->_game_config['forum_url'] = Functions_Lib::prep_url($_POST['forum_url']);
}
// ACTIVATE SERVER
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
$this->_game_config['game_enable'] = 1;
} else {
$this->_game_config['game_enable'] = 0;
}
// OFF-LINE MESSAGE
if (isset($_POST['close_reason']) && $_POST['close_reason'] != '') {
$this->_game_config['close_reason'] = addslashes($_POST['close_reason']);
}
// SSL ENABLED
if (isset($_POST['ssl_enabled']) && $_POST['ssl_enabled'] == 'on') {
$this->_game_config['ssl_enabled'] = 1;
} else {
$this->_game_config['ssl_enabled'] = 0;
}
/*
* DATE AND TIME PARAMETERS
*/
// SHORT DATE
if (isset($_POST['date_time_zone']) && $_POST['date_time_zone'] != '') {
$this->_game_config['date_time_zone'] = $_POST['date_time_zone'];
}
if (isset($_POST['date_format']) && $_POST['date_format'] != '') {
$this->_game_config['date_format'] = $_POST['date_format'];
}
// EXTENDED DATE
if (isset($_POST['date_format_extended']) && $_POST['date_format_extended'] != '') {
$this->_game_config['date_format_extended'] = $_POST['date_format_extended'];
}
/*
* SEVERAL PARAMETERS
*/
// PROTECTION
if (isset($_POST['adm_attack']) && $_POST['adm_attack'] == 'on') {
$this->_game_config['adm_attack'] = 1;
} else {
$this->_game_config['adm_attack'] = 0;
}
// DEBUG MODE
if (isset($_POST['debug']) && $_POST['debug'] == 'on') {
$this->_game_config['debug'] = 1;
} else {
$this->_game_config['debug'] = 0;
}
// SHIPS TO DEBRIS
if (isset($_POST['Fleet_Cdr']) && is_numeric($_POST['Fleet_Cdr'])) {
if ($_POST['Fleet_Cdr'] < 0) {
$this->_game_config['fleet_cdr'] = 0;
$Number2 = 0;
} else {
$this->_game_config['fleet_cdr'] = $_POST['Fleet_Cdr'];
$Number2 = $_POST['Fleet_Cdr'];
}
}
// DEFENSES TO DEBRIS
//.........这里部分代码省略.........
示例3: run_validations
/**
* run_validations()
* param
* return run validations and return bool result
**/
private function run_validations()
{
$errors = 0;
if (!Functions_Lib::valid_email($_POST['email'])) {
$errors++;
}
if (!$_POST['character']) {
$errors++;
}
if (strlen($_POST['password']) < 8) {
$errors++;
}
if (preg_match("/[^A-z0-9_\\-]/", $_POST['character']) == 1) {
$errors++;
}
if ($_POST['agb'] != 'on') {
$errors++;
}
if ($this->check_user()) {
$errors++;
}
if ($this->check_email()) {
$errors++;
}
if ($errors > 0) {
return FALSE;
} else {
return TRUE;
}
}
示例4: createAccount
/**
* method createAccount
* param
* return TRUE successfully created admin | FALSE an error ocurred
*/
private function createAccount()
{
// validations
if (empty($_POST['adm_user']) or empty($_POST['adm_pass']) or empty($_POST['adm_email']) or !Functions_Lib::valid_email($_POST['adm_email'])) {
return false;
}
// some default values
$adm_name = parent::$db->escape_value($_POST['adm_user']);
$adm_email = parent::$db->escape_value($_POST['adm_email']);
$adm_pass = sha1($_POST['adm_pass']);
// a bunch of of queries :/
parent::$db->query("INSERT INTO " . USERS . " SET\n `user_id` = '1',\n `user_name` = '" . $adm_name . "',\n `user_email` = '" . $adm_email . "',\n `user_email_permanent` = '" . $adm_email . "',\n `user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n `user_agent` = '',\n `user_authlevel` = '3',\n `user_home_planet_id` = '1',\n `user_galaxy` = '1',\n `user_system` = '1',\n `user_planet` = '1',\n `user_current_planet` = '1',\n `user_register_time` = '" . time() . "',\n `user_password` = '" . $adm_pass . "';");
$this->_planet->createPlanetWithOptions(array('planet_user_id' => 1, 'planet_name' => $adm_name, 'planet_galaxy' => 1, 'planet_system' => 1, 'planet_planet' => 1, 'planet_last_update' => time(), 'planet_metal' => 500, 'planet_crystal' => 500, 'planet_deuterium' => 0));
parent::$db->query("INSERT INTO " . RESEARCH . " SET `research_user_id` = '1';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET `user_statistic_user_id` = '1';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET `premium_user_id` = '1';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET `setting_user_id` = '1';");
parent::$db->query("INSERT INTO " . BUILDINGS . " SET `building_planet_id` = '1';");
parent::$db->query("INSERT INTO " . DEFENSES . " SET `defense_planet_id` = '1';");
parent::$db->query("INSERT INTO " . SHIPS . " SET `ship_planet_id` = '1';");
// write the new admin email for support and debugging
Functions_Lib::update_config('admin_email', $adm_email);
return true;
}
示例5: create_account
/**
* method create_account
* param
* return TRUE successfully created admin | FALSE an error ocurred
*/
private function create_account()
{
// validations
if (empty($_POST['adm_user']) or empty($_POST['adm_pass']) or empty($_POST['adm_email']) or !Functions_Lib::valid_email($_POST['adm_email'])) {
return FALSE;
}
// some default values
$adm_name = parent::$db->escape_value($_POST['adm_user']);
$adm_email = parent::$db->escape_value($_POST['adm_email']);
$adm_pass = sha1($_POST['adm_pass']);
// a bunch of of queries :/
parent::$db->query("INSERT INTO " . USERS . " SET\r\n\t\t\t\t\t\t\t\t`user_id` = '1',\r\n\t\t\t\t\t\t\t\t`user_name` = '" . $adm_name . "',\r\n\t\t\t\t\t\t\t\t`user_email` = '" . $adm_email . "',\r\n\t\t\t\t\t\t\t\t`user_email_permanent` = '" . $adm_email . "',\r\n\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\r\n\t\t\t\t\t\t\t\t`user_agent` = '',\r\n\t\t\t\t\t\t\t\t`user_authlevel` = '3',\r\n\t\t\t\t\t\t\t\t`user_home_planet_id` = '1',\r\n\t\t\t\t\t\t\t\t`user_galaxy` = '1',\r\n\t\t\t\t\t\t\t\t`user_system` = '1',\r\n\t\t\t\t\t\t\t\t`user_planet` = '1',\r\n\t\t\t\t\t\t\t\t`user_current_planet` = '1',\r\n\t\t\t\t\t\t\t\t`user_register_time` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t`user_password` = '" . $adm_pass . "';");
parent::$db->query("INSERT INTO " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t`planet_user_id` = '1',\r\n\t\t\t\t\t\t\t\t`planet_galaxy` = '1',\r\n\t\t\t\t\t\t\t\t`planet_system` = '1',\r\n\t\t\t\t\t\t\t\t`planet_planet` = '1',\r\n\t\t\t\t\t\t\t\t`planet_last_update` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t`planet_metal` = '500',\r\n\t\t\t\t\t\t\t\t`planet_crystal` = '500',\r\n\t\t\t\t\t\t\t\t`planet_deuterium` = '0';");
parent::$db->query("INSERT INTO " . RESEARCH . " SET\r\n\t\t\t\t\t\t\t\t`research_user_id` = '1';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\r\n\t\t\t\t\t\t\t\t`user_statistic_user_id` = '1';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET\r\n\t\t\t\t\t\t\t\t`premium_user_id` = '1';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '1';");
parent::$db->query("INSERT INTO " . BUILDINGS . " SET\r\n\t\t\t\t\t\t\t\t`building_planet_id` = '1';");
parent::$db->query("INSERT INTO " . DEFENSES . " SET\r\n\t\t\t\t\t\t\t\t`defense_planet_id` = '1';");
parent::$db->query("INSERT INTO " . SHIPS . " SET\r\n\t\t\t\t\t\t\t\t`ship_planet_id` = '1';");
// write the new admin email for support and debugging
Functions_Lib::update_config('admin_email', $adm_email);
return TRUE;
}