コード例 #1
0
function AddPictureToUser($username, $source)
{
    $loc = "members_bulkpics.php->AddPIctureToUser";
    $userid = GetUserIDFromName($username);
    $userinfo = GetUserInfo($userid);
    if ($userinfo === false) {
        DieWithMsg($loc, 'User with ID=' . $userid . ' not found, but should be there.');
    }
    // Copy the file into our website.
    $target = GetTempDir() . "temppic.jpg";
    $result = @copy($source, $target);
    if ($result == false) {
        log_msg($loc, array('Picture not added. Unable to copy file.', 'External File=' . $source, 'Internal Target=' . $target));
        return false;
    }
    $id = StoreUserPic($target, $userid);
    return true;
}
コード例 #2
0
ファイル: badgelib.php プロジェクト: sshibs/EpicRobotzWebsite
function MakePrintLabels($UserNames, $basefilename)
{
    $box_size_x = 1.96875;
    // 590 pixels
    $box_size_y = 2.375;
    // 712 pixels
    $page_size_x = 11.0;
    $page_size_y = 8.5;
    $page_margin_x = 31 / 32;
    $page_margin_y = 0.5;
    $boxlocs = array(array($page_margin_x, $page_margin_y), array($page_margin_x + $box_size_x, $page_margin_y), array($page_size_x - $page_margin_x - 2 * $box_size_x, $page_size_y - $page_margin_y - $box_size_y), array($page_size_x - $page_margin_x - $box_size_x, $page_size_y - $page_margin_y - $box_size_y));
    $sheetnum = 1;
    $pos = 0;
    $w = intval(11.0 * 300);
    $h = intval(8.5 * 300);
    $sheet_img = imagecreatetruecolor($w, $h);
    $white = ImageColorAllocate($sheet_img, 0xff, 0xff, 0xff);
    imagefilledrectangle($sheet_img, 0, 0, $w, $h, $white);
    foreach ($UserNames as $u) {
        $userid = GetUserIDFromName($u);
        if ($userid <= 0) {
            continue;
        }
        $data = GetUserInfo($userid);
        if ($data === false) {
            continue;
        }
        $picid = $data["PicID"];
        $badgeid = $data["BadgeID"];
        $firstname = $data["FirstName"];
        $lastname = $data["LastName"];
        $title = $data["Title"];
        $labelimg = CreateLabelPic($picid, $firstname, $lastname, $title);
        $x0 = intval($boxlocs[$pos][0] * 300);
        $y0 = intval($boxlocs[$pos][1] * 300);
        $result = @imagecopyresampled($sheet_img, $labelimg, $x0, $y0, 0, 0, 590, 712, 590, 712);
        $pos += 1;
        if ($pos >= count($boxlocs)) {
            $fname = 'label_' . $sheetnum . '.jpg';
            SaveSheetImg($sheet_img, $fname);
            $sheetnum += 1;
            $pos = 0;
            imagefilledrectangle($sheet_img, 0, 0, $w, $h, $white);
        }
    }
    if ($pos != 0) {
        $fname = 'label_' . $sheetnum . '.jpg';
        SaveSheetImg($sheet_img, $fname);
    }
}
コード例 #3
0
// Updated: 12/29/14 DLB -- Hacked from Epic Scouts...
// --------------------------------------------------------------------
require_once "libs/all.php";
session_start();
log_page();
CheckLogin();
CheckAdmin();
$timer = new timer();
$loc = 'admin_masquerade.php';
$error_msg = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["UserName"])) {
        goto GenerateHtml;
    }
    $username = $_POST["UserName"];
    $userid = GetUserIDFromName($username);
    if ($userid == false) {
        $error_msg = "User does not exist.";
        goto GenerateHtml;
    }
    $currentuser = GetUserName();
    log_msg($loc, 'User ' . $currentuser . ' is attemping to masquerade as ' . $username);
    session_unset();
    session_destroy();
    session_start();
    $okay = StartLogin($username, "", true);
    if ($okay === false) {
        log_msg($loc, "Login failure for masquerade.  Starting ALL over.");
        session_unset();
        session_destroy();
        JumpToPage("login.php");