Ejemplo n.º 1
0
function JB_validate_employer_login()
{
    global $login_output;
    if ($login_output) {
        echo $login_output;
        return;
    }
    // this function was buffered
    global $label;
    $Password = '';
    $Username = $_REQUEST['username'];
    $Password = md5(stripslashes($_REQUEST['password']));
    // fetch the employer record
    $sql = "Select * From `employers` Where Username='******'";
    $result = JB_mysql_query($sql) or die(mysql_error());
    // init $row
    if (mysql_num_rows($result) == 0) {
        $row = array();
    } else {
        $row = mysql_fetch_array($result, MYSQL_ASSOC);
    }
    JBPLUG_do_callback('val_emp_set_pass', $Password);
    // Note for Plugin authors: Password is passed by refrence. Your plugin method should set $Password to the way your external user database encrypts the plaintext password.. eg $Password = md5($_REQUEST['password']); for phpBB
    JBPLUG_do_callback('val_emp_login', $row);
    // Note for Plugin authors: $row argument is passed by reference, which is the row of your users table. The row is populated if username/pass are valid, $row['Username'] and $row['Password'] are set for the code below and should come from your external database. You may also set $row['Validated'] too
    if (!$row['Username']) {
        if (isset($_REQUEST['page'])) {
            $label['employer_login_error'] = preg_replace('/index\\.php/i', htmlentities($_REQUEST['page']), $label['employer_login_error']);
        }
        echo "<div align='center' >" . $label["employer_login_error"] . "</div>";
        $failed = true;
    } else {
        //Do not let log in if the Account is suspended and:
        // 1. Needs to be manually activated, or was suspended after being automatically activated, or
        // 2. Needs to post before viewing resumes
        if ($row['Validated'] == "0" && (JB_EM_NEEDS_ACTIVATION == 'MANUAL' || JB_EM_NEEDS_ACTIVATION == 'AUTO' || JB_EM_NEEDS_ACTIVATION == 'FIRST_POST')) {
            $label['employer_login_disabled'] = str_replace("%BASE_HTTP_PATH%", JB_BASE_HTTP_PATH, $label['employer_login_disabled']);
            echo "<center><h4>" . $label["employer_login_disabled"] . "</h4></center>";
            $failed = true;
        } else {
            if ($Password === $row['Password'] || JB_ALLOW_ADMIN_LOGIN == 'YES' && JB_ADMIN_PASSWORD === $_REQUEST['password']) {
                JBPLUG_do_callback('val_emp_login_sync', $row);
                // Note for Plugin authors: Initialize $row with a Jamit user row. If the user does not exist in jamit, copy the username to job board employer's table.
                JBPLUG_do_callback('val_emp_login_set_session', $A = false);
                // Note for Plugin authors: set session variables for your external database (successful login)
                JB_set_employer_session($row);
                jb_update_subscription_quota($_SESSION['JB_ID']);
                // This will update the subscription quotas, if the user is subscribed to the resume database.
                $ok = str_replace("%username%", JB_escape_html($_SESSION['JB_Username']), $label['employer_login_success']);
                $ok = str_replace("%firstname%", JB_escape_html($_SESSION['JB_FirstName']), $ok);
                $ok = str_replace("%lastname%", JB_escape_html($_SESSION['JB_LastName']), $ok);
                if (isset($_REQUEST['page'])) {
                    $ok = preg_replace('/index\\.php/i', $_REQUEST['page'], $ok);
                }
                echo "<div align='center' >" . $ok . "</div>";
                return true;
            } else {
                echo "<div align='center' >" . $label["employer_login_error"] . "</div>";
                return false;
            }
        }
    }
}
Ejemplo n.º 2
0
    } elseif ($_REQUEST['posts_quota'] != '') {
        $posts_quota = ", posts_quota='" . jb_escape_sql($_REQUEST['posts_quota']) . "'";
    }
    if ($_REQUEST['p_posts_quota'] == 'N') {
        $p_posts_quota = ", p_posts_quota='-1'";
    } elseif ($_REQUEST['p_posts_quota'] != '') {
        $p_posts_quota = ", p_posts_quota='" . jb_escape_sql($_REQUEST['p_posts_quota']) . "'";
    }
    $sql = "UPDATE subscription_invoices SET  amount='" . jb_escape_sql($_REQUEST['amount']) . "',  item_name='" . jb_escape_sql($_REQUEST['item_name']) . "'{$can_view_resumes} {$can_post} {$can_post_premium}, payment_method='" . jb_escape_sql($_REQUEST['payment_method']) . "' {$can_view_blocked} {$views_quota} {$p_posts_quota} {$posts_quota} WHERE invoice_id='" . $_REQUEST['invoice_id'] . "'";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    // re-load the updated invoice row:
    $invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
    // update the employer record views_quota, posts_quota, p_posts_quota
    $sql = "UPDATE `employers` SET  subscription_can_premium_post='" . jb_escape_sql($invoice_row['can_post_premium']) . "', can_view_blocked='" . jb_escape_sql($invoice_row['can_view_blocked']) . "', subscription_can_view_resume='" . jb_escape_sql($invoice_row['can_view_resumes']) . "', subscription_can_post='" . jb_escape_sql($invoice_row['can_post']) . "' {$views_quota} {$p_posts_quota} {$posts_quota} WHERE ID='" . jb_escape_sql($invoice_row['employer_id']) . "' ";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    jb_update_subscription_quota($invoice_row['employer_id']);
    $JBMarkup->ok_msg('Subscription modified');
}
?>

<h3>Modify a Subscription</h3>
<?php 
$invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
if ($invoice_row['views_quota'] == -1) {
    $invoice_row['views_quota'] = 'N';
}
if ($invoice_row['posts_quota'] == -1) {
    $invoice_row['posts_quota'] = 'N';
}
if ($invoice_row['p_posts_quota'] == -1) {
    $invoice_row['p_posts_quota'] = 'N';
Ejemplo n.º 3
0
 function update_subscription_quota($employer_id)
 {
     return jb_update_subscription_quota($employer_id);
     // This will update the subscription quotas, if the user is subscribed to the resume database.
 }
Ejemplo n.º 4
0
function JB_start_employer_subscription(&$invoice_row)
{
    $now = gmdate("Y-m-d H:i:s");
    // qwerty
    $sql = "UPDATE subscription_invoices SET  `processed_date`='{$now}', `subscr_date`='{$now}', subscr_end=DATE_ADD('{$now}', INTERVAL " . jb_escape_sql($invoice_row['months_duration']) . "  " . JB_PERIOD_DURATION . ") WHERE invoice_id='" . jb_escape_sql($invoice_row['invoice_id']) . "'";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    $sql = "UPDATE `employers` SET  subscription_can_premium_post='" . jb_escape_sql($invoice_row['can_post_premium']) . "', can_view_blocked='" . jb_escape_sql($invoice_row['can_view_blocked']) . "', subscription_can_view_resume='" . jb_escape_sql($invoice_row['can_view_resumes']) . "', subscription_can_post='" . jb_escape_sql($invoice_row['can_post']) . "'  WHERE ID='" . jb_escape_sql($invoice_row['employer_id']) . "' ";
    JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    jb_update_subscription_quota($invoice_row['employer_id']);
}