Esempio n. 1
0
<?php

require_once "../private/lib/utilities.php";
$data = Seed::generateSeed();
$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();
Esempio n. 2
0
        $_SESSION['yel']['member']['hash'] = "";
        $response['errors'] = array('error' => 'bad_login');
        echo $xml_dom->get_xml_from_array($response);
        exit;
    }
    $response['login'] = array('status' => 'ok');
    echo $xml_dom->get_xml_from_array($response);
    exit;
}
if ($_POST['action'] == 'linkedin_login') {
    $id = $_POST['id'];
    $hash = $_POST['hash'];
    $sid = $_POST['sid'];
    $linkedin_id = $_POST['linkedin_id'];
    if (empty($sid)) {
        $seed = Seed::generateSeed();
        $hash = sha1($id . md5($linkedin_id) . $seed['login']['seed']);
        $sid = $seed['login']['id'];
    }
    $_SESSION['yel']['member']['id'] = $id;
    $_SESSION['yel']['member']['hash'] = $hash;
    $_SESSION['yel']['member']['sid'] = $sid;
    $_SESSION['yel']['member']['linkedin_id'] = $linkedin_id;
    header('Content-type: text/xml');
    $member = new Member($id, $sid);
    // 1. find whether this member exists, from the ID
    $criteria = array('columns' => "COUNT(*) AS is_exists", 'match' => "email_addr = '" . $id . "'");
    $result = $member->find($criteria);
    if ($result[0]['is_exists'] != '1') {
        // sign the member up
        $joined_on = today();
Esempio n. 3
0
<?php

require_once dirname(__FILE__) . "/../private/lib/utilities.php";
header('Content-type: text/xml');
$xml_dom = new XMLDOM();
if ($GLOBALS['protocol'] == 'https') {
    if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
        $response['errors'] = array('error' => 'insecure');
        echo $xml_dom->get_xml_from_array($response);
        exit;
    }
}
/*
    Generate the seed and return the ID and SEED in XML format. 
    A seed and a seed id are required for web-based authentication.
    The SHA1 hash is generated by concatenating id, md5(password) and seed. 
*/
$response = Seed::generateSeed();
if ($response === false) {
    // Return an error XML if there is a problem.
    $response['errors'] = array('error' => 'An error occured while generating seed.');
}
echo $xml_dom->get_xml_from_array($response);