PHP User::GetId Examples

PHP User::GetId - 7 examples found. These are the top rated real world PHP examples of User::GetId extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 function Login($id, $username, $password)
 {
     $active = false;
     $user = new User();
     $user->SetDatabase($this->database);
     $user->SetUsername($username);
     $user->SetPassword($password);
     if ($id == "") {
         $user->Encrypt($password);
     } else {
         $user->SetEncryptedPassword($password);
     }
     $this->logged_in = false;
     if ($user->UserExists()) {
         if ($user->CheckPassword()) {
             $this->logged_in = true;
             $user->SelectByName();
         }
     }
     if ($this->logged_in) {
         if ($user->GetUsername() == "guest") {
             $this->logged_in = false;
         }
         if ($id != "") {
             $this->SetId($id);
             $this->SelectById();
             $this->SetUser($user->GetId());
             if ($this->Update()) {
                 $this->UnsetCookie();
                 $this->SetCookie($user->GetUsername());
             }
             if ($this->GetActive()) {
                 $active = true;
             }
         }
         if (!$active) {
             $this->SetDateStart(date('Y-m-d H:i:s'));
             $this->SetDateLast(date('Y-m-d H:i:s'));
             $this->SetActive(1);
             $this->SetIp($_SERVER['REMOTE_ADDR']);
             $this->SetUser($user->GetId());
             if ($this->Insert()) {
                 $this->UnsetCookie();
                 $this->SetCookie($user->GetUsername());
                 return $this->id;
             }
         } else {
             $this->SetDateLast(date('Y-m-d H:i:s', time()));
             $this->Update();
             return $this->id;
         }
     }
     $this->logged_in = false;
     return false;
 }
 /**
  * Checks if user is the founder
  *
  * @return boolean
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 protected function isFounder()
 {
     $this->app->wf->ProfileIn(__METHOD__);
     $wiki = F::build('WikiFactory', array($this->app->wg->CityId), 'getWikiById');
     if (intval($wiki->city_founding_user) === $this->user->GetId()) {
         // mech: BugId 18248
         $founder = $this->isUserInGroup(self::WIKIA_GROUP_SYSOP_NAME) || $this->isUserInGroup(self::WIKIA_GROUP_BUREAUCRAT_NAME);
         $this->app->wf->ProfileOut(__METHOD__);
         return $founder;
     }
     $this->app->wf->ProfileOut(__METHOD__);
     return false;
 }
     $usif_nick = $usif_first_name;
 }
 $user = new User();
 $user->SetDatabase($database);
 $user->SetUsername($user_username);
 $user->SetPassword($user_password1);
 $user->SetActive(0);
 $user->Insert();
 $user->SelectByName();
 $user_info = new UserInfo();
 $user_info->SetDatabase($database);
 $user_info->SetFirstName($usif_first_name);
 $user_info->SetLastName($usif_last_name);
 $user_info->SetNick($usif_nick);
 $user_info->SetEmail($usif_email);
 $user_info->SetUser($user->GetId());
 if ($user_info->Insert()) {
     $message_position = 8;
     $message = $screen_module_name . " incluídas com sucesso. Aguarde a ativação do usuário pelo administrador.";
     $usif_id = "";
     $usif_first_name = "";
     $usif_last_name = "";
     $usif_nick = "";
     $usif_email = "";
     $usif_user_id = "";
     $user_username = "";
     $user_password1 = "";
     $user_password2 = "";
 } else {
     $message_position = 8;
     $message = "Problemas na operação.";
 function GetUserId()
 {
     $user = new User();
     $user->SetDatabase($this->database);
     $user->SetUsername($this->username);
     $user->SetPassword($this->password);
     $user->Encrypt();
     if ($user->SelectByName()) {
         return $user->GetId();
     } else {
         return 0;
     }
 }
$user_id_tmp = $user_tmp->GetId();
if (isset($_POST["p_action"])) {
    $action = $_POST["p_action"];
    $shou_id = $_POST["p_shou_id"];
    $shou_date = $_POST["p_shou_date"];
    $shou_text = $_POST["p_shou_text"];
    $shou_user_id = $_POST["p_shou_user_id"];
    $message = "";
    if ($action == 1) {
        $date = new Date();
        $date->SetConverted($shou_date);
        $date->ConvertToFullDate();
        $shout = new Shout();
        $shout->SetDatabase($database);
        $shout->SetDate($date->GetDate());
        $shout->SetText($shou_text);
        $shout->SetUser($shou_user_id);
        if ($shout->Insert()) {
            $message = $screen_module_name . " incluído com sucesso.";
            $shou_id = "";
            $shou_date = $date->GetNowFull();
            $shou_text = "";
            $shou_user_id = "";
        } else {
            $message = "Problemas na operação.";
        }
    }
}
?>

<html>
	<head>
		<title>Schifer's</title>
		<link rel="stylesheet" type="text/css" href="/schifers/css/schifers.css">
		<script language="Javascript">
			
			function Clear()
			{
				document.form_admin.p_shou_id.value = "";
				document.form_admin.p_shou_text.value = "";
				document.form_admin.p_shou_user_id.selectedIndex = 0;
				document.form_admin.p_action.value="0";
				document.form_admin.submit();
			}
			
			function Insert()
			{
				document.form_admin.p_action.value="1";
				document.form_admin.submit();
			}
			
		</script>
	</head>
	<body bgcolor="#FFFFFF">

<?php 
require '../../' . $WEB_SITE . 'blocks/blTitle.php';
?>

<?php 
if ($shou_date == "") {
    $date = new Date();
    $shou_date = $date->GetNowFull();
}
?>

	<table width="100%" cellspacing="1" bgcolor="#000000">
		<form name="form_admin" method="post">
			<input type="hidden" name="p_action">
			<input type="hidden" name="p_shou_id" value="<?php 
echo $shou_id;
?>
">
			<input type="hidden" name="p_shou_date" value="<?php 
echo $shou_date;
?>
">
			<input type="hidden" name="p_shou_user_id" value="<?php 
echo $user_tmp->GetId();
Example #6
0
require '../../' . $WEB_SITE . 'src/cdGuardian.php';
$screen_module_name = "Usuário";
if (isset($_POST["p_action"])) {
    $action = $_POST["p_action"];
    $user_id = $_POST["p_user_id"];
    $user_username = $_POST["p_user_username"];
    $user_password1 = $_POST["p_user_password1"];
    $user_password2 = $_POST["p_user_password2"];
    $user_active = $_POST["p_user_active"];
    $message = "";
    if ($action == 1) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetId($user_id);
        $user->SelectById();
        $user_id = $user->GetId();
        $user_username = $user->GetUsername();
        $user_active = $user->GetActive();
        if ($user_id == "") {
            $message = $screen_module_name . " não encontrado.";
            $user_id = "";
            $user_username = "";
            $user_password1 = "";
            $user_password2 = "";
            $user_active = "";
        }
    }
    if ($action == 2) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetUsername($user_username);
 /**
  * Saves personal information about a user
  * @param User $user
  * @return void
  */
 public function SavePersonalInfo(User $user)
 {
     # Prepare filter
     require_once 'text/bad-language-filter.class.php';
     $language = new BadLanguageFilter();
     $users = $this->GetSettings()->GetTable('User');
     $s_sql = 'UPDATE ' . $users . ' SET ' . 'date_changed = ' . gmdate('U') . ', ' . "gender = " . ($user->GetGender() ? $this->SqlString($user->GetGender()) : "NULL") . ", " . "occupation = " . $this->SqlString($language->Filter($user->GetOccupation())) . ", " . "interests = " . $this->SqlHtmlString($language->Filter($user->GetInterests())) . ", " . "location = " . $this->SqlString($language->Filter($user->GetLocation())) . " " . 'WHERE user_id = ' . Sql::ProtectNumeric($user->GetId(), false);
     $this->Lock(array($users));
     $this->GetDataConnection()->query($s_sql);
     $this->Unlock();
 }