Izartu  0.0 Initial release
Web bookmark manager based on tags.
 All Data Structures Files Functions Variables Enumerations
User.php
Go to the documentation of this file.
00001 <?php
00002 #  Izartu
00003 #
00004 #  Copyright © 2011-2012 Javier Beaumont <contact@javierbeaumont.org>
00005 #
00006 #  This file is part of Izartu.
00007 #
00008 #  Izartu is free software: you can redistribute it and/or modify
00009 #  it under the terms of the GNU Affero General Public License as
00010 #  published by the Free Software Foundation, either version 3 of the
00011 #  License, or (at your option) any later version.
00012 #
00013 #  Izartu is distributed in the hope that it will be useful,
00014 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016 #  GNU Affero General Public License for more details.
00017 #
00018 #  You should have received a copy of the GNU Affero General Public License
00019 #  along with Izartu. If not, see <http://www.gnu.org/licenses/>.
00020 
00031 trait User {
00032 
00038   static function search($email, $password) {
00039     $query = $db->prepare('SELECT `id` FROM `user` WHERE `email` = :email AND `hash` = :hash');
00040     $query->bindParam(':email', $email, PDO::PARAM_STR, 12);
00041     $hash = hash('sha512', $password);
00042     $query->bindParam(':hash', $hash, PDO::PARAM_STR, 128);
00043     $query->execute();
00044     return $query->rowCount();
00045   }
00046 
00052   static function ask($email) {
00053     $query = $db->prepare('SELECT `id` FROM `user` WHERE `email` = :email');
00054     $query->bindParam(':email', $email, PDO::PARAM_STR, 12);
00055     $query->execute();
00056     return $query->rowCount();
00057   }
00058 
00059 }
 All Data Structures Files Functions Variables Enumerations