예제 #1
0
파일: employer.php 프로젝트: pamalite/yel
$sid = $data['login']['id'];
$seed = $data['login']['seed'];
$uid = 'acme123';
$password = '******';
$hash = sha1($uid . md5($password) . $seed);
echo $sid . ": " . $seed . "<br>";
echo $hash . "<br>";
$employer = new Employer($uid, $sid);
?>
<p style="font-weight: bold;">Logging in... </p><p><?php 
if ($employer->isRegistered($hash)) {
    if ($employer->setSessionWith($hash)) {
        echo "Success";
    }
}
if (!$employer->isLoggedIn($hash)) {
    echo "failed";
    exit;
}
?>
</p><p style="font-weight: bold;">Update my details... </p><p><?php 
$old_data = $employer->get();
echo "Before...<br><br>";
echo "<pre>";
print_r($old_data);
echo "</pre><br><br>";
$data = array();
$data['password'] = md5('new_passwd');
$data['name'] = 'Avatar';
$data['phone_num'] = '+618-8463-2238';
$data['address'] = 'Lala Land';
예제 #2
0
파일: index.php 프로젝트: pamalite/yel
<?php

require_once dirname(__FILE__) . "/../private/lib/utilities.php";
session_start();
// Check whether the required session has been created.
// If not, create it. The user may come to this page directly.
if (!isset($_SESSION['yel'])) {
    initialize_session();
}
// Check whether the employer session has been created.
// If not, redirect it to the login page.
if (!isset($_SESSION['yel']['employer'])) {
    redirect_to('login.php');
}
// Check whether the id and sha1 sessions have been set.
// If not, redirect it to the login page.
if (empty($_SESSION['yel']['employer']['id']) || empty($_SESSION['yel']['employer']['hash']) || empty($_SESSION['yel']['employer']['sid'])) {
    redirect_to('login.php');
}
// Check whether the employer is logged in
$employer = new Employer($_SESSION['yel']['employer']['id'], $_SESSION['yel']['employer']['sid']);
if (!$employer->isLoggedIn($_SESSION['yel']['employer']['hash'])) {
    redirect_to('login.php');
}
// All checks seem to be good.
redirect_to('resumes.php');