Example #1
1
function good_query_table($sql, $debug = 0)
{
    // this function require presence of good_query() function
    $result = good_query($sql, $debug);
    $table = array();
    if ($result->num_rows > 0) {
        $i = 0;
        while ($table[$i] = $result->fetch_assoc()) {
            $i++;
        }
        unset($table[$i]);
    }
    $result->free();
    return $table;
}
Example #2
0
    } elseif ($_GET['s'] == 'standings') {
        $char_id = $_SERVER['HTTP_EVE_CHARID'];
        $apidb = good_query_assoc("SELECT * FROM corp_members WHERE char_id='{$char_id}'");
        $apiurl = "https://api.eveonline.com/char/Standings.xml.aspx?keyID=" . $apidb['api_keyid'] . "&vCode=" . $apidb['api_vcode'];
        $xmlFile = file_get_contents($apiurl);
        file_put_contents("./cache/xml/hud/" . $char_id . '.xml', $xmlFile);
        //echo 'Done Fetching Api';
        if (!file_exists('./cache/xml/hud/' . $_SERVER['HTTP_EVE_CHARID'] . '.xml')) {
            //echo'nope';
        } else {
            $charxml = './cache/xml/hud/' . $_SERVER['HTTP_EVE_CHARID'] . '.xml';
            $xmlFile = file_get_contents($charxml);
            $xmlRead = new SimpleXMLElement($xmlFile);
            $accChars = $xmlRead->xpath("result/characterNPCStandings/rowset[@name='NPCCorporations']/row");
            $ic = 0;
            foreach ($accChars as $curChars) {
                $result = good_query("SELECT * FROM cache_ag_standings WHERE char_id='{$char_id}' AND fromID={$curChars['fromID']}");
                if (mysql_num_rows($result) > 0) {
                    mysql_query("UPDATE cache_ag_standings SET standings='{$curChars['standing']}' WHERE char_id={$char_id} AND fromID={$curChars['fromID']}");
                } else {
                    mysql_query("INSERT INTO cache_ag_standings (char_id, fromID, standings) VALUES ({$char_id}, {$curChars['fromID']}, '{$curChars['standing']}')");
                }
            }
            //echo'<br />Done Updating Database.';
        }
        $_SESSION['text'] = 'Standings API Updated!';
        $_SESSION['type'] = 'success';
        redirect('./?module=member_settings');
        exit;
    }
}
Example #3
0
$apiurl = "https://api.eveonline.com/corp/Standings.xml.aspx?keyID=" . $keyID . "&vCode=" . $vCode;
$xmlFile = file_get_contents($apiurl);
file_put_contents($strLocation . "cache/xml/hud/corp_standings.xml", $xmlFile);
if (!file_exists($strLocation . 'cache/xml/hud/corp_standings.xml')) {
    echo 'nope';
} else {
    $charxml = $strLocation . 'cache/xml/hud/corp_standings.xml';
    $xmlFile = file_get_contents($charxml);
    $xmlRead = new SimpleXMLElement($xmlFile);
    $xmlnpc = $xmlRead->xpath("result/corporationNPCStandings/rowset[@name='NPCCorporations']/row");
    $npccharid = '0000' . $G_corpID;
    $faccharid = '0001' . $G_corpID;
    foreach ($xmlnpc as $curnpc) {
        $resultnpc = good_query("SELECT * FROM cache_ag_standings WHERE char_id='{$npccharid}' AND fromID={$curnpc['fromID']}");
        if (mysql_num_rows($resultnpc) > 0) {
            mysql_query("UPDATE cache_ag_standings SET standings='{$curnpc['standing']}' WHERE char_id='{$npccharid}' AND fromID={$curnpc['fromID']}");
        } else {
            mysql_query("INSERT INTO cache_ag_standings (char_id, fromID, standings) VALUES ('{$npccharid}', {$curnpc['fromID']}, '{$curnpc['standing']}')");
        }
    }
    $xmlfac = $xmlRead->xpath("result/corporationNPCStandings/rowset[@name='factions']/row");
    foreach ($xmlfac as $curfac) {
        $resultfac = good_query("SELECT * FROM cache_ag_standings WHERE char_id='{$faccharid}' AND fromID={$curfac['fromID']}");
        if (mysql_num_rows($resultfac) > 0) {
            mysql_query("UPDATE cache_ag_standings SET standings='{$curfac['standing']}' WHERE char_id='{$faccharid}' AND fromID={$curfac['fromID']}");
        } else {
            mysql_query("INSERT INTO cache_ag_standings (char_id, fromID, standings) VALUES ('{$faccharid}', {$curfac['fromID']}, '{$curfac['standing']}')");
        }
    }
    echo '<br />Done Updating Corp Standings Database.';
}
Example #4
0
function good_query_table($sql, $debug = 0)
{
    // this function require presence of good_query() function
    $result = good_query($sql, $debug);
    $table = array();
    if (mysql_num_rows($result) > 0) {
        $i = 0;
        while ($table[$i] = mysql_fetch_assoc($result)) {
            $i++;
        }
        unset($table[$i]);
    }
    mysql_free_result($result);
    return $table;
}
Example #5
0
<?php

$default = getModule("page");
$result = good_query('SELECT * FROM menu') or exit(mysql_error());
global $getHeaderCorpID;
$i = 0;
while ($row = mysql_fetch_array($result)) {
    $allowed[] = $row['murl'];
    $i++;
}
$wrt = wrt_table(0, 0, 0, '128', 'center');
$wrt .= '<tr><td>';
/*
	$wrt	.=	'<div id="container">';
	$wrt	.=	'<div id="image"><img class="darkborder" src="http://image.eveonline.com/Corporation/'.$G_corpID.'_128.png"></div>';
	$wrt	.=	'<div style="position: absolute; left: 10px; top: 100px;">';
	$wrt	.=	'<span style="font-weight: bold; color: #fff;">Moooooo...</span>';
	$wrt	.=	'</div></div>';
*/
$pr2 = '<script type="text/javascript">' . "\n";
$pr2 .= '$(document).ready(function(){';
$pr2 .= '	$(".newsloader").ready(function(){';
$pr2 .= '		$(".srv_status").fadeIn();';
$pr2 .= '		$(".srv_loader").hide().load("./includes/serverstatus.php", function() {';
$pr2 .= '			$(".srv_status").hide();';
$pr2 .= '			$(this).fadeIn();';
$pr2 .= '		});';
$pr2 .= '	});';
$pr2 .= '});';
$pr2 .= '</script>';
$pr3 = '<div class="text"><div class="srv_status" style="display: none;text-align:center;"><img src="./img/ghooloader2_s.gif" alt="loading" /></div><div class="srv_loader"></div></div>';
Example #6
0
$invite = getInvite($token);
if ($invite && $invite['freeInvites'] > 0) {
    $newToken = generateToken();
    $sql = "INSERT INTO garage_invites SET token = '{$newToken}', email = '{$email}', referredBy = '{$token}'";
    if (!good_query($sql)) {
        $error = $db->error;
        // Check if error is only due to duplicate email (person already invited)
        if (stripos($error, "Duplicate") !== FALSE && stripos($error, "'email'") !== FALSE) {
            $newToken = good_query_value("SELECT token FROM garage_invites WHERE email = '{$email}'");
            // If the person was already invited, invite him again using his old token
            if (empty($newToken)) {
                respond(json_encode(array('status' => 'error', 'message' => "Invitation wasn't found")));
            }
        } else {
            // There is a minor chance that the token would already exist
            respond(json_encode(array('status' => 'error', 'message' => 'Invitation didn\'t go through. Please try again.')));
        }
    } else {
        good_query("UPDATE garage_invites SET freeInvites = (freeInvites - 1) WHERE token = '{$token}'");
    }
    $name = $invite['name'];
    $link = 'http://elisaxslush.com/garage/?t=' . $newToken;
    $message .= "Hi!\n\n" . $name . " just registered for Elisa Garage Chillax and invites you to join the fun, too.\n\n**Elisa Garage Chillax takes place on the first day of Slush, November 18th at 6-9pm**, in our garage (Ratavartijankatu 5, Helsinki), just a 5-minute walk from the Slush venue.\n\nOur garage space is huge but has a guest limit! So sign up with your personal link right now: " . $link . " .\n\nThe program includes free food & drinks, music, dev comps, playing with facial recognition, and relaxing in big couches.\n\nFor the Slush participants, the night will continue at the official Slush after party in Messukeskus.\n\nWe look forward to having you here,\n\nHilla & Albert\nTeam behind Elisa X Slush\n\n\n--\nwww.elisa.com\nYou received this message because somebody sent an invite to your email.\n[" . date('Y-m-d G:i:s') . "]\n";
    //  $message = str_replace("\n", "\r\n", $message);
    $header = "From: Elisa X Slush <*****@*****.**>\r\n";
    $header .= "Content-Type: text/plain;charset=utf-8\r\n";
    mail($email, $name . ' invites you to Elisa Garage Chillax on Nov 18 6-9pm', $message, $header);
    respond(json_encode(array('status' => 'success')));
} else {
    respond(json_encode(array('status' => 'error', 'message' => 'Token not found or no free invites available')));
}
Example #7
0
$timestamp = date('Y-m-d G:i:s');
$waitlist = false;
if (file_exists('event_full')) {
    $waitlist = true;
}
$waitlistSql = $waitlist ? ', waitinglist = 1' : '';
$sql = "UPDATE garage_invites SET name = '{$name}', email = '{$email}', phone = '{$phone}', registered = '{$timestamp}', visited = '{$timestamp}' {$waitlistSql} WHERE token = '{$token}'";
good_query($sql);
$tokenValid = $db->affected_rows > 0;
if ($tokenValid) {
    $response = array('status' => 'success');
} else {
    // Check if the error was due to duplicate email -> if so, just update the existing email invite
    $error = $db->error;
    if (stripos($error, "Duplicate") !== FALSE && stripos($error, "'email'") !== FALSE) {
        good_query("UPDATE garage_invites SET name = '{$name}', phone = '{$phone}', registered = '{$timestamp}', visited = '{$timestamp}' {$waitlistSql} WHERE email = '{$email}'");
        if ($db->affected_rows > 0) {
            $response = array('status' => 'success');
        } else {
            $response = array('status' => 'error', 'message' => 'Some unknown error occurred', 'code' => 'UNKNOWN');
        }
    } else {
        $response = array('status' => 'error', 'message' => 'No invitation found', 'code' => 'NOTFOUND');
    }
}
if ($response['status'] == 'success') {
    // Assume first name is the first word of the name
    $spaceI = strpos($name, ' ', 1);
    if ($spaceI !== FALSE) {
        $firstName = substr($name, 0, $spaceI);
    } else {
Example #8
0
<?php

require_once 'common.php';
$token = $db->escape_string($_GET['token']);
$count = good_query_value("SELECT COUNT(*) FROM garage_invites WHERE registered IS NOT NULL");
$eventFull = false;
if ($count > 315) {
    // Max number of tickets until the event is declared full
    $eventFull = true;
    $header = "From: Elisa X Slush <*****@*****.**>\r\n";
    $header .= "Content-Type: text/plain;charset=utf-8\r\n";
    // Once the event is full, create a file named "event_full"
    if (!file_exists('event_full')) {
        // Inform organizers of the event reaching full capacity
        mail('albert.nazander@elisa.fi, hilla.pyykkonen@elisa.fi', 'GARAGE CHILLAX is FULL', "The garage party is full", $header);
        touch('event_full');
    }
}
$invite = getInvite($token);
if (!$invite) {
    $response = array('status' => 'error', 'message' => 'No invitation found', 'code' => 'NOTFOUND');
} else {
    $response = array('status' => 'success', 'data' => $invite);
    if ($eventFull) {
        $response['eventIsFull'] = true;
    }
    $timestamp = date('Y-m-d G:i:s');
    $sql = "UPDATE garage_invites SET visited = '{$timestamp}' WHERE token = '{$token}'";
    good_query($sql);
}
respond(json_encode($response));
Example #9
0
<?php

require_once $module_dir . 'bulletin/config.php';
echo '<p>&nbsp;</p>';
if (!isset($_GET['mode'])) {
    $getNOPages = good_query_assoc("SELECT bulletins FROM settings LIMIT 1");
    $bulletin_limit = $getNOPages['bulletins'];
    $result = good_query("SELECT *, DATE_FORMAT(postdate,'%Y-%m-%d') AS date FROM bulletin ORDER BY postdate DESC LIMIT {$bulletin_limit}");
    echo '<table class="center" width="' . $tblWidth . '"><tr><td class="left"><div id="accordion" style="width:100%;">';
    while ($row = mysql_fetch_array($result)) {
        //if ($isDirector) {$editpanel = '<hr><span class="edit"><a href="'.$root_url.'&mode=edit&id='.$row['id'].'">edit</a></span>&nbsp;<span class="del"><a id="opener" href="./?p=data&mode=bulletin&a=delete&id='.$row['id'].'">delete</a></span>';} else {$editpanel ='';}
        echo '<h3><a href="#"><div><span>' . $row['title'] . '</span><span class="right">' . $row['author'] . ' | ' . date('Y-m-d', strtotime($row['postdate'])) . '&nbsp;&nbsp;&nbsp;</span></div></a></h3>
		<div><span class="btext">' . $row['content'] . '</span></div>';
        //if ($admin == true) {echo '<tr><td class="tleft" colspan="2"><a href="./?p=bulletin&s=edit&id='.$row['id'].'"><img src="database_edit.png" class="nob"></a><a href="./?p=bulletin&s=delete&id='.$row['id'].'"><img src="database_delete.png" class="nob"></a></td></tr>';} // ############################ ADMIN CHECK
        //if ($admin == true) {echo '<tr><td class="tleft" colspan="2"><span class="edit"><a href="./?p=bulletin&s=edit&id='.$row['id'].'">edit</a></span>&nbsp;<span class="del"><a id="opener" href="./?p=bulletin_data&a=delete&id='.$row['id'].'">delete</a></span></td></tr>';} // ############################ ADMIN CHECK
        //echo	'</table>';
        //echo	'<p>&nbsp;</p>';
    }
    echo '</div></td></tr></table>';
    // ############################################################## NEW WAY EOF
}