Esempio n. 1
0
 public function editDo($data)
 {
     $password = $data['password'];
     if ($password == '') {
         $post = array('username' => $data['username'], 'type' => $data['type']);
         $this->db->update('user', $post, "`id` = {$data['id']}");
     } else {
         $post = array('username' => $data['username'], 'password' => jream\Hash::create('sha256', $password, HASH_PASSWORD_KEY), 'type' => $data['type']);
         $this->db->update('user', $post, "`id` = {$data['id']}");
     }
 }
Esempio n. 2
0
 public function go()
 {
     $sth = $this->db->prepare("select id, username, password,type from user \n\t\twhere username = :username and password = :password");
     $sth->execute(array(':username' => $_POST['username'], ':password' => jream\Hash::create('sha256', $_POST['password'], HASH_PASSWORD_KEY)));
     $d = $sth->fetch();
     $count = $sth->rowCount();
     if ($count > 0) {
         Session::start();
         Session::set('id', $d['id']);
         Session::set('username', $d['username']);
         Session::set('type', $d['type']);
         Session::set('loggedIn', true);
         header('location:' . URL);
     } else {
         header('location:' . URL . 'login');
     }
 }
Esempio n. 3
0
<?php

/**
 * @author		Jesse Boyer <*****@*****.**>
 * @copyright	Copyright (C), 2011-12 Jesse Boyer
 * @license		GNU General Public License 3 (http://www.gnu.org/licenses/)
 *				Refer to the LICENSE file distributed within the package.
 *
 * @link		http://jream.com
 */
require_once '../jream/autoload.php';
new jream\Autoload('../jream/');
new jream\Input();
jream\Hash::create('sha1', 'hey');
new jream\Output();
new jream\Registry();
$config = array('type' => 'mysql', 'host' => 'localhost', 'name' => 'jream_test', 'user' => 'root', 'pass' => '');
$db = new jream\Database($config);
new jream\Crud($db);
Esempio n. 4
0
 *
 * @link		http://jream.com
 */
require_once '../jream/autoload.php';
new jream\Autoload('../jream/');
echo "<b>Without Salt</b>" . PHP_EOL;
foreach (hash_algos() as $algo) {
    echo "<pre>";
    echo $algo . ": " . jream\Hash::create($algo, 'password') . PHP_EOL;
    echo "</pre>";
}
echo PHP_EOL;
echo "<b>With Salt</b>" . PHP_EOL;
foreach (hash_algos() as $algo) {
    echo "<pre>";
    echo $algo . ": " . jream\Hash::create($algo, 'password', 'secret_salted_string!') . PHP_EOL;
    echo "</pre>";
}
//jream\Output::success('hello');
//jream\Output::json('hello');
?>


</div>
<!-- end:Wrap -->

<footer>
	(C) 2011 - 2012 Jesse Boyer &lt;http://jream.com&gt;
</footer>

</body>