Пример #1
0
        exit;
    }
    foreach ($result as $i => $row) {
        $result[$i]['employer'] = htmlspecialchars_decode($row['employer']);
    }
    $response = array('employers' => array('employer' => $result));
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array($response);
    exit;
}
if ($_POST['action'] == 'reset_password') {
    $new_password = generate_random_string_of(6);
    $data = array();
    $data['password'] = md5($new_password);
    $employer = new Employer($_POST['id']);
    if (!$employer->update($data, true)) {
        echo "ko";
        exit;
    }
    $query = "SELECT email_addr FROM employers WHERE id = '" . $_POST['id'] . "' LIMIT 1";
    $mysqli = Database::connect();
    $result = $mysqli->query($query);
    $lines = file(dirname(__FILE__) . '/../private/mail/employer_password_reset_admin.txt');
    $message = '';
    foreach ($lines as $line) {
        $message .= $line;
    }
    $message = str_replace('%user_id%', $_POST['id'], $message);
    $message = str_replace('%temporary_password%', $new_password, $message);
    $subject = "Employer Password Reset";
    $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
Пример #2
0
$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';
$data['zip'] = '1100';
$data['state'] = 'Penang';
$data['website_url'] = $GLOBALS['protocol'] . '://www.google.com';
$data['about'] = 'nothing about this company';
$new_employer = array();
if ($employer->update($data)) {
    $new_employer = $employer->get();
    echo "<pre>";
    print_r($new_employer);
    echo "</pre><br><br>";
    $hash = sha1($uid . $new_employer[0]['password'] . $seed);
} else {
    echo "failed";
    exit;
}
?>
</p><p style="font-weight: bold;">Still logged in after a password change?</p><p><?php 
if (!$employer->isLoggedIn($hash)) {
    echo "failed";
    exit;
} else {
Пример #3
0
    $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
    mail($employer->getEmailAddress(), $subject, $message, $headers);
    // $handle = fopen('/tmp/email_to_'. $employer->getEmailAddress(). '.txt', 'w');
    // fwrite($handle, 'Subject: '. $subject. "\n\n");
    // fwrite($handle, $message);
    // fclose($handle);
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'reset_password') {
    $new_password = generate_random_string_of(6);
    $data = array();
    $data['password'] = md5($new_password);
    $employer = new Employer($_POST['id']);
    $employer->setAdmin(true);
    if ($employer->update($data) === false) {
        echo 'ko';
        exit;
    }
    $lines = file(dirname(__FILE__) . '/../private/mail/employer_password_reset_admin.txt');
    $message = '';
    foreach ($lines as $line) {
        $message .= $line;
    }
    $message = str_replace('%user_id%', $_POST['id'], $message);
    $message = str_replace('%temporary_password%', $new_password, $message);
    $subject = "Employer Password Reset";
    $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
    mail($employer->getEmailAddress(), $subject, $message, $headers);
    // $handle = fopen('/tmp/email_to_'. $employer->getEmailAddress(). '.txt', 'w');
    // fwrite($handle, 'Subject: '. $subject. "\n\n");
Пример #4
0
    exit;
}
if ($_POST['action'] == 'copy_fees') {
    $from_employer = new Employer($_POST['employer']);
    $to_employer = new Employer($_POST['id']);
    $fees = $from_employer->getFees();
    if ($to_employer->createFees($fees) === false) {
        echo 'ko';
        exit;
    }
    $criteria = array('columns' => "working_months, payment_terms_days", 'match' => "id = '" . $from_employer->getId() . "'", 'limit' => "1");
    $result = $from_employer->find($criteria);
    $data = array();
    $data['working_months'] = $result[0]['working_months'];
    $data['payment_terms_days'] = $result[0]['payment_terms_days'];
    $to_employer->update($data);
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'delete_fee') {
    $employer = new Employer();
    if ($employer->deleteFee($_POST['id']) === false) {
        echo 'ko';
        exit;
    }
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'get_fees') {
    $employer = new Employer($_POST['id']);
    $result = $employer->getFees();
Пример #5
0
    $member->setAdmin(true);
    if ($member->update($data) === false) {
        echo 'ko';
        exit;
    }
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'activate') {
    $new_password = generate_random_string_of(6);
    $data = array();
    $data['active'] = 'Y';
    $data['password'] = md5($new_password);
    $member = new Employer($_POST['id']);
    $member->setAdmin(true);
    if ($member->update($data) === false) {
        echo 'ko';
        exit;
    }
    $lines = file(dirname(__FILE__) . '/../private/mail/member_password_reset_admin.txt');
    $message = '';
    foreach ($lines as $line) {
        $message .= $line;
    }
    $message = str_replace('%temporary_password%', $new_password, $message);
    $subject = "Member Password Reset";
    $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
    mail($member->getEmailAddress(), $subject, $message, $headers);
    // $handle = fopen('/tmp/email_to_'. $member->getEmailAddress(). '.txt', 'w');
    // fwrite($handle, 'Subject: '. $subject. "\n\n");
    // fwrite($handle, $message);
Пример #6
0
    if (array_key_exists('password', $data)) {
        $lines = file(dirname(__FILE__) . '/../private/mail/employer_password_reset.txt');
        $message = '';
        foreach ($lines as $line) {
            $message .= $line;
        }
        $subject = "Employer Password Reset";
        $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
        mail($_POST['email_addr'], $subject, $message, $headers);
    }
    echo "ok";
}
if ($_POST['action'] == 'save_profile') {
    $employer = new Employer($_POST['id'], $_SESSION['yel']['employer']['sid']);
    $data = array();
    $data['email_addr'] = $_POST['email_addr'];
    $data['contact_person'] = $_POST['contact_person'];
    $data['phone_num'] = $_POST['phone_num'];
    $data['fax_num'] = $_POST['fax_num'];
    $data['address'] = $_POST['address'];
    $data['state'] = $_POST['state'];
    $data['zip'] = $_POST['zip'];
    $data['country'] = $_POST['country'];
    $data['website_url'] = $_POST['website_url'];
    $data['about'] = $_POST['summary'];
    if (!$employer->update($data)) {
        echo "ko";
        exit;
    }
    echo "ok";
}