예제 #1
0
if (isset($_POST['store'])) {
    $profile = getPlayerSummary($me);
    $profile['isgroupmember'] = $_SESSION['g'];
    logDB("User requested profile storage: {$me}");
    storePlayerSummaryDB($profile);
    /* if this ever fails, ignore it :] */
    /* XXX messy line to get memberurl populated */
    $profile = inflatePlayerSummary(deflatePlayerSummary($profile));
    if (true) {
        header("Location: " . str_replace('//steamlug.org', '', $profile['memberurl']));
        exit;
    }
}
// are we supplying data via POST? → write to log, remove DB duplicate, Location: /member?
if (isset($_POST['unstore'])) {
    logDB("User requested profile removal: {$me}");
    $removed = removePlayerSummaryDB($me);
    if ($removed) {
        header("Location: /member/");
        exit;
    }
}
$accountUpdate = "";
if ($memberID == "me" and isset($me)) {
    // XXX this currently fails to show the remove account if current user visits their public link. change?
    $profile = getPlayerSummaryDB($me);
    if ($profile == false) {
        $accountUpdate = <<<UPGRADENOW
\t\t\t<article class="panel panel-default panel-success">
\t\t\t\t<header class="panel-heading">
\t\t\t\t\t<h3 class="panel-title">Site membership</h3>
/**
 * Removes supplied SteamID from Event
 * @param string $eventid Steam's reference number for the event
 * @param string $steamid SteamID of the user we want to remove
 * @return boolean whether the action completed or not
 */
function removePlayerEventAttendance($eventid, $steamid)
{
    global $database;
    try {
        $database->beginTransaction();
        /* TODO: safe-ify $id */
        logDB('EVENTATTEND REM ' . $eventid . ':' . $steamid);
        $statement = $database->prepare("DELETE FROM steamlug.eventattendance WHERE eventid = :eventid AND steamid = :steamid LIMIT 1;");
        $statement->execute(array('eventid' => $eventid, 'steamid' => $steamid));
        $subtraction = $statement->fetch(PDO::FETCH_ASSOC);
        $database->commit();
        return $subtraction;
    } catch (Exception $e) {
        return false;
    }
}