本文整理汇总了PHP中GWF_User::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_User::insert方法的具体用法?PHP GWF_User::insert怎么用?PHP GWF_User::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_User
的用法示例。
在下文中一共展示了GWF_User::insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_bot
private static function insert_bot($botname)
{
$user = new GWF_User(array('user_id' => 0, 'user_options' => GWF_User::BOT | GWF_User::WEBSPIDER, 'user_name' => $botname, 'user_password' => GWF_Password::hashPasswordS('webspider'), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_email' => '', 'user_gender' => 'no_gender', 'user_lastlogin' => 0, 'user_lastactivity' => 0, 'user_birthdate' => '00000000', 'user_avatar_v' => 0, 'user_countryid' => 0, 'user_langid' => 0, 'user_langid2' => 0, 'user_level' => 0, 'user_title' => '', 'user_settings' => NULL, 'user_data' => NULL, 'user_credits' => 0.0));
if (false === $user->insert()) {
return false;
}
echo "Inserted new Bot: {$botname}<br/>";
return $user;
}
示例2: onCrossRegister
private function onCrossRegister($username)
{
$options = 0;
$password = GWF_Random::randomKey();
$user = new GWF_User(array('user_id' => 0, 'user_options' => $options, 'user_name' => $username, 'user_password' => GWF_Password::hashPasswordS($password), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT), 'user_email' => '', 'user_gender' => 'no_gender', 'user_lastlogin' => time(), 'user_lastactivity' => time(), 'user_birthdate' => '00000000', 'user_avatar_v' => 0, 'user_countryid' => 0, 'user_langid' => 1, 'user_langid2' => 0, 'user_level' => 0, 'user_title' => '', 'user_settings' => '', 'user_data' => '', 'user_credits' => '0.00'));
if (false === $user->insert()) {
return false;
}
return true;
}
示例3: installPMBot
private static function installPMBot(Module_PM $module)
{
$user = new GWF_User(array('user_name' => '_GWF_PM_BOT_', 'user_password' => 'x', 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_email' => GWF_BOT_EMAIL, 'user_birthdate' => GWF_Time::getDate(GWF_Time::LEN_DAY), 'user_countryid' => 0, 'user_langid' => 0, 'user_options' => GWF_User::BOT, 'user_lastactivity' => time()));
if (false === $user->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === GWF_ModuleLoader::saveModuleVar($module, 'pm_bot_uid', $user->getID())) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例4: onActivate
public static function onActivate(Module_Register $module, $token, $byEmail)
{
$ua = GDO::table('GWF_UserActivation');
if (false === ($row = $ua->getBy('token', $token))) {
return $module->error('err_activate');
}
if ($module->hasIPActivatedRecently()) {
return $module->error('err_ip_timeout');
}
$options = $byEmail === true ? GWF_User::MAIL_APPROVED : 0;
$username = $row->getVar('username');
$countryid = $row->getVar('countryid');
$user = new GWF_User(array('user_id' => 0, 'user_options' => $options, 'user_name' => $username, 'user_password' => $row->getVar('password'), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => $row->getVar('ip'), 'user_email' => $row->getVar('email'), 'user_gender' => 'no_gender', 'user_lastlogin' => 0, 'user_lastactivity' => time(), 'user_birthdate' => $row->getVar('birthdate'), 'user_avatar_v' => 0, 'user_countryid' => $countryid, 'user_langid' => GWF_LangMap::getPrimaryLangID($countryid), 'user_langid2' => 0, 'user_level' => 0, 'user_title' => '', 'user_settings' => '', 'user_data' => '', 'user_credits' => '0.00'));
if (false === $user->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $ua->deleteWhere(sprintf('username=\'%s\'', $username))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return self::onActivated($module, $user);
}
示例5: fixWeChallUser
private static function fixWeChallUser(Module_WeChall $module)
{
if (false === ($user = GWF_User::getByName('WeChall'))) {
$user = new GWF_User(array('user_name' => 'WeChall', 'user_email' => 'wechall@wechall.net', 'user_password' => GWF_Password::hashPasswordS('wechallbot'), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_lastactivity' => time(), 'user_options' => GWF_User::BOT));
if (false === $user->insert()) {
echo GWF_HTML::error('WeChall Install', 'Can not find user WeChall');
$uid = 0;
} else {
$uid = $user->getID();
}
} else {
$uid = $user->getID();
}
if (false === $module->saveModuleVar('wc_uid', $uid)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例6: createAdmin
public static function createAdmin($username, $password, $email, &$output)
{
if (false === ($user = GWF_User::getByName($username))) {
$user = new GWF_User(array('user_name' => $username, 'user_email' => $email, 'user_password' => GWF_Password::hashPasswordS($password), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT), 'user_lastactivity' => time()));
if (false === $user->insert()) {
return false;
}
}
$userid = $user->getID();
if (false === GWF_UserGroup::addToGroup($userid, GWF_Group::getByName(GWF_Group::ADMIN)->getID())) {
return false;
}
if (false === GWF_UserGroup::addToGroup($userid, GWF_Group::getByName(GWF_Group::STAFF)->getID())) {
return false;
}
$output .= GWF_HTML::message('Install Wizard', sprintf('Added new admin user: %s - Password: [censored]', $username));
return true;
}
示例7: htmlSendToLogin
require 'key2.key';
$key2 = ob_get_contents();
ob_end_clean();
chdir("../../../");
require_once "challenge/html_head.php";
$title = '2013 New Years Special';
html_head("Install: {$title}");
if (!GWF_User::isAdminS()) {
return htmlSendToLogin("Better be admin !");
}
$solution = false;
$score = 4;
$url = "challenge/quangntenemy/2013NYS/index.php";
$creators = "quangntenemy";
$tags = 'Special,Crypto';
WC_Challenge::installChallenge($title, $solution, $score, $url, $creators, $tags, true, WC_Challenge::CHALL_CASE_I);
if (!($user = GWF_User::getByName('Rudolph2013'))) {
$user = new GWF_User(array('user_id' => '0', 'user_options' => GWF_User::BOT | GWF_User::MAIL_APPROVED | GWF_User::EMAIL_GPG, 'user_name' => 'Rudolph2013', 'user_password' => GWF_Password::hashPasswordS('quangster'), 'user_regdate' => GWF_Time::getDate(), 'user_email' => 'rudolph2013@gizmore.org'));
$user->insert();
} else {
$user->saveOption(GWF_User::EMAIL_GPG, true);
}
GWF_PublicKey::updateKey($user->getID(), $key1);
if (!($user = GWF_User::getByName('Silvester2013'))) {
$user = new GWF_User(array('user_id' => '0', 'user_options' => GWF_User::BOT | GWF_User::MAIL_APPROVED | GWF_User::EMAIL_GPG, 'user_name' => 'Silvester2013', 'user_password' => GWF_Password::hashPasswordS('quangster'), 'user_regdate' => GWF_Time::getDate(), 'user_email' => 'silvester2013@gizmore.org'));
$user->insert();
} else {
$user->saveOption(GWF_User::EMAIL_GPG, true);
}
GWF_PublicKey::updateKey($user->getID(), $key2);
require_once "challenge/html_foot.php";