本文整理汇总了PHP中Account::createAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::createAccount方法的具体用法?PHP Account::createAccount怎么用?PHP Account::createAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::createAccount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public static function create()
{
$error_message = "";
$studentId = "";
$username = "";
$password = "";
$nickname = "";
if (!empty($_POST)) {
$studentId = $_POST["studentid"];
$username = $_POST["username"];
$password = $_POST["password"];
$repeatPassword = $_POST["repeat_password"];
$nickname = $_POST["nickname"];
// 確認処理ー
if (empty($studentId)) {
$error_message .= "<li>学生番号を空白にしないでください。</li>";
} else {
if (preg_match("/^j/", $studentId)) {
$error_message .= "<li>英文字 j はいりません。数字のみです。</li>";
} else {
if (!preg_match("/^[0-9]{7}\$/", $studentId)) {
$error_message .= "<li>正しい学籍番号を入力してください。</li>";
} else {
if (!in_array($studentId, getAllowableStudentIdList())) {
$error_message .= "<li>この学籍番号は使えません。</li>";
}
}
}
}
if (empty($username)) {
$error_message .= "<li>ログイン名を空白にしないでください。</li>";
} else {
if (!preg_match("/^[0-9a-zA-Z]+\$/", $username)) {
$error_message .= "<li>ログイン名は英数字以外の文字は受け付けません。[@_?,.]などの文字も使えません。</li>";
} else {
if (Account::duplicateUsername($username)) {
$error_message .= "<li>ログイン名はすでに使われました。別のログイン名にしてください。</li>";
}
}
}
if (empty($password)) {
$error_message .= "<li>パスワードを空白にしないでください。</li>";
}
if (empty($repeatPassword)) {
$error_message .= "<li>再確認パスワードを空白にしないでください。</li>";
} else {
if ($repeatPassword != $password) {
$error_message .= "<li>パスワードと再確認のパスワードは一致しません。</li>";
}
}
if (empty($nickname)) {
$error_message .= "<li>表示名を空白にしないでください。</li>";
}
// there is no error, and success to create a new account
if (strlen($error_message) == 0) {
$salt = Utils::generateSalt();
$encrypted_password = Utils::encrpytPassword($password, $salt);
// verify campus by
if (preg_match("/^[481]/", $studentId)) {
$campus = "葛飾";
} else {
if (preg_match("/^[67]/", $studentId)) {
$campus = "野田";
} else {
$campus = "謎";
}
}
$validate_code = Utils::generateValidationCode();
$new_account_id = Account::createAccount($username, $encrypted_password, $nickname, $salt, $validate_code, $studentId, $campus);
$mail_content = "下記のアカウントを作成しました。\n ログイン名: {$username}\n パスワード: {$password}\n次のリンクをクリックして認証が自動に行います。";
self::sendMail($new_account_id, $studentId, $validate_code, $mail_content);
header("Location: /account/verifyplease?accountid=" . $new_account_id);
die;
}
}
$content = "create.php";
include VIEWS_PATH . "account/public.php";
}
示例2: operation_fail
operation_fail("登陆失败");
}
$weixinAPI = new WeixinAPI();
$json = $weixinAPI->getOpenid($code);
session_start();
// 记录用户信息
$_SESSION['openid'] = $json['openid'];
$_SESSION['access_token'] = $json;
$openid = $json['openid'];
$home_url = '../index.php';
$account = Account::getAccount($json['openid']);
if ($account != null) {
$_SESSION['account'] = $account;
$extra = AccountExtra::getInfo($json['openid']);
if ($extra != null) {
$_SESSION['account_extra'] = $extra;
}
} else {
$weixinAPI = new WeixinAPI();
$userInfo = $weixinAPI->getUserInfo($json['access_token'], $openid);
Account::createAccount($openid, $userInfo['nickname']);
$account = Account::getAccount($json['openid']);
$_SESSION['account'] = $account;
}
//$home_url = '../h5/publish_task_page.php';
header('Location: ' . $home_url);
json_put("session", $_SESSION['access_token']);
json_output();
?>
示例3: __construct
/**
* AjaxRequest objects are automatically processed when they are created, based on the unique $action
* value. The result of the call is stored in $response to be handled however you need (e.g. output
* as JSON, XML etc) - or an Exception is thrown if something went wrong. Exceptions are used SOLELY for
* program errors: not for user-entry errors.
*/
public function __construct($action, $post = array())
{
$this->action = $action;
$this->post = Utils::sanitize($post);
switch ($this->action) {
// ------------------------------------------------------------------------------------
// INSTALLATION
// ------------------------------------------------------------------------------------
// a fresh install assumes it's a blank slate: no database tables, no settings file
case "installationTestDbSettings":
Core::init("installation");
if (Core::checkIsInstalled()) {
return;
}
list($success, $content) = Database::testDbSettings($this->post["dbHostname"], $this->post["dbName"], $this->post["dbUsername"], $this->post["dbPassword"]);
$this->response["success"] = $success;
$this->response["content"] = $content;
break;
case "installationCreateSettingsFile":
Core::init("installation");
if (Core::checkIsInstalled()) {
return;
}
if (Core::checkSettingsFileExists()) {
$this->response["success"] = 0;
$this->response["content"] = "Your settings.php file already exists.";
return;
} else {
list($success, $content) = Installation::createSettingsFile($this->post["dbHostname"], $this->post["dbName"], $this->post["dbUsername"], $this->post["dbPassword"], $this->post["dbTablePrefix"]);
$this->response["success"] = $success ? 1 : 0;
// bah!
$this->response["content"] = $content;
}
break;
case "confirmSettingsFileExists":
Core::init("installation");
$settingsFileExists = Core::checkSettingsFileExists();
$this->response["success"] = $settingsFileExists ? 1 : 0;
break;
case "installationCreateDatabase":
Core::init("installationDatabaseReady");
if (Core::checkIsInstalled()) {
$this->response["success"] = 0;
$this->response["content"] = "It appears that the script is already installed. If the database already existed, you may need to delete the tables manually before being able to continue.";
return;
}
list($success, $content) = Installation::createDatabase();
if (!$success) {
$this->response["success"] = 0;
$this->response["content"] = $content;
return;
}
// always create the administrator account. If the user chose the anonymous setup, all values
// will be blank and all configurations will be associated with this (anonymous) user
$adminAccount = array("accountType" => "admin");
if ($this->post["userAccountSetup"] != "anonymous") {
$adminAccount["firstName"] = $this->post["firstName"];
$adminAccount["lastName"] = $this->post["lastName"];
$adminAccount["email"] = $this->post["email"];
$adminAccount["password"] = $this->post["password"];
}
Account::createAccount($adminAccount, true);
// make note of the fact that we've passed this step of the installation process
Settings::setSetting("userAccountSetup", $this->post["userAccountSetup"]);
Settings::setSetting("installationStepComplete_Core", "yes");
Settings::setSetting("defaultLanguage", $this->post["defaultLanguage"]);
Settings::setSetting("allowAnonymousAccess", $this->post["allowAnonymousAccess"] == "yes" ? "yes" : "no");
Settings::setSetting("anonymousUserPermissionDeniedMsg", $this->post["anonymousUserPermissionDeniedMsg"]);
$this->response["success"] = 1;
$this->response["content"] = "";
break;
// ------------------------------------------------------------------------------------
// PLUGINS (installation + reset)
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// PLUGINS (installation + reset)
// ------------------------------------------------------------------------------------
case "installationDataTypes":
Core::init("installationDatabaseReady");
if (!Core::checkIsInstalled()) {
$this->setDataTypes();
}
break;
case "installationValidateSettingsFile":
$response = Installation::validateSettingsFile();
$this->response["success"] = $response["success"];
$this->response["content"] = $response["errorMessage"];
break;
case "resetDataTypes":
Core::init("resetPlugins");
if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
$this->setDataTypes();
}
break;
//.........这里部分代码省略.........
示例4: doesUserExist
$servername = '66.228.53.178';
$dbusername = 'chukwuma';
$dbpassword = 'Z_Q7tM"VQaGyqx3n';
$dbname = 'chukwuma_ophion';
$conn = new PDO("mysql:host={$servername};dbname={$dbname}", $dbusername, $dbpassword);
//connects to database
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//shows errors
//checks if Account exists
function doesUserExist($username, $conn)
{
$stmt = $conn->prepare("SELECT username FROM user WHERE username = :username");
$stmt->bindParam(':username', $username);
$stmt->execute();
if ($stmt->rowCount() > 0) {
return true;
} else {
return false;
}
}
$r = doesUserExist($username, $conn);
if ($r == true) {
header("location:http://ophion.chukwumaokere.com/accountexists.html");
} else {
$acc = new Account();
$acc->createAccount($user_type, $name, $company_name, $company_id, $email, $username, $password, $address1, $address2, $country, $city, $state_province, $zip, $mainPhone, $altPhone);
$acc->insertAccount($conn);
header("location:http://ophion.chukwumaokere.com/accountcreated.html");
/* Redirect browser */
}
exit;
示例5: __construct
/**
* AjaxRequest objects are automatically processed when they are created, based on the unique $action
* value. The result of the call is stored in $response to be handled however you need (e.g. output
* as JSON, XML etc) - or an Exception is thrown if something went wrong. Exceptions are used SOLELY for
* program errors: not for user-entry errors.
*/
public function __construct($action, $post = array())
{
if (empty($action)) {
throw new Exception("no_action_specified");
return;
}
$this->action = $action;
$post = Utils::sanitize($post);
switch ($this->action) {
// ------------------------------------------------------------------------------------
// INSTALLATION
// ------------------------------------------------------------------------------------
// a fresh install assumes it's a blank slate: no database tables, no settings file
case "installationTestDbSettings":
Core::init("installation");
list($success, $content) = Database::testDbSettings($post["dbHostname"], $post["dbName"], $post["dbUsername"], $post["dbPassword"]);
$this->response["success"] = $success;
$this->response["content"] = $content;
break;
case "installationCreateSettingsFile":
Core::init("installation");
if (Core::checkSettingsFileExists()) {
$this->response["success"] = 0;
$this->response["content"] = "Your settings.php file already exists.";
return;
} else {
list($success, $content) = Installation::createSettingsFile($post["dbHostname"], $post["dbName"], $post["dbUsername"], $post["dbPassword"], $post["dbTablePrefix"]);
$this->response["success"] = $success;
$this->response["content"] = $content;
}
break;
case "installationCreateDatabase":
Core::init("installation_db_ready");
list($success, $content) = Installation::createDatabase();
if (!$success) {
$this->response["success"] = 0;
$this->response["content"] = $content;
return;
}
// always create the administrator account. If the user chose the anonymous setup, all values
// will be blank and all configurations will be associated with this (anonymous) user
$adminAccount = array("accountType" => "admin", "firstName" => $post["firstName"], "lastName" => $post["lastName"], "email" => $post["email"], "password" => $post["password"]);
Account::createAccount($adminAccount);
// make note of the fact that we've passed this installation step
Settings::setSetting("userAccountSetup", $post["userAccountSetup"]);
Settings::setSetting("installationStepComplete_Core", "yes");
$this->response["success"] = 1;
$this->response["content"] = "";
break;
case "installationDataTypes":
Core::init("installation_db_ready");
$index = $post["index"];
$groupedDataTypes = DataTypePluginHelper::getDataTypePlugins("installion_db_ready", false);
$dataTypes = DataTypePluginHelper::getDataTypeList($groupedDataTypes);
if ($index >= count($dataTypes)) {
$this->response["success"] = 1;
$this->response["content"] = "";
$this->response["isComplete"] = true;
} else {
// attempt to install this data type
$currDataType = $dataTypes[$index];
$this->response["dataTypeName"] = $currDataType->getName();
$this->response["dataTypeFolder"] = $currDataType->folder;
$this->response["isComplete"] = false;
try {
list($success, $content) = $currDataType->install();
$this->response["success"] = $success;
$this->response["content"] = $content;
} catch (Exception $e) {
$this->response["success"] = false;
$this->response["content"] = "Unknown error.";
}
}
break;
case "installationSaveDataTypes":
Core::init("installation_db_ready");
$folders = $post["folders"];
$response = Settings::setSetting("installedDataTypes", $folders);
$this->response["success"] = $response["success"];
$this->response["content"] = $response["errorMessage"];
break;
case "installationExportTypes":
Core::init("installation_db_ready");
$index = $post["index"];
$exportTypes = ExportTypePluginHelper::getExportTypePlugins("installation_db_ready", false);
if ($index >= count($exportTypes)) {
$this->response["success"] = 1;
$this->response["content"] = "";
$this->response["isComplete"] = true;
} else {
// attempt to install this data type
$currExportType = $exportTypes[$index];
$this->response["exportTypeName"] = $currExportType->getName();
$this->response["exportTypeFolder"] = $currExportType->folder;
//.........这里部分代码省略.........
示例6: addAccount
/**
* Añadir una cuenta desde un archivo importado.
*
* @return bool
*/
protected function addAccount()
{
if (is_null($this->getUserId()) || $this->getUserId() === 0) {
$this->setUserId(Session::getUserId());
}
if (is_null($this->getUserGroupId()) || $this->getUserGroupId() === 0) {
$this->setUserGroupId(Session::getUserGroupId());
}
$account = new Account();
$account->setAccountName($this->getAccountName());
$account->setAccountCustomerId($this->getCustomerId());
$account->setAccountCategoryId($this->getCategoryId());
$account->setAccountLogin($this->getAccountLogin());
$account->setAccountUrl($this->getAccountUrl());
$account->setAccountPass($this->getAccountPass());
$account->setAccountIV($this->getAccountPassIV());
$account->setAccountNotes($this->getAccountNotes());
$account->setAccountUserId($this->getUserId());
$account->setAccountUserGroupId($this->getUserGroupId());
return $account->createAccount();
}
示例7: init
private function init()
{
$db = UserConfig::getDB();
if (UserConfig::$useAccounts) {
$userid = $this->getID();
if ($stmt = $db->prepare('INSERT INTO ' . UserConfig::$mysql_prefix . 'user_preferences (user_id) VALUES (?)')) {
if (!$stmt->bind_param('i', $userid)) {
throw new Exception("Can't bind parameter");
}
if (!$stmt->execute()) {
throw new Exception("Can't update user preferences (set current account)");
}
$stmt->close();
} else {
throw new Exception("Can't update user preferences (set current account)");
}
$personal = Account::createAccount('FREE (' . $this->getName() . ')', Plan::getFreePlan(), $this, Account::ROLE_ADMIN);
$personal->setAsCurrent($this);
}
if (!is_null(UserConfig::$onCreate)) {
eval(userConfig::$onCreate . '($this);');
}
if (!is_null(UserConfig::$email_module)) {
UserConfig::$email_module->registerSubscriber($this);
}
}
示例8: Account
$u = new Account($_SESSION["user"]["official"]);
$u->addUsername($canon ? $canon : $openid, $openid);
$addition = true;
}
$_SESSION['user']['authed'] = true;
$_SESSION['user']['username'] = $openid;
if (isset($canon)) {
$_SESSION["user"]["canon"] = $canon;
} else {
unset($_SESSION["user"]["canon"]);
}
$_SESSION["user"]["official"] = $_SESSION["user"]["canon"] ? $_SESSION["user"]["canon"] : $_SESSION["user"]["username"];
if (!$addition) {
$acct = Account::existsByOID($_SESSION["user"]["official"]);
if ($acct === false) {
$acct = Account::createAccount();
$acct->addUsername($_SESSION["user"]["official"], $_SESSION["user"]["username"]);
$acct->setDetails($id, $sreg);
//$acct->save();
if (isset($_COOKIE["pbguid"])) {
$acct->setGUID($_COOKIE["pbguid"]);
}
$acct->setAPIKey(makeApiKey());
$acct = new Account($acct->id);
} else {
$acct = new Account($acct);
$acct->updateLastLogin();
}
$acct->load($acct->id);
$_SESSION["user"]["id"] = $acct->id;
$_SESSION["user"]["prefs"] = $acct->prefs;
示例9: Account
<?php
require_once '../inc/Account.class.php';
if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['firstname']) && isset($_POST['lastname'])) {
echo "Registrierung erfolgreich.";
$account = new Account();
$account->ac_email = $_POST['email'];
$account->setPassword($_POST['password']);
$account->ac_firstname = $_POST['firstname'];
$account->ac_lastname = $_POST['lastname'];
$account->ac_registered = time();
$account->createAccount();
}
?>
<form action="register.php" method="post">
<p>E-Mail:<br /><input name="email" type="text" size=100"> </p>
<p>Kennwort:<br><input name="password" type="password" size="100"></p>
<p>Vorname:<br><input name="firstname" type="text"></p>
<p>Nachname:<br /><input name="lastname" type="text"></p>
<input name="submit" type="submit">
</form>