Ejemplo n.º 1
0
function StartLogin($name, $pw, $bypass)
{
    global $config;
    $loc = "userlib.php->StartLogin";
    $_SESSION["LoggedIn"] = false;
    log_msg($loc, "checking=" . $name . ', bypass='******'SELECT UserID, UserName, PasswordHash, LastName, FirstName, Tags, Active FROM Users ';
    $sql .= 'WHERE UserName="******"';
    $result = SqlQuery($loc, $sql);
    if ($result->num_rows < 1) {
        log_msg($loc, 'Login failure for username: "******". User not found.');
        return false;
    }
    $row = $result->fetch_assoc();
    if (empty($row["Active"])) {
        log_msg($loc, 'Login failure for username "' . $name . '". User not active.');
        return false;
    }
    $pwHash = crypt($pw, $config["Salt"]);
    if ($row["PasswordHash"] != $pwHash) {
        if (!$bypass) {
            log_msg($loc, 'Login failure for username "' . $name . '". Password mismatch. ');
            return false;
        }
        log_msg($loc, 'User "' . $name . '" used bypass feature to avoid password match.');
    }
    $_SESSION["LoggedIn"] = true;
    $_SESSION["Login_Time"] = time();
    $_SESSION["Login_UserID"] = $row["UserID"];
    $_SESSION["Login_UserName"] = $name;
    $_SESSION["Login_LastName"] = $row["LastName"];
    $_SESSION["Login_FirstName"] = $row["FirstName"];
    $_SESSION["Login_Tags"] = ArrayFromSlashStr($row["Tags"]);
    $_SESSION["Login_IsAdmin"] = CheckForTag("admin");
    $_SESSION["Login_IsMember"] = CheckForTag("member");
    $_SESSION["Login_IsEditor"] = CheckForTag("editor");
    // Get all the current preferences.
    $_SESSION["Prefs"] = GetPrefsForUser(GetUserID());
    $lines = array();
    array_push($lines, ">>>>>>>>>>> " . $row["LastName"] . ', ' . $row["FirstName"]);
    array_push($lines, "New Login!  UserName="******"UserName"] . ',   UserID=' . $row["UserID"]);
    array_push($lines, "IP Address= " . $_SERVER["REMOTE_ADDR"] . "    Tags=" . $row["Tags"]);
    array_push($lines, "Browser=" . $_SERVER["HTTP_USER_AGENT"]);
    log_msg($loc, $lines);
    return true;
}
Ejemplo n.º 2
0
function MakeGifImages()
{
    $loc = 'badges_showall.php->MakeAllBadges';
    $sql = 'SELECT * FROM UserView ORDER BY BadgeID';
    $result = SqlQuery($loc, $sql);
    $nempty = 0;
    $nmade = 0;
    $nfail = 0;
    while ($row = $result->fetch_assoc()) {
        if ($row["Active"] == false) {
            continue;
        }
        $tags = ArrayFromSlashStr($row["Tags"]);
        if (!in_array("member", $tags)) {
            continue;
        }
        $badgeid = $row["BadgeID"];
        if (empty($badgeid)) {
            $nempty++;
            continue;
        }
        $r = MakeGif($row);
        if ($r === true) {
            $nmade++;
        } else {
            $nfail++;
        }
    }
    $status = 'Images Made: ' . $nmade . ', Members without BadgeIDs: ' . $nempty;
    if ($nfail > 0) {
        $status .= ', Failures: ' . $nfail . '. (See sys log!)';
    }
    log_msg($loc, array('All gif images made!', $status));
    return $status;
}
Ejemplo n.º 3
0
$sql = 'SELECT * FROM UserView ORDER BY LastName, FirstName';
$result = SqlQuery($loc, $sql);
if ($result->num_rows > 0) {
    // output data of each row
    echo "<br>\n";
    echo '<table class="members_userlist">' . "\n<tr>\n";
    echo "<th align=left width=150><u>Last Name</u></th>";
    echo "<th align=left width=100><u>First Name</u></th>";
    echo "<th align=left width=120><u>Title</u></th>";
    echo "<th align=left width=80><u>Badge ID</u></th>";
    echo "<th align=left width=80><u>Has Pic?</u></th>";
    while ($row = $result->fetch_assoc()) {
        if ($row["Active"] == false) {
            continue;
        }
        $tags = ArrayFromSlashStr($row["Tags"]);
        if (!in_array("member", $tags)) {
            continue;
        }
        $haspic = "NO";
        if (isset($row["PicID"]) && intval($row["PicID"]) > 0) {
            $haspic = "";
        }
        echo "\n<tr>";
        echo '<th align=left> <a href="members_edituser.php?UserID=' . $row["UserID"] . '">' . $row["LastName"] . '</a></th>';
        echo '<th align=left>' . $row["FirstName"] . '</th>';
        echo '<th align=left>' . $row["Title"] . '</th>';
        echo '<th align=left>' . $row["BadgeID"] . '</th>';
        echo '<th align=left>' . $haspic . '</th>';
        echo "</tr>\n";
    }
Ejemplo n.º 4
0
function GetAllWorkers()
{
    $loc = rmabs(__FILE__ . "GetAllWorkers");
    $sql = 'SELECT * FROM AllActiveUsersView ORDER BY LastName, FirstName';
    $result = SqlQuery($loc, $sql);
    $d = array();
    while ($row = $result->fetch_assoc()) {
        $tags = ArrayFromSlashStr($row["Tags"]);
        if (CheckArrayForEasyMatch($tags, "worker")) {
            $row["AbbrivatedName"] = MakeAbbrivatedName($row);
            $d[] = $row;
        }
    }
    return $d;
}
Ejemplo n.º 5
0
function CheckRawTagList($tag, $SlashedList)
{
    $taglist = ArrayFromSlashStr($SlashedList);
    foreach ($taglist as $t) {
        if (strtolower(trim($t)) == strtolower(trim($tag))) {
            return true;
        }
    }
    return false;
}
Ejemplo n.º 6
0
function GenerateBulkWO($params)
{
    global $WOIPTeams;
    $loc = rmabs(__FILE__ . "GenerateBulkWO");
    $sql = 'SELECT * FROM AllActiveUsersView ORDER BY LastName, FirstName';
    $result = SqlQuery($loc, $sql);
    $d = array();
    $num = 0;
    $matchtags = ArrayFromSlashStr($params["FilterTags"]);
    if (empty($matchtags)) {
        $matchtags = array("Worker");
    }
    $title_template = $params["Title"];
    $nerr = 0;
    $nok = 0;
    $wid0 = 0;
    $wid1 = 0;
    $num = 0;
    while ($userinfo = $result->fetch_assoc()) {
        // Decide if this person should get a WO.
        $taglist = ArrayFromSlashStr($userinfo["Tags"]);
        if (TagMatch(array("Guest"), $taglist)) {
            continue;
        }
        // Guests NEVER get one.
        if (!TagMatch($matchtags, $taglist)) {
            continue;
        }
        // We passed the test, this person gets one!
        // Figure out the receiving IPT.
        $ipt = $userinfo["IPT"];
        if (empty($ipt)) {
            $ipt = $WOIPTeams[8];
        }
        // Hopefully this is management.
        $params["Receiver"] = $ipt;
        $num++;
        $snum = sprintf("%d", $num);
        $params["Title"] = TemplateReplace($title_template, $snum, "##");
        $rwo = CreateNewWorkOrder($params);
        $wid = $rwo[0];
        if ($wid == 0) {
            // failed.
            log_error($loc, array("Failed to Create Bulk WO. Reason: " . $rwo[1], 'WO Title: ' . $params["Title"]));
            $nerr++;
            continue;
        }
        // Add assingment
        MakeAssignment($wid, $userinfo["UserID"]);
        if ($nok == 0) {
            $wid0 = $wid;
        }
        $wid1 = $wid;
        $nok++;
    }
    $msg = 'Number of WOs Created = ' . $nok . '.  Number of Failures = ' . $nerr . '.';
    $msg .= "  WID=" . $wid0 . " to " . $wid1 . ".";
    log_msg($loc, "Bulk WO Created. WIDs " . $wid0 . " to " . $wid1);
    return $msg;
}