Пример #1
0
$password = "";
if (isset($_GET["username"])) {
    $username = $_GET["username"];
} else {
    echo "USERNAME NOT SET";
}
if (isset($_GET["username"])) {
    $password = $_GET["password"];
} else {
    echo "PASSWORD NOT SET";
}
$info->username = $username;
$info->password = $password;
$info->sessionID = loginAuth($info->username, $info->password, 403651);
//echo "SessionID: ".$info->sessionID."<br />";
$info->eventID = getEventID($info->sessionID, $info->accountID);
//echo "EventID: ".$info->eventID."<br />";
$info->stats = getUserInfo($info->sessionID, $info->eventID);
$test = getUserInfo($info->sessionID, $info->eventID);
echo $test;
if ($info->stats->ParticipantName && $info->stats->PersonalRaised && $info->stats->PersonalGoal) {
    /*     echo $info->stats; */
    /* 	echo $info->stats->ParticipantName.",".ceil($info->stats->PersonalRaised).",".ceil($info->stats->PersonalGoal); */
    echo json_encode($info->stats);
    $user = $info->stats->ParticipantName;
    $raised = $info->stats->PersonalRaised[0];
    $goal = $info->stats->PersonalGoal[0];
    $dict = array("user" => $user, "raised" => $raised, "goal" => $goal);
    /* 	echo json_encode($dict); */
} else {
    echo "Error";
Пример #2
0
$accountID = 403651;
$username = null;
$password = null;
$error = null;
if (isset($_GET["username"])) {
    $username = $_GET["username"];
} else {
    $error = "USERNAME NOT SET";
}
if (isset($_GET["password"])) {
    $password = $_GET["password"];
} else {
    $error = "PASSWORD NOT SET";
}
$sessionID = getSessionID($username, $password, $accountID);
$eventID = getEventID($sessionID, $accountID);
$info = getUserInfo($sessionID, $eventID);
if (isset($error)) {
} else {
    echo json_encode($info);
}
function getSessionID($username, $password, $accountID)
{
    $url = "https://www.kintera.org/api/Authentication/Login.ashx?accountid=" . $accountID;
    $data = array('username' => $username, 'password' => $password);
    $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data)));
    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    $xml = simplexml_load_string($result);
    if (isset($xml->ErrorMessage)) {
        return false;