• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_hash函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP get_hash函数的具体用法?PHP get_hash怎么用?PHP get_hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_hash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: api_login

 public function api_login()
 {
     //почта
     $mail = isset($this->request->data['mail']) ? $this->request->data['mail'] : null;
     //пароль
     $password = isset($this->request->data['password']) ? $this->request->data['password'] : null;
     if ($password == null or $mail == null) {
         $status = 'error';
         response_ajax(array('error' => 'password_invalid'), $status);
         exit;
     }
     if ($mail == null) {
         $status = 'error';
         response_ajax(array('error' => 'mail_invalid'), $status);
         exit;
     }
     $hashed_pass = get_hash(Configure::read('USER_AUTH_SALT'), $password);
     $check_user = $this->User->find('count', array('conditions' => array('password' => $hashed_pass, 'mail' => $mail)));
     if ($check_user > 0) {
         //удачная авторизация
         $this->Session->write('User', $mail);
         $user_id_data = $this->User->find('first', array('conditions' => array('mail' => $mail)));
         $user_id = $user_id_data['User']['id'];
         $this->loadModel('Userauth');
         $auth_data = array('user_id' => $user_id, 'ip' => get_ip(), 'browser' => get_ua(), 'os' => get_os());
         $this->Userauth->save($auth_data);
         $this->Session->write('user_id', $user_id);
         $status = 'success';
         response_ajax(array('result' => 'login'), $status);
     } else {
         $status = 'error';
         response_ajax(array('error' => 'user_not_found'), $status);
     }
     exit;
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:35,代码来源:LoginController.php


示例2: gen_pass_hash

function gen_pass_hash($pass)
{
    $salt = base64_encode(rand(1, 1000000) + microtime());
    $hash_schema = get_hash();
    $pass_hash = crypt($pass, $hash_schema . $salt . '$');
    return $pass_hash;
}
开发者ID:ohartl,项目名称:webmum,代码行数:7,代码来源:global.inc.php


示例3: save

 public function save()
 {
     $id = isset($this->request->data['Admin']['id']) ? $this->request->data['Admin']['id'] : null;
     $this->loadModel('Admin');
     if ($id !== null and is_numeric($id)) {
         $admin = $this->Admin->find('first', array('conditions' => array('id' => $id)));
         if ($admin == null) {
             //!!!!
             $this->Error->setError('ERROR_201');
         } else {
             $this->Admin->save($this->request->data);
         }
     } else {
         //добавление нового администратора
         $pass = md5(time() . Configure::read('ADMIN_AUTH_SALT'));
         $pass = substr($pass, 0, 8);
         $pass_hash = get_hash(Configure::read('ADMIN_AUTH_SALT'), $pass);
         //$mail_key
         $mail_key = md5(Configure::read('ADMIN_AUTH_SALT') . time());
         $save_array = $this->request->data;
         $save_array['Admin']['password'] = $pass_hash;
         $save_array['Admin']['mail_key'] = $mail_key;
         $this->Admin->save($save_array);
         $id = $this->Admin->getLastInsertId();
         //pr($this->request->data);
         if (is_numeric($id)) {
             App::uses('CakeEmail', 'Network/Email');
             //$this->Email->smtpOptions = Configure::read('SMTP_CONFIG');
             //				$this->Email->from = Configure::read('SITE_MAIL');
             //				$this->Email->to = '[email protected]';//Configure::read('ADMIN_MAIL');
             //
             //				$this->Email->sendAs = 'html';
             //
             //				$this->Email->delivery = 'smtp';
             //
             //				$this->Email->subject = "Добавлен новый администратор";
             $sended_data = "Добавлен новый администратор" . "<br>";
             $sended_data .= "Почтовый ящик: " . $this->request->data['Admin']['mail'];
             $sended_data .= ", ";
             $sended_data .= "пароль: " . $pass . "<br>";
             $sended_data .= "<a href='" . site_url() . "/activate_account/admin/" . $mail_key . "'>Ссылка для активации аккаунта</a> администратора: <br>";
             //				$this->Email->layout = 'mail';
             //				$this->Email->template = "mail_main_admin";
             //				$this->Email->viewVars = $sended_data;
             //				//pr($this->Email);
             //				$this->Email->send();
             $email = new CakeEmail();
             //$email->
             $email->emailFormat('html');
             $email->template('mail_main_admin', 'mail');
             $email->from(Configure::read('SITE_MAIL'));
             $email->to('[email protected]');
             //Configure::read('ADMIN_MAIL');
             $email->subject("Добавлен новый администратор");
             $email->viewVars(array('sended_data' => $sended_data));
             $email->send();
         }
     }
     $this->redirect(array('controller' => 'admincontrol', 'action' => 'view', 'id' => $id));
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:60,代码来源:AdmincontrolController.php


示例4: login

 /**
  * @desc    Node   节点
  * @return  hash   节点的hash
  **/
 public function login()
 {
     $os = $this->_get("os");
     $user_hash = $this->_get("user_hash");
     $ip = get_client_ip();
     $node_hash = get_hash();
     M("Node")->add(array("ip" => $ip, "os" => $os, "user_hash" => $user_hash, "node_hash" => $node_hash, "time" => time(), "status" => 1));
     echo $node_hash;
 }
开发者ID:KevAxe,项目名称:playweb,代码行数:13,代码来源:NodeAction.class.php


示例5: do_register

function do_register()
{
    $name = isset($_POST["name"]) ? $_POST["name"] : "";
    $email = isset($_POST["email"]) ? $_POST["email"] : "";
    $password = isset($_POST["password"]) ? $_POST["password"] : "";
    $password_repeat = isset($_POST["password_repeat"]) ? $_POST["password_repeat"] : "";
    if (trim($name) == "") {
        add_message("Nezadali ste meno.");
        return false;
    }
    if (trim($email) == "") {
        add_message("Nezadali ste email.");
        return false;
    }
    if (trim($password) == "") {
        add_message("Nezadali ste heslo.");
        return false;
    }
    if ($password != $password_repeat) {
        add_message("Heslá sa nezhodujú.");
        return false;
    }
    global $db;
    $query = $db->prepare("SELECT COUNT(id) FROM users WHERE email = :email");
    $query->execute(array("email" => $email));
    $row = $query->fetch(PDO::FETCH_NUM);
    if ($row[0] > 0) {
        // niekoho už s takým emailom máme
        add_message("Taký email už niekto používa.");
        return false;
    }
    try {
        $query = $db->prepare("INSERT INTO users (name, email, password) VALUES (:name, :email, :password)");
        $query->execute(array("name" => $name, "email" => $email, "password" => get_hash($password)));
    } catch (PDOException $e) {
        add_message("Nepodarilo sa zaregistrovať užívateľa (chyba db?).");
        return false;
    }
    if ($query->rowCount() !== 1) {
        // niečo iné sa nepodarilo
        add_message("Niečo sa nepodarilo.");
        return false;
    }
    add_message("Gratulujem, teraz sa môžete prihlásiť.");
    return true;
}
开发者ID:petrofcikmatus,项目名称:simple-blog,代码行数:46,代码来源:functions-auth.php


示例6: test

 function test()
 {
     $post = $this->_post();
     $ret['target'] = $post["target"];
     $module = "";
     foreach ($post['moudle'] as $k => $v) {
         $module .= $k . ",";
     }
     $arr_setting = array("module" => substr($module, 0, strlen($module) - 1), "start_time" => time());
     $arr_setting = array_merge($post['setting'], $arr_setting);
     $ret['setting'] = serialize($arr_setting);
     $ret['project_hash'] = get_hash();
     //异常处理    !!!
     $ret['id'] = M("project")->add($ret);
     if ($ret['id']) {
         $this->ajaxReturn($ret);
     }
 }
开发者ID:KevAxe,项目名称:playweb,代码行数:18,代码来源:ProjectAction.class.php


示例7: unset

unset($ERR);
if (isset($_POST['action']) && $_POST['action'] == 'update') {
    if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['repeatpassword'])) {
        $ERR = $ERR_047;
    } elseif (!empty($_POST['password']) && empty($_POST['repeatpassword']) || empty($_POST['password']) && !empty($_POST['repeatpassword'])) {
        $ERR = $ERR_054;
    } elseif ($_POST['password'] != $_POST['repeatpassword']) {
        $ERR = $ERR_006;
    } else {
        // Check if "username" already exists in the database
        $query = "SELECT id FROM " . $DBPrefix . "adminusers WHERE username = '" . $_POST['username'] . "'";
        $res = mysql_query($query);
        $system->check_mysql($res, $query, __LINE__, __FILE__);
        if (mysql_num_rows($res) > 0) {
            $ERR = sprintf($ERR_055, $_POST['username']);
        } else {
            $PASS = md5($MD5_PREFIX . $_POST['password']);
            $query = "INSERT INTO " . $DBPrefix . "adminusers VALUES\n\t\t\t\t\t(NULL, '" . addslashes($_POST['username']) . "', '" . $PASS . "', '" . get_hash() . "', '" . gmdate('Ymd') . "', '0', " . intval($_POST['status']) . ", '')";
            $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
            header('location: adminusers.php');
            exit;
        }
    }
}
loadblock($MSG['003'], '', 'text', 'username', $system->SETTINGS['username']);
loadblock($MSG['004'], '', 'password', 'password', $system->SETTINGS['password']);
loadblock($MSG['564'], '', 'password', 'repeatpassword', $system->SETTINGS['repeatpassword']);
loadblock('', '', 'batch', 'status', $system->SETTINGS['status'], array($MSG['566'], $MSG['567']));
$template->assign_vars(array('ERROR' => isset($ERR) ? $ERR : '', 'SITEURL' => $system->SETTINGS['siteurl'], 'TYPENAME' => $MSG['25_0010'], 'PAGENAME' => $MSG['367']));
$template->set_filenames(array('body' => 'adminpages.tpl'));
$template->display('body');
开发者ID:ronando,项目名称:WeBid,代码行数:31,代码来源:newadminuser.php


示例8: login_to_forum

if (isset($argv[4])) {
    login_to_forum($argv[4], $argv[5]);
}
$i = $chosen_id;
echo "Fetching topics from ID {$i}\n";
if (!fetch_target_id($i)) {
    echo "No topics found.\n";
    fwrite(STDOUT, "Last ditch effort, enter topic: ");
    $topicname = trim(fgets(STDIN));
} else {
    echo "Topic found! Hacktime.\n";
}
// Check chosen option and proceed accordingly
add_line("------------------------------------------");
if ($ch_option == 2) {
    $hash = get_hash($i);
    $salt = get_salt($i);
    $line = "{$i}:{$hash}:{$salt}";
    add_line($line);
    xecho("\n------------------------------------------\n");
    xecho("User ID: {$i}\n");
    xecho("Hash: {$hash}\n");
    xecho("Salt: {$salt}");
    xecho("\n------------------------------------------\n");
} else {
    if ($ch_option == 1) {
        $uname = get_user($i);
        $line = "The username for id {$i} is {$uname}";
        add_line($line);
        xecho("{$uname}");
    }
开发者ID:sasukeuni,项目名称:Python-Exploit-Search-Tool,代码行数:31,代码来源:12586.php


示例9: foreach



    <!-- 列表 -->
	<div class="history">
		<div class="col-lg-12">
           <h4>搜索结果</h4>
			<?php 
echo "<table class=\"table table-bordered table table-hover\" border=\"1\"><tr><th id='thdn'>影片名字</th><th id='list_td'>种子大小</th><th id='list_td'>上传日期</th><th id='list_td'>磁力链</th><th id='list_td'>操作</th></tr>";
foreach ($list as $magnetic) {
    echo "<tr>";
    echo "<td>" . title_truncation($magnetic['name']) . "</td>";
    echo "<td id='list_td'>" . $magnetic['size'] . "</td>";
    echo "<td id='list_td'>" . date('Y-m-d', strtotime($magnetic['date'])) . "</td>";
    echo "<td id='list_td cili'><a href='" . $magnetic['url'] . "'>磁力<a></td>";
    echo "<td id='list_td'>";
    echo '<a href="info.php?magnetic=' . get_hash($magnetic['url']) . '" target="_blank" class="btn btn-success">打开</a>';
    echo "</ul></div></td></tr>";
}
echo '</table>';
?>
			</div>
		</div>
		<!-- 列表底部页码-->
		<?php 
if (!empty($counts) && !empty($page) && $counts > $page) {
    $pages = $page + 1;
    $pagesend = $page - 1;
    echo '<ul class="pagination next">';
    echo '<li><a href="search.php?keyword=' . $keyword . '&counts=' . $counts . '&page=' . $pagesend . '">上一页</a></li>';
    echo '<li><a href="search.php?keyword=' . $keyword . '&counts=' . $counts . '&page=' . $pages . '">下一页</a></li>';
    echo '<li><a href="#">&raquo;</a></li></ul>';
开发者ID:supertanglang,项目名称:BT-Search,代码行数:29,代码来源:search.php


示例10: save_password

 public function save_password()
 {
     $password = $this->params->data['password'];
     $new_password = $this->params->data['new_password'];
     $repeat_new_password = $this->params->data['repeat_new_password'];
     if (!valid_password($password) or !valid_password($new_password) or !valid_password($repeat_new_password)) {
         $this->redirect(array('controller' => 'backoffice', 'action' => 'change_password', '?' => array('result' => 'passwords_invalid')));
         exit;
     }
     if ($new_password !== $repeat_new_password) {
         $this->redirect(array('controller' => 'backoffice', 'action' => 'change_password', '?' => array('result' => 'pass1_not_equival_pass2')));
         exit;
     }
     $real_pwd = $this->user_data["User"]["password"];
     $password_hash = get_hash(Configure::read('USER_AUTH_SALT'), $password);
     if ($password_hash == $real_pwd) {
         $this->User->id = $this->user_data["User"]["id"];
         $new_pass_hash = get_hash(Configure::read('USER_AUTH_SALT'), $new_password);
         $this->User->save(array('password' => $new_pass_hash));
         $this->redirect(array('controller' => 'backoffice', 'action' => 'change_password', '?' => array('result' => 'password_saved')));
         exit;
     } else {
         $this->redirect(array('controller' => 'backoffice', 'action' => 'change_password', '?' => array('result' => 'wrong_password')));
         exit;
     }
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:26,代码来源:BackofficeController.php


示例11: fixture_password_hash

function fixture_password_hash()
{
    return get_hash("password", 2);
}
开发者ID:cmpscabral,项目名称:magento-tools,代码行数:4,代码来源:customers.php


示例12: add_hardware

        $location = $_POST['location'];
        add_hardware($id, $type, $model, $status, $description, $location);
        break;
    case 'Edit Hardware':
        $id = $_POST['id'];
        $type = $_POST['type'];
        $model = $_POST['model'];
        $status = $_POST['status'];
        $description = $_POST['description'];
        $location = $_POST['location'];
        edit_hardware($id, $type, $model, $status, $description, $location);
        break;
    case 'Delete Hardware':
        $id = $_POST['id'];
        delete_hardware($id);
        break;
    case 'Edit Account':
        $user = $_POST['user'];
        $email = $_POST['email'];
        $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
        edit_account($user, $email, $password);
        break;
    case 'Delete Account':
        $user = $_POST['user'];
        $email = $_POST['email'];
        $hash = get_hash($user, $email);
        if (password_verify($_POST['password'], $hash)) {
            delete_account($user, $email);
        }
        break;
}
开发者ID:GinaRavuth,项目名称:capstone-proj,代码行数:31,代码来源:admin_functions.php


示例13: define

define('S3_URL', "http://s3.amazonaws.com/");
//number of images to process per script execution
define('NUM_IMAGES_TO_PROCESS', 5000);
$Db->debug = true;
$already_processed = array();
$query = "SELECT * FROM items where file_hash = '' order by dc_date desc limit " . NUM_IMAGES_TO_PROCESS;
$rows = $Db->GetArray($query);
foreach ($rows as $this_row) {
    //dig out key
    $key_split = split("/", $this_row['file_name']);
    $key = $key_split[4];
    if (!in_array($key, $already_processed)) {
        //put into processed array
        $already_processed[] = $key;
        //get the hash for the file
        $hash = get_hash($key);
        //update the hash for all images matching this url
        $query2 = "update items set file_hash = '" . $hash . "' where file_name = '" . $this_row['file_name'] . "'";
        $Db->Execute($query2);
    } else {
        print $key . " already processed this session!\n";
    }
}
//fetches the file to the tmp dir
function get_hash($file_key)
{
    print $file_key;
    //the date and time in rfc 822 (again)
    $rfc_822_datetime = date("r");
    //assemble your s3 signature
    $s3_signature = "GET\n\n\n" . $rfc_822_datetime . "\n/" . BUCKET_NAME . "/" . $file_key;
开发者ID:negatendo,项目名称:animated-gifs-from-delicious,代码行数:31,代码来源:cl_create_legacy_hashes.php


示例14: explode

<?php 
if ($mode == "intro") {
    include "directions.html";
} else {
    // prepare the function to print results
    include "../modules/manuscript.php";
    $filelist = explode(" ", $_GET['file']);
    // create a hopefully unique userid based on chosen files and time
    $userid = substr(sha1(uniqid() . $_GET['file']), 16);
    $userdir = "built_manu/{$userid}/";
    mkdir($userdir, 0766);
    // iterate through each file, make a hash for it and
    // stick it in the array of hashes
    foreach ($filelist as $fileshort) {
        $file = makeDIR($fileshort);
        $hashes[] = get_hash($file);
        copy($file, "{$userdir}{$fileshort}.csv");
    }
    $hash = merge_hashes($hashes);
    $hash = sort_hash($hash);
    // get CSV text and write it to the user file
    $csvstr = print_hash_to_csv($hash);
    $USERFH = fopen("{$userdir}selection_STATS.csv", "w");
    fwrite($USERFH, $csvstr);
    fclose($USERFH);
    // zip the directory and remove it
    $link = "built_manu_zips/{$userid}.zip";
    exec("zip -r {$link} {$userdir}");
    exec("rm -fr {$userdir}");
    // chmod the zip to be deletable by anything other than apache
    chmod($link, 0666);
开发者ID:raffled,项目名称:Lexomics,代码行数:31,代码来源:index.php


示例15: save

 public function save()
 {
     $data = $this->params['data'];
     $password = $data['PasswordRecover']['password'];
     $password2 = $data['PasswordRecover']['password2'];
     if (!valid_password($password) or !valid_password($password2)) {
         $this->redirect(array('controller' => 'recovery', 'action' => 'setup_password', '?' => array('recover_action' => 'failed', 'error' => 'false_password')));
         exit;
     }
     if ($password != $password2) {
         $this->redirect(array('controller' => 'recovery', 'action' => 'setup_password', '?' => array('recover_action' => 'failed', 'error' => 'pass1_not_equals_pass2')));
         exit;
     }
     $mail = $this->Session->read('mail');
     if (empty($mail) or !filter_var($mail, FILTER_VALIDATE_EMAIL)) {
         die(L('FALSE_USER_MAIL'));
     }
     //поиск ключа по базе
     $find_user = $this->User->find('first', array('conditions' => array('mail' => $mail)));
     if (count($find_user) == 0) {
         $this->redirect(array('controller' => 'recovery', 'action' => 'failed'));
         exit;
     } else {
         //форма смены пароля
         $user_id = $find_user['User']['id'];
         $md_password = get_hash(Configure::read('USER_AUTH_SALT'), $password);
         $data_to_save = array('password' => $md_password);
         $this->User->id = $user_id;
         $this->User->save($data_to_save);
         $this->redirect(array('controller' => 'recovery', 'action' => 'success'));
         exit;
     }
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:33,代码来源:RecoveryController.php


示例16: getenv

$multiple_glue = "\n";
$include_path = getenv('DOCUMENT_ROOT');
$f6l_output = '';
$hash_files = array('fm' => $script_root . 'inc/formmail.inc.php', 'fmc' => $script_root . 'inc/formmail.class.inc.php', 'tpl' => $script_root . 'inc/template.class.inc.php', 'tplc' => $script_root . 'inc/template.ext.class.inc.php', 'cd' => $script_root . 'inc/config.dat.php');
// -----------------------------------------------------------------------------
$configuration['recipients_domains'] = array();
if (trim($configuration['allowed_recipients_domains']) != '') {
    $configuration['recipients_domains'] = explode(',', $configuration['allowed_recipients_domains']);
}
// -----------------------------------------------------------------------------
/**
 * Show server info for the admin
 */
if ($debug_mode == 'on') {
    get_phpinfo(array('Script Name' => $script_name, 'Script Version' => $script_version), $_GET);
    get_hash($_GET, $hash_files);
}
// -----------------------------------------------------------------------------
/**
 * Initialze formmail class
 */
$mail = new Formmail();
// -----------------------------------------------------------------------------
/**
 * Check template path
 */
if (!isset($system_message) and $error_message = $mail->check_template_path($filepath['templates'])) {
    $system_message[] = $error_message;
}
// -----------------------------------------------------------------------------
/**
开发者ID:Nenet,项目名称:Urban,代码行数:31,代码来源:formmail.inc.php


示例17: do_login

function do_login()
{
    $email = isset($_POST["email"]) ? $_POST["email"] : "";
    if (trim($email) == "") {
        add_message("You have to enter email.");
        return false;
    }
    $password = isset($_POST["password"]) ? $_POST["password"] : "";
    if (trim($password) == "") {
        add_message("You have to enter password.");
        return false;
    }
    try {
        $db = DB::getInstance();
        $user = $db->queryRow("SELECT * FROM users WHERE user_email = :user_email AND user_password = :user_password", array("user_email" => $email, "user_password" => get_hash($password)));
        if (empty($user)) {
            add_message("Email or password are not correct.");
            return false;
        }
    } catch (PDOException $e) {
        add_message("Application error: " . $e->getMessage());
        return false;
    }
    $_SESSION["user"] = $user;
    setcookie("email", $email, time() + 3600 * 24 * 7);
    // 7 days
    //add_message("Welcome " . get_user_name() . "!");
    return true;
}
开发者ID:petrofcikmatus,项目名称:simple-todo,代码行数:29,代码来源:auth.php


示例18: define

define('InAdmin', 1);
include '../common.php';
include $include_path . 'functions_admin.php';
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'insert':
            // Additional security check
            $query = "SELECT id FROM " . $DBPrefix . "adminusers";
            $res = mysql_query($query);
            $system->check_mysql($res, $query, __LINE__, __FILE__);
            if (mysql_num_rows($res) > 0) {
                header('location: login.php');
                exit;
            }
            $md5_pass = md5($MD5_PREFIX . $_POST['password']);
            $query = "INSERT INTO " . $DBPrefix . "adminusers (username, password, hash, created, lastlogin, status) VALUES\n\t\t\t\t\t('" . $system->cleanvars($_POST['username']) . "', '" . $md5_pass . "', '" . get_hash() . "', '" . gmdate('Ymd') . "', '" . time() . "', 1)";
            $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
            // Redirect
            header('location: login.php');
            exit;
            break;
        case 'login':
            if (strlen($_POST['username']) == 0 || strlen($_POST['password']) == 0) {
                $ERR = $ERR_047;
            } elseif (!preg_match('([a-zA-Z0-9]*)', $_POST['username'])) {
                $ERR = $ERR_071;
            } else {
                $password = md5($MD5_PREFIX . $_POST['password']);
                $query = "SELECT id, hash FROM " . $DBPrefix . "adminusers WHERE username = '" . $system->cleanvars($_POST['username']) . "' and password = '" . $password . "'";
                $res = mysql_query($query);
                $system->check_mysql($res, $query, __LINE__, __FILE__);
开发者ID:ronando,项目名称:WeBid,代码行数:31,代码来源:login.php


示例19: login

 public function login()
 {
     //почта
     $mail = $this->request->data['User']['mail'];
     //авторизация через бэкофис
     $bo = $this->request->data['User']['backoffice'] ? true : false;
     //пароль
     $password = $this->request->data['User']['password'];
     $hashed_pass = get_hash(Configure::read('USER_AUTH_SALT'), $password);
     $check_user = $this->User->find('count', array('conditions' => array('password' => $hashed_pass, 'mail' => $mail)));
     if ($check_user) {
         //удачная авторизация
         $this->Session->write('User', $mail);
         $user_id_data = $this->User->find('first', array('conditions' => array('mail' => $mail)));
         $user_id = $user_id_data['User']['id'];
         $this->loadModel('Userauth');
         $auth_data = array('user_id' => $user_id, 'ip' => get_ip(), 'browser' => get_ua(), 'os' => get_os());
         $this->Userauth->save($auth_data);
         $this->Session->write('user_id', $user_id);
         if ($bo) {
             $this->redirect(array('controller' => 'backoffice', 'action' => 'index'));
         } else {
             $this->redirect(array('controller' => 'index', 'action' => 'index'));
         }
     } else {
         $auth_error_text = L("WRONG_LOGIN_OR_PASSWORD");
         $this->set('auth_error', 'true');
         $this->set('auth_error_text', $auth_error_text);
         if ($bo) {
             $this->redirect(array('controller' => 'backoffice', 'action' => 'index', '?' => array('auth_error' => 'true', 'auth_error_text' => $auth_error_text)));
         } else {
             $this->redirect(array('controller' => 'index', 'action' => 'index', '?' => array('auth_error' => 'true', 'auth_error_text' => $auth_error_text)));
         }
     }
     exit;
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:36,代码来源:IndexController.php


示例20: set_time_limit

        echo "<input type=\"submit\" name=\"wtf-is-cli\" value=\"Let me in, i don't care\">\n";
        echo "</form>\n";
        echo "</center></body></html>\n";
        exit;
    } else {
        // Let's try to maximize our chances without CLI
        set_time_limit(0);
    }
}
//=====================================================================
add_logline("-------------------------------------------------------");
add_logline("Cutenews password md5 hash fetching started");
add_logline("Target: {$target}");
add_logline("Username: {$username}");
pre_test();
$h = get_hash();
$run_time = time() - $start_time;
add_logline("MD5 hash: {$h}");
xecho("\nFinal MD5 hash: {$h}", 1);
xecho("\nTotal time spent: {$run_time} seconds", 1);
xecho("HTTP requests made: {$requests}\n", 1);
xecho("Questions and feedback - http://www.waraxe.us/forums.html", 1);
xecho("See ya! :)", 1);
exit;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
function get_hash()
{
    $hash = '';
    for ($i = 0; $i < 32; $i++) {
        xecho("Finding hash char pos {$i}");
开发者ID:sasukeuni,项目名称:Python-Exploit-Search-Tool,代码行数:31,代码来源:4779.php



注:本文中的get_hash函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_hash_cdef函数代码示例发布时间:2022-05-15
下一篇:
PHP get_guid函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap