Exemplo n.º 1
0
function awardUser($targetUser, $URL, $conn)
{
    $bountyInfo = getExistingBountyInfo($targetUser, $conn);
    $points = $bountyInfo['worth'];
    $targetClaim = $bountyInfo['id'];
    $data = array("text" => "@" . $targetUser . " has fulfilled their bounty for *" . $bountyInfo['worth'] . " points!*", "username" => "SlackBounty Sheriff", "mrkdwn" => true);
    addCredit($targetUser, $points, $URL, $conn);
    $sql = "DELETE FROM claims WHERE userID = :userID";
    $stmt = $conn->prepare($sql);
    $stmt->execute(array(":userID" => getUserID($targetUser, $conn)));
    $sql = "DELETE FROM board WHERE id = :claimID";
    $stmt = $conn->prepare($sql);
    $stmt->execute(array(":claimID" => $targetClaim));
    sendThis($data, $URL);
}
Exemplo n.º 2
0
 * Lasmod: 2015年7月12日09:45:08 by xudong
 * ===========================================
 */
include "init.inc.php";
$data = array();
$now = time();
$act = "";
if (isset($_GET['act'])) {
    $act = form_input($_GET['act']);
}
if ($act == "publish") {
    //动态发布成功,奖励积分
    $uid = form_input($_POST['fromuid']);
    //发布人uid
    if (isUserExist($uid)) {
        addCredit($uid, "publishblog");
        $credit = getCredit("publishblog");
        throwJSON(array("status" => "ok", "code" => 200, "msg" => "发布动态,奖励信用,威望,贡献", "credit" => $credit));
    } else {
        throwJSON(array("status" => "error", "code" => 300, "msg" => "uid不存在"));
    }
} else {
    if ($act == "add") {
        //发布日志
        $uid = form_input($_POST['fromuid']);
        //发布人uid
        if (isNull($uid)) {
            $result = array("status" => "error", "code" => 301, "msg" => "fromuid field requird");
            throwJSON($result);
            exit;
        }
Exemplo n.º 3
0
include "init.inc.php";
//Aes加密解密算法
include "aes/Aes.class.php";
include "aes/AesCtr.class.php";
define("KEY_SECRET", "www.51fabu.com");
$data = array();
$now = time();
$act = "list";
if ($_GET['act']) {
    $act = $_GET["act"];
}
if ($act == "sign") {
    //签到
    $uid = form_input($_POST['fromuid']);
    if (isUserExist($uid)) {
        addCredit($uid, "daylogin");
        $credit = getCredit("daylogin");
        throwJSON(array("status" => "ok", "code" => 200, "msg" => "sign success", "credit" => $credit));
        exit;
    } else {
        throwJSON(array("status" => "error", "code" => 301, "msg" => "uid no exist."));
        exit;
    }
} else {
    if ($act == "view") {
        //查看别人的资料  http://51fabu.bj-soft.cn/mobile/profile.php?act=view&fromuid=1&touid=1
        $fuid = htmlspecialchars($_GET["fromuid"]);
        //来自谁
        $tuid = htmlspecialchars($_GET["touid"]);
        //要查看谁的资料
        $sql = "select regdate from disc_common_member where uid='{$tuid}'";
Exemplo n.º 4
0
function endrun()
{
    global $DB;
    global $TIMEMARK;
    global $MySelf;
    // Is $_GET[id] truly a number?
    numericCheck($_GET[id]);
    // Are we allowed to close runs?
    $supervisor = $DB->getCol("SELECT supervisor FROM runs WHERE id='" . $_GET[id] . "' LIMIT 1");
    if (!$MySelf->canCloseRun() && $MySelf->getID() != $supervisor[0]) {
        makeNotice("You are not allowed to close runs!", "error", "forbidden");
    }
    // We sure about this?
    confirm("Are you sure you want to close mining operation {$_GET['id']}? " . "This will remove any active pilots that are still on this" . " run, and close this run for good.");
    // Run already closed?
    if (!miningRunOpen($_GET[id])) {
        makeNotice("This mining operation has already been closed!", "warning", "Operation closed already", "index.php?action=show&id={$_GET['id']}");
    }
    // Moved to the end of the payout to allow correct calculations
    // Update the database.
    //$DB->query("update runs set endtime = '$TIMEMARK' where id = '$_GET[id]' and endtime is NULL");
    // now "eject" all members.
    //$DB->query("update joinups set parted = '$TIMEMARK' where parted is NULL and run = '$_GET[id]'");
    // Calculate Payout, IF this is an official run.
    $ID = $_GET[id];
    $OfficialRun = $DB->getCol("SELECT isOfficial FROM runs WHERE id='{$ID}'");
    // calculate the total value of this op.
    $ISK = getTotalWorth($ID, true);
    if ($OfficialRun[0] && getTotalWorth($ID) != 0) {
        // Select all people, except banned ones.
        $joinedPeople = $DB->query("SELECT DISTINCT userid FROM joinups WHERE run ='{$ID}' AND status < 2");
        // Also, create the charity array.
        $charityDB = $DB->query("SELECT userid, charity FROM joinups WHERE run ='{$ID}' AND status < 2");
        while ($c = $charityDB->fetchRow()) {
            $charityArray[$c[userid]] = $c[charity];
        }
        // get the payout array. Fun guaranteed.
        while ($peep = $joinedPeople->fetchRow()) {
            $payoutArray[$peep[userid]] = calcPayoutPercent($ID, $peep[userid]);
        }
        // Calulate the percent-modifier.
        $percentModifier = 100 / array_sum($payoutArray);
        // Apply the modifier to the percentage.
        $names = array_keys($payoutArray);
        // Add the credit.
        $supervisor = usernameToID(runSupervisor($_GET[id]));
        foreach ($names as $name) {
            $percent = $payoutArray[$name] * $percentModifier;
            $payout = $ISK / 100 * $percent;
            // You cannot loose isk from a mission.
            if ($payout != 0 && !$charityArray[$name]) {
                addCredit($name, $supervisor, $payout, $_GET[id]);
                $finalPercent[$name] = $payout;
            }
        }
        // Moved to the end of the payout to allow correct calculations
        // Update the database.
        $DB->query("update runs set endtime = '{$TIMEMARK}' where id = '{$ID}' and endtime is NULL");
        // now "eject" all members.
        $DB->query("update joinups set parted = '{$TIMEMARK}' where parted is NULL and run = '{$ID}'");
        // wrap things up.
        makeEmailReceipt($ID, $finalPercent);
        makeNotice("The mining operation has ended. All still active pilots have been removed from the run and each pilot has been credited his share of the net income.", "notice", "Mining Operation closed", "index.php?action=list", "[OK]");
    }
    // Moved to the end of the payout to allow correct calculations
    // Update the database.
    $DB->query("update runs set endtime = '{$TIMEMARK}' where id = '{$ID}' and endtime is NULL");
    // now "eject" all members.
    $DB->query("update joinups set parted = '{$TIMEMARK}' where parted is NULL and run = '{$ID}'");
    // wrap things up.
    makeNotice("The mining operation has ended. All still active pilots have been removed from the run.", "notice", "Mining Operation closed", "index.php?action=list", "[OK]");
}