本文整理汇总了PHP中Account::setUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::setUsername方法的具体用法?PHP Account::setUsername怎么用?PHP Account::setUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::setUsername方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginAccount
public function loginAccount($username, $password)
{
$this->dbConnect();
//Encrypt the password
$password = Operations::encryptPassword($username, $password);
//Query to get the user's details
$sql = "SELECT * FROM users WHERE username = ? AND password = ?";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(1, $username);
$stmt->bindParam(2, $password);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll();
//For each of the results (only one) *This will only happen if there is a result, so return inside the foreach*
foreach ($results as $row) {
//Instantiate a new account object
$account = new Account();
//Set the account details
$account->setUsername($row["username"]);
$account->setPassword($row["password"]);
$account->setFirstname($row["firstname"]);
$account->setLastname($row["lastname"]);
$account->setEmail($row["email"]);
$this->dbDisconnect();
//Return the account object
return $account;
}
$this->dbDisconnect();
return null;
}
示例2: addAccount
public function addAccount($username, $password, $firstname)
{
// Loop through the current accounts to see if the username already exists
// If the username does not exist, we will push the new account in to the array & return true
// Else, return false
$accountExists = false;
foreach ($this::$data as $account) {
if ($account->getUsername() == $username) {
$accountExists = true;
break;
}
}
if ($accountExists) {
return false;
} else {
$account = new Account();
$account->setUsername($username);
$account->setPassword($password);
$account->setFirstname($firstname);
echo "adding to data..";
array_push(InMemoryDatabase::$data, $account);
var_dump($this::$data);
return true;
}
}
示例3: doSignUp
public function doSignUp($request, $dbConnection)
{
$account = new Account($dbConnection);
$account->setPassword($request['password']);
$account->setUsername($request['username']);
$account->setEmail($request['email']);
$account->insert();
}
示例4: createAccount
public function createAccount(Account $account)
{
$params = array('package_type' => $account->getType(), 'period' => $account->getPeriod(), 'method' => 'create');
$result = $this->_request($params);
$account->setStatus('enabled');
$account->setUsername($result['user']);
$account->setPassword($result['vpn_password']);
return $account;
}
示例5: LoadAcc
public function LoadAcc($id)
{
$acc = new Account();
$allaccs = file('storage/account.txt');
foreach ($allaccs as $allacc) {
$accarr = explode(':', $allacc);
if ($id == $accarr['0']) {
$acc->setId($accarr['0']);
$acc->setUsername($accarr['1']);
$acc->setPassword($accarr['2']);
$pro = new ProfilController();
$acc->setProfil($pro->GetById($accarr['3']));
$lan = new SpracheController();
$acc->setSprache($lan->GetById($accarr['4']));
return $acc;
}
}
return false;
}
示例6: displayForm
if ($_POST['submit'] && recaptchaCheck()) {
extract($_POST);
//CALL CHECKPASSWORD
$database = connectToDatabase();
$new_account = new Account();
$new_account->setFirstName($first_name);
$new_account->setLastName($last_name);
$new_account->setMiddleInitial($middle_initial);
$new_account->setStreetAddress($street_address);
$new_account->setCity($city);
$new_account->setState($state);
$new_account->setZipCode($zip_code);
$new_account->setEmailAddress($email_address);
$new_account->setAreaCode($area_code);
$new_account->setPhoneNumber($phone_number);
$new_account->setUsername($username, $database);
if ($password === $password2) {
$new_account->setPassword($password);
}
if ($new_account->updateDatabase($database) == 0) {
displayForm();
} else {
echo "Account created successfully!<br/>";
}
} else {
displayForm();
}
}
function displayForm()
{
echo "<form method='post'>";
示例7: getFriends
public function getFriends($currentUser)
{
$this->dbConnect();
$sql = "SELECT * FROM accounts WHERE username <> ?";
$statement = $this->con->prepare($sql);
$statement->bindParam(1, $currentUser);
$statement->execute();
$statement->setFetchMode(PDO::FETCH_ASSOC);
$results = $statement->fetchAll();
$users = array();
foreach ($results as $row) {
$account = new Account();
$account->setUsername($row["username"]);
$account->setPassword($row["password"]);
$account->setFirstname($row["firstname"]);
array_push($users, $account);
}
$this->dbClose();
return $users;
}