예제 #1
0
 public function run()
 {
     $this->config['path'] = $this->config['path'] == '' ? '' : DS . $this->config['path'];
     $path = RES_PATH . 'upload' . str_replace('/', DS, $this->config['path']) . DS;
     $name = gen_hash() . '.' . $this->file['ext'];
     if (move_uploaded_file($this->file['tmp_name'], $path . $name)) {
         return $name;
     }
     return false;
 }
예제 #2
0
 public function request_recovery($email)
 {
     $where = array('email' => $email);
     $time = '+ 1 days';
     $time = date('Y-m-d H:i:s', strtotime($time));
     $update = array('recovery_code' => gen_hash(), 'recovery_time' => $time);
     if (!$this->model->get($this->settings['sql_table'], 'id', $where)) {
         return false;
     }
     return $this->model->update($this->settings['sql_table'], $update, $where);
 }
예제 #3
0
<?php

$login = $DB->real_escape_string($_POST['login']);
$password = $DB->real_escape_string(gen_hash($_POST['password']));
$result = $DB->query("SELECT klient_id FROM klient WHERE login='******' AND haslo='{$password}'") or DBdie($DB->error);
if ($result && ($row = $result->fetch_row())) {
    $_SESSION['klient_id'] = $row[0];
    if (isset($_SESSION['pracownik_id'])) {
        unset($_SESSION['pracownik_id']);
    }
    putMessage('Zostałeś zalogowany');
    header("Location: {$dir}glowna.html");
    exit;
} else {
    putMessage('Niewłaściwy login lub hasło');
}
예제 #4
0
파일: update.php 프로젝트: herbix/mdedit.in
<?php

require_once 'config.php';
require_once 'include/func.php';
require_once 'include/template.php';
if (!isset($_COOKIE['hash']) || !isset($_POST['content'])) {
    exit;
}
$hash = $_COOKIE['hash'];
if (!preg_match('/^[a-z0-9]{32}$/', $hash)) {
    setcookie('hash', gen_hash(), time() + 365 * 86400);
    exit;
}
$filename = get_file_from_hash($hash);
if ($template != $_POST['content']) {
    mkdir(dirname($filename), 0777, true);
    file_put_contents($filename, $_POST['content']);
}
예제 #5
0
파일: index.php 프로젝트: herbix/mdedit.in
<?php

require_once 'config.php';
require_once 'include/func.php';
require_once 'include/template.php';
define('FLAG_DEFAULT', 7);
if (!isset($_COOKIE['hash'])) {
    $hash = gen_hash();
} else {
    $hash = $_COOKIE['hash'];
    if (!preg_match('/^[a-z0-9]{32}$/', $hash)) {
        $hash = gen_hash();
    }
}
$flag = isset($_COOKIE['flag']) ? $_COOKIE['flag'] : FLAG_DEFAULT;
setcookie('hash', $hash, time() + 365 * 86400);
$filename = get_file_from_hash($hash);
$mkfile = !file_exists($filename);
if ($mkfile) {
    $text = $template;
} else {
    $text = file_get_contents($filename);
}
spl_autoload_register(function ($class) {
    require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim('include\\' . $class, '\\')) . '.php';
});
use Michelf\MarkdownExtra;
$parser = new MarkdownExtra();
$html = $parser->transform($text);
$html = str_replace('<table>', '<table class="table">', $html);
?>
예제 #6
0
파일: index.php 프로젝트: nham/pungent
function auth_routine($mode, $uniqid, $ident) {
  if(($uid = user_exists($mode, $uniqid)) === FALSE) {
    $uid = create_new_user($mode, $uniqid);
  }

  $hash = gen_hash();

  prune_hashes($uid);
  update_ident($uid, $ident);
  store_hash($uid, $hash);

  setcookie("user", $hash, time()+86400*365*5, '/');
  goToApp();
}