PHP User::email Examples

PHP User::email - 17 examples found. These are the top rated real world PHP examples of User::email extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'required | email', 'password' => 'required', 'password_confirmation' => 'required | same:password');
     $validator = Validator::make(Input::all(), $rules);
     $input = Input::all();
     if ($validator->fails()) {
         $input['autoOpenModal'] = true;
         //var_dump($input);die;
         return Redirect::back()->withErrors($validator)->withInput($input);
     } else {
         $user = new User();
         $user->first_name = Input::get('first_name');
         $user->last_name = Input::get('last_name');
         $user->password = Hash::make(Input::get('password'));
         $user->status = 3;
         $user->save();
         $userEmail = new UserEmail();
         $userEmail->address = Input::get('email');
         $userEmail->token = $userEmail->createToken();
         $userEmail->confirmed = true;
         $user->email()->save($userEmail);
         $user->roles()->attach(3);
         $users = User::with(['roles', 'email'])->get();
         //Session::flash('message', 'Successfully created nerd!');
         return Redirect::to('admin/user')->with('users', $users);
     }
     //return "hello";
 }
Example #2
0
 public static function init()
 {
     global $sql, $kio;
     // Check session and set user variables
     // TODO: Logowanie za pomocą pliku, jak w truecrypt
     $cookie = $_COOKIE[COOKIE . '-login'];
     if ($cookie) {
         $user = $sql->query('SELECT * FROM ' . DB_PREFIX . 'users WHERE id = ' . (int) $cookie)->fetch(PDO::FETCH_ASSOC);
         // Correct
         if ($cookie == $user['id'] . '.' . sha1($user['auth_code']) && IP == $user['ip']) {
             self::$array =& $user;
             self::$id = $user['id'];
             self::$nickname = $user['nickname'];
             self::$logname = $user['logname'];
             self::$email = $user['email'];
             self::$groupId = $user['group_id'];
             self::$pmInbox = $user['pm_inbox'];
             self::$pmOutbox = $user['pm_outbox'];
             self::$lastVisit = $user['last_visit'];
             //				foreach ($user as $key => $value)
             //					$this->{$key} = $value;
             define('LOGGED', true);
             define('NICKNAME', self::$nickname);
             define('UID', self::$id);
             define('GID', self::$groupId);
             // update online_time
             if (!defined('AJAX')) {
                 $sql->exec('
			UPDATE ' . DB_PREFIX . 'users
			SET
				last_visit = ' . TIMESTAMP . ',
				last_path = "' . PATH . '"
				-- online_time += ' . TIMESTAMP . ' - last_visit
			WHERE id = ' . UID);
             }
             // TODO: Zrobić po zalogowaniu okienki - Wróć do strony: Dziećmarów
             // TODO: zmienić jako prywatne
             // TODO: nakładanie się na siebie pozwoleń
             self::$permits = $user['permits'] ? unserialize($user['permits']) : (Kio::getGroup(GID, 'permits') ? unserialize(Kio::getGroup(GID, 'permits')) : array());
             self::$permits += Kio::getGroup(GID, 'permits') ? unserialize(Kio::getGroup(GID, 'permits')) : array();
             self::$permits = array_unique(self::$permits);
         } else {
             define('LOGGED', false);
             setcookie(COOKIE . '-session', '', 0, '/');
             define('UID', self::$id);
         }
     } else {
         define('LOGGED', false);
         define('NICKNAME', t('Guest'));
         define('UID', self::$id);
     }
     // Save session
     if (isset($_POST['login']) && !LOGGED) {
         self::login();
     }
 }
Example #3
0
 public function send(User $user = null, $email = null)
 {
     if ($user != null) {
         return mail($user->email(), $this->subject, $this->message, $this->getParameters());
     } elseif ($email != null) {
         return mail($email, $this->subject, $this->message, $this->getParameters());
     } else {
         return false;
     }
 }
Example #4
0
  /**
   * Ajout des utilisateurs à la base de données
   * @param $user User instance de la classe User
   **/
  public function add(User $user)
  {
      $q = $this->_db->prepare('INSERT INTO User 
	SET name = :name, 
		email = :email, 
		password = :password,
		gender = :gender,
		description = :description');
      $q->bindValue(':name', $user->name());
      $q->bindValue(':email', $user->email());
      $q->bindValue(':password', $user->password());
      $q->bindValue(':gender', $user->gender());
      $q->bindValue(':description', $user->description());
      $q->execute();
      $user->hydrate(['id' => $this->_db->lastInsertId()]);
      echo "Création du profil, avec succès";
  }
 public function postSendtoBusiness()
 {
     if (Auth::check()) {
         $business_id = Input::get('business_id');
         $attachment = Input::get('contfile');
         $email = User::email(Auth::user()->user_id);
         $timestamp = time();
         $thread_key = $this->threadKeyGenerator($business_id, $email);
         $custom_fields_bool = Input::get('custom_fields_bool');
         // save if there are custom fields available
         $custom_fields_data = '';
         if ($custom_fields_bool) {
             $custom_fields = Input::get('custom_fields');
             $res = Forms::getFieldsByBusinessId($business_id);
             foreach ($res as $count => $data) {
                 $custom_fields_data .= '<strong>' . Forms::getLabelByFormId($data->form_id) . ':</strong> ' . $custom_fields[$data->form_id] . "\n";
             }
         }
         if (!Message::checkThreadByKey($thread_key)) {
             $phones[] = Input::get('contmobile');
             Message::createThread(array('contactname' => User::first_name(Auth::user()->user_id) . ' ' . User::last_name(Auth::user()->user_id), 'business_id' => $business_id, 'email' => $email, 'phone' => serialize($phones), 'thread_key' => $thread_key));
             $data = json_encode(array(array('timestamp' => $timestamp, 'contmessage' => Input::get('contmessage') . "\n\n" . $custom_fields_data, 'attachment' => $attachment, 'sender' => 'user')));
             file_put_contents(public_path() . '/json/messages/' . $thread_key . '.json', $data);
         } else {
             $data = json_decode(file_get_contents(public_path() . '/json/messages/' . $thread_key . '.json'));
             $data[] = array('timestamp' => $timestamp, 'contmessage' => Input::get('contmessage') . "\n\n" . $custom_fields_data, 'attachment' => $attachment, 'sender' => 'user');
             $data = json_encode($data);
             file_put_contents(public_path() . '/json/messages/' . $thread_key . '.json', $data);
         }
         /*
         Mail::send('emails.contact', array(
           'name' => $name,
           'email' => $email,
           'messageContent' => Input::get('contmessage') . "\n\nAttachment: " . $attachment . "\n\n" . $custom_fields_data,
         ), function($message, $email, $name)
         {
           $message->subject('Message from '. $name . ' ' . $email);
           $message->to('paul@reminisense.com');
         });
         */
         return json_encode(array('status' => 1));
     } else {
         return json_encode(array('messages' => 'You are not allowed to access this function.'));
     }
 }
Example #6
0
 public function updatePassword(User $user, $newPassword = null)
 {
     $sql = "UPDATE users SET password = :pass WHERE username = :username AND email = :email LIMIT 1";
     $query = $this->session->prepare($sql);
     if ($newPassword == null) {
         $query->bindParam(":pass", $user->password());
     } else {
         $query->bindParam(":pass", $newPassword);
     }
     $query->bindParam(":username", $user->username());
     $query->bindParam(":email", $user->email());
     $query->execute();
     if ($query->rowCount() > 0) {
         $newuser = new User(null, $user->username(), $newPassword);
         return $this->get($newuser);
     }
     return null;
 }
Example #7
0
  /**
   * Ajout des utilisateurs à la base de données
   * @param $user User instance de la classe User
   **/
  public function add(User $user)
  {
      $q = $this->_db->prepare('INSERT INTO User 
	SET name = :name, 
		email = :email, 
		password = :password,
		gender = :gender,
		description = :description,
		nationalityId = :country,
		cityId = :city');
      $q->bindValue(':name', $user->name());
      $q->bindValue(':email', $user->email());
      $q->bindValue(':password', $user->password());
      $q->bindValue(':gender', $user->gender());
      $q->bindValue(':description', $user->description());
      $q->bindValue(':country', $user->nationalityId());
      $q->bindValue(':city', $user->cityId());
      $q->execute();
      $user->setId($this->_db->lastInsertId());
      echo _('Your account has been created');
  }
Example #8
0

    <div class="col-sm-6">
        <div class="form-group">
            <label>Userid</label>
            <input type="text" name="userid" class="form-control" value="<?php 
echo User::userid($_GET['id']);
?>
">
            <small>Only Admin can edit userid</small>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="form-group">
            <label>Email</label>
            <input type="text" name="email" class="form-control" value="<?php 
echo User::email($_GET['id']);
?>
">
            <small>Email must be different with another.</small>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="form-group">
            <label>Password</label>
            <input type="password" name="pass" class="form-control" value="">
            <small>Type password to change it. Left it blank to use old password.</small>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="form-group">
            <label>Group Level</label>
Example #9
0
$k = 0;
for ($datas = fgetcsv($fic, 1024, ','); !feof($fic); $datas = fgetcsv($fic, 1024, ',')) {
    $t = microtime(true);
    // Creating the User
    $u = new User();
    $u->insert();
    //    $u->password($datas['passwd'], false);
    $u->firstname(ucwords(strtolower(conv($datas[$firstname]))));
    $u->lastname(ucwords(strtolower(conv($datas[$lastname]))));
    //    $u->nickname(conv($datas['surnom']));
    $u->birthdate(new FrankizDateTime($datas[$birthdate]));
    if ($gender != null) {
        $u->gender($datas[$gender] == 'F' ? User::GENDER_FEMALE : User::GENDER_MALE);
    }
    if (!empty($datas[$email])) {
        $u->email($datas[$email]);
    }
    $u->skin('default');
    //setting default minimodules
    $u->select(UserSelect::minimodules());
    $u->copyMinimodulesFromUser(11794);
    /*    try {
            $u->cellphone(new Phone($datas['portable']));
        } catch(Exception $e) {
            echo 'Error for phone ' . $datas['portable'] . "\n";
        }*/
    //    $u->poly($datas['login']);
    // Linking with the room
    if ($room_id != null) {
        $room = $datas[$room_id];
        if (!empty($room)) {
Example #10
0
 /**
  * @param User $user
  *
  * @return bool|User
  */
 public function makeUser(User $user)
 {
     $id = $user->id();
     $email = $user->email();
     $avatar_link = $user->avatar();
     $display_name = $user->displayName();
     $refreshToken = $user->refreshToken();
     $this->database->query("INSERT INTO `users` (`id`, `email`, `avatar_link`, `display_name`, `refresh_token`) VALUES ({$id},'{$email}','{$avatar_link}','{$display_name}', '{$refreshToken}')");
     return $this->getUser($id);
 }
Example #11
0
  **/
 if ($form->validPassword($password, $confirmed_pw)) {
     //FONCTION DE HACHAGE
     $hasher = new PasswordHash(8, true);
     //1er argument : base-2 logarithm of the iteration count used for password stretching
     // 2eme argument : specifies the use of portable hashes // mieux vaut TRUE pour les password
     //C'EST ICI QU'ON HASH LE MOT DE PASSE
     $hash = $hasher->HashPassword($password);
     //fonction HashPassword incluse dans PasswordHash.php
     /*Instanciation d'un utilisateur*/
     $current_user = new User(array('name' => $_POST['name'], 'email' => $_POST['email'], 'password' => $hash, 'gender' => $_POST['gender'], 'description' => $_POST['description'], 'nationalityId' => $_POST['nationality'], 'cityId' => $_POST['city']));
     /**
      * Vérification du format de l'email
      * Si l'email n'est pas valide, message d'erreur et on supprime l'instance $user
      **/
     if (!$form->validEmail($current_user->email())) {
         echo '<p class="fail">' . _('Please enter a valid e-mail adress') . '</p>';
         unset($current_user);
     } else {
         if ($user_manager->exists($current_user->name(), 'name') != 0) {
             echo '<p class="fail"> "' . $current_user->name() . ' ' . _('is already taken') . '</p>';
             unset($current_user);
         } else {
             if ($user_manager->exists($current_user->email(), 'email') != 0) {
                 echo '<p class="fail"> "' . $current_user->email() . ' ' . _('is already taken') . '.</p>';
                 unset($current_user);
             } else {
                 $user_manager->add($current_user);
                 foreach (array_combine($_POST['languages_id'], $_POST['levels_id']) as $languageid => $levelid) {
                     if ($languageid != '') {
                         $spoken_language_manager->addLanguage($current_user->id(), $languageid, $levelid);
 /**
  *	Change user password
  *	Based on simple form.
  *
  *	@param	array	$payload
  */
 public static function changepassword($payload)
 {
     $user = User::email($payload->email)->resetToken($payload->reset_token)->first();
     # e-mail and token validation
     if (!$user) {
         throw new InvalidParameterException('Invalid e-mail address or reset link.');
     }
     # repeated password validation
     if ($payload->password !== $payload->password_confirmation) {
         throw new InvalidParameterException('The passwords do not match.');
     }
     # Update user
     $user->setPassword($payload->password)->setResetToken(null)->save();
 }
 /**
  * @param User $user
  *
  * @return UserSecurityToken
  */
 public static function fromUser(User $user)
 {
     return new self($user->id(), $user->email());
 }
Example #14
0
                         FROM  dev.temp_tol_2k10');
$users = $iter->total();
$k = 0;
while ($datas = $iter->next()) {
    $t = microtime(true);
    // Creating the User
    $u = new User();
    $u->insert();
    //    $u->password($datas['passwd'], false);
    $u->firstname(ucwords(strtolower(conv($datas['prenom']))));
    $u->lastname(ucwords(strtolower(conv($datas['nom']))));
    //    $u->nickname(conv($datas['surnom']));
    //    $u->birthdate(new FrankizDateTime($datas['date_nais']));
    $u->gender($datas['sexe'] == 'F' ? User::GENDER_FEMALE : User::GENDER_MALE);
    if (!empty($datas['email'])) {
        $u->email($datas['email']);
    }
    $u->skin('default');
    //setting default minimodules
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "birthday",     "COL_LEFT",   0 )', $u->id());
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "days",         "COL_LEFT",   1 )', $u->id());
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "ik",           "COL_LEFT",   2 )', $u->id());
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "qdj",          "COL_MIDDLE", 0 )', $u->id());
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "jtx",          "COL_MIDDLE", 1 )', $u->id());
    XDB::execute('INSERT INTO users_minimodules (uid,name,col,row) VALUES
                              ({?}, "groups",       "COL_RIGHT",  0 )', $u->id());
 /**
  * @param $facebook_id
  * @return JSON-formatted data of user
  */
 public function getUserInfo($facebook_id)
 {
     try {
         $user_id = User::getUserIdByFbId($facebook_id);
     } catch (Exception $e) {
         $user_id = null;
     }
     if ($user_id) {
         $full_name = User::full_name($user_id);
         $email = User::email($user_id);
         $phone = User::phone($user_id);
         $local_address = User::local_address($user_id);
         $details = ['name' => $full_name, 'email' => $email, 'phone' => $phone, 'address' => $local_address];
         return Response::json($details, 200, array(), JSON_PRETTY_PRINT);
     } else {
         return json_encode(['error' => 'You are not registered to FeatherQ.']);
     }
 }
Example #16
0
}
$html = '';
$info = '';
$server_info = '';
$user_id = Filter::input('user_id', 'post', 'int', true);
$ban_user = false;
if ($user_id === false) {
    $user_id = Filter::input('user_id', 'get', 'int', true);
}
if ($user_id) {
    $ban_user = new User($user_id);
}
if ($ban_user and $ban_user->id()) {
    $user_name = $ban_user->name();
    $user_gen = $ban_user->isFemale();
    $user_mail = $ban_user->email();
    $user_ip = $ban_user->ip();
    $user_lvl = $ban_user->lvl();
} else {
    $ban_user = false;
}
if ($do == 'gettheme') {
    $id = Filter::input('sid', 'get', 'string', true);
} else {
    $id = Filter::input('sid', 'get', 'int', true);
}
function RatioList($selectid = 1)
{
    $html_ratio = '<option value="1" ' . (1 == $selectid ? 'selected' : '') . '>64x32 | 22x17</option>';
    for ($i = 2; $i <= 32; $i = $i + 2) {
        $html_ratio .= '<option value="' . $i . '" ' . ($i == $selectid ? 'selected' : '') . '>' . 64 * $i . 'x' . 32 * $i . ' | ' . 22 * $i . 'x' . 17 * $i . '</option>';
Example #17
0
<?php

require 'classes/DB.php';
require 'classes/Validator.php';
require 'classes/User.php';
$db = new DB();
$user = new User();
$notSet = Validator::getPostVariablesWhichAreNotSet(array('ue', 'name', 'email', 'tel', 'password'));
if (count($notSet) === 1 && $notSet['tel'] || count($notSet) === 0) {
    $user->ue($_POST['ue']);
    $user->name($_POST['name']);
    $user->email($_POST['email']);
    if (!$notSet['tel']) {
        $user->tel($_POST['tel']);
    }
    $user->password($_POST['password']);
} else {
    echo json_encode($notSet);
    exit;
}
if (!Validator::userIsValid($user)) {
}
$occupiedUserAttributes = array();
if (count($occupiedUserAttributes = $db->getOccupiedUserAttributes($user->ue(), $user->name(), $user->email())) === 0) {
    $db->registerUser($user);
    echo '{"test": "true"}';
} else {
    echo json_encode($occupiedUserAttributes);
}