Example #1
0
<?php

require_once 'common.php';
check_logged_in();
if (isset($_SESSION['user']) && $_SESSION['user']['is_logged'] == 1) {
    $PageTitle = getLang('ptitle_logged');
} else {
    $PageTitle = getLang('ptitle_notlogged');
}
$db = new DBConnection();
$query = 'SELECT user_firstname, trading_type,user_lastname,user_account_num FROM users WHERE user_account_num="' . $_SESSION['user']['user_account_num'] . '" LIMIT 1';
$res = $db->rq($query);
$username = $db->fetch($res);
$userProfile = '';
//---------------------------------------------
$total_trading = 0;
$total_trading2 = 0;
$total_total_fees = 0;
$total_purchase = 0;
$total_sales = 0;
$total_fees = 0;
$query = 'SELECT SUM(trade_value) AS total_purchase FROM trades WHERE trade_type=1 AND trade_status IN (1,4) AND user_account_num="' . $_SESSION['user']['user_account_num'] . '"';
$res = $db->rq($query);
$row = $db->fetch($res);
$total_trading -= $row['total_purchase'];
$total_trading2 -= $row['total_purchase'];
$total_purchase += $row['total_purchase'];
$query = 'SELECT SUM(trade_value) AS total_purchase FROM stock_trades WHERE trade_type=1 AND trade_status IN (1,4) AND user_account_num="' . $_SESSION['user']['user_account_num'] . '"';
$res = $db->rq($query);
$row = $db->fetch($res);
$total_trading -= $row['total_purchase'];
<?php
//header("Content-type: application/xml");
require_once("include/check_logged_in.php");

if (!check_logged_in()){
	echo "False";
}

// 4. Set Person id for example 1 and example 2
$person_id = "1190740";

/*$url = sprintf("https://www.planningcenteronline.com/people/$person_id.xml");
$content = '<person><first-name>Johnny</first-name><last-name>Sheppard</last-name></person>';
$response = get_pco_data($url,"PUT",$content);
*/
$url = sprintf("https://www.planningcenteronline.com/organization.xml");
$response = get_pco_data($url);

$organization = simplexml_load_string($response);

foreach ($organization->{'service-types'}->{'service-type'} as $service){
	echo "<h2>" . $service->name . "</h2>\n";
	echo "<table border=1>\n";
	$service_id = $service->id;
	$url = sprintf("https://www.planningcenteronline.com/service_types/" . $service_id. "/plans.xml");
	$response2 = get_pco_data($url);
	$plans = simplexml_load_string($response2);
	
	foreach($plans->plan as $plan){
		echo "<tr><td>" . $plan->{'plan-title'} . "&nbsp;</td><td>" . $plan->dates . "</td></tr>\n";
	}
Example #3
0
 function is_oto_all($menu, $link_oto, $userid = '')
 {
     check_logged_in($this->session->userdata('userid'));
     $userid == '' ? $uid = $this->session->userdata('userid') : ($uid = $userid);
     if ($uid == 'Superuser') {
         $link_oto;
     } else {
         if ($this->is_oto($menu, 'c', $uid) == 'Y' || $this->is_oto($menu, 'e', $uid) == 'Y' || $this->is_oto($menu, 'v', $uid) == 'Y' || $this->is_oto($menu, 'p', $uid) == 'Y' || $this->is_oto($menu, 'd', $uid) == 'Y') {
             $link_oto;
         } else {
             //$this->load->view("admin/no_authorisation");
             no_auth();
         }
     }
 }
        display_items('All Lists', get_all_lists(), 'information', 'show-archive', '');
        break;
    case 'show-archive':
        display_items('Archive For ' . get_list_name($_GET['id']), get_archive($_GET['id']), 'view-html', 'view-text', '');
        break;
    case 'information':
        display_information($_GET['id']);
        break;
    default:
        if (!check_logged_in()) {
            display_login_form($action);
        }
        break;
}
//all other actions require user to be logged in
if (check_logged_in()) {
    switch ($action) {
        case 'account-settings':
            display_account_form(get_email(), get_real_name(get_email()), get_mimetype(get_email()));
            break;
        case 'show-other-lists':
            display_items('Unsubscribed Lists', get_unsubscribed_lists(get_email()), 'information', 'show-archive', 'subscribe');
            break;
        case 'subscribe':
            subscribe(get_email(), $_GET['id']);
            display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe');
            break;
        case 'unsubscribe':
            unsubscribe(get_email(), $_GET['id']);
            display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe');
            break;
Example #5
0
function getProgressUnit($unit, $details = false, $verbose = true)
{
    check_logged_in();
    global $mysqli, $user;
    $sql = 'SELECT correct, layers FROM UnitProgress WHERE unitId=? AND userId=?';
    $stmt = $mysqli->prepare($sql);
    $userid = $user->userid();
    $stmt->bind_param('ii', $unit, $userid);
    $stmt->execute();
    $stmt->bind_result($correct, $layers);
    // try to fetch
    $result = array('correct' => 0, 'layers' => 1);
    if ($stmt->fetch()) {
        $result['correct'] = $correct;
        $result['layers'] = $layers;
    }
    $stmt->close();
    // exit
    if (!$details) {
        if ($verbose) {
            echo json_encode($result);
        }
        return $result;
    }
    $sql = 'SELECT layerId, successes, failures, averageTime, bestTime, (SELECT AVG(bestScore) FROM Progress p WHERE p.layerId = id) AS averageScore
			FROM Progress
			JOIN Layers ON layerId = id
			WHERE parent=? AND userId=?';
    $stmt = $mysqli->prepare($sql);
    $userid = $user->userid();
    $stmt->bind_param('ii', $unit, $userid);
    $stmt->execute();
    $stmt->bind_result($layer, $successes, $failures, $avg, $best, $score);
    // try to fetch
    $result['layer_results'] = array();
    while ($stmt->fetch()) {
        $result['layer_results'][] = array('layerId' => $layer, 'successes' => $successes, 'failures' => $failures, 'averageTime' => $avg, 'bestTime' => $best, 'score' => $score);
    }
    $stmt->close();
    if ($verbose) {
        echo json_encode($result);
    }
    return $result;
}
 function __construct()
 {
     parent::__construct();
     check_logged_in() or redirect('login');
     $this->load->model('jobs_model', 'jobs');
 }