Exemplo n.º 1
0
<?php

session_start();
if (!isset($_SESSION["audience_id"])) {
    header('Location: index.php');
} else {
    include_once "api.php";
    $audience_id = $_SESSION['audience_id'];
    $api = new Conducttr_API($_SESSION['audience_id']);
    $value = $api->get_audience_details();
    if (!empty($value)) {
        $profile_image = $value[0]['profile_image'];
        $audience_first_name = $value[0]['audience_first_name'];
        $audience_last_name = $value[0]['audience_last_name'];
        $project_id = $value[0]['project_id'];
    } else {
        $profile_image = 'profiles/you.png';
        $audience_first_name = 'You';
        $project_id = $_SESSION['PROJECT_ID'];
    }
}
?>
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title> Badges </title>
		
		<meta name="mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<link href="css/main_communicator.css"  rel="stylesheet" type="text/css" />
Exemplo n.º 2
0
                $card = json_encode($result);
                header("Content-Type: text/event-stream\n\n");
                header("Cache-Control: no-cache");
                // recommended to prevent caching of event data.
                echo "id: {$serverTime}" . PHP_EOL;
                echo "data: {$card}" . PHP_EOL;
                echo "retry: 10000" . PHP_EOL;
                echo PHP_EOL;
                ob_flush();
                flush();
            }
        }
        sleep(1);
    }
}
$api = new Conducttr_API();
$possible_method = array("GET", "POST", "PUT", "DELETE");
$value = "Not a method selected";
if (isset($_REQUEST["action"])) {
    $action = strtolower($_REQUEST["action"]);
    switch ($action) {
        case "get_user_info":
            $value = $api->get_user_info();
            break;
        case "create_user":
            if (isset($_REQUEST["audience_phone"])) {
                $value = $api->create_user($_REQUEST["audience_phone"]);
            } else {
                $value = "Missing argument";
            }
            break;
Exemplo n.º 3
0
<?php

session_start();
session_unset();
$subdomain = array_shift(explode(".", $_SERVER['HTTP_HOST']));
include_once "api.php";
$api = new Conducttr_API(-1);
if (is_numeric($subdomain)) {
    $CONDUCTTR_PROJECT_ID = $subdomain;
    $CONDUCTTR_PROJECT_NAME = "";
} else {
    $CONDUCTTR_PROJECT_ID = -1;
    $CONDUCTTR_PROJECT_NAME = $subdomain;
}
$PROJECT_ID = $api->check_project($CONDUCTTR_PROJECT_ID, $CONDUCTTR_PROJECT_NAME);
if ($PROJECT_ID) {
    ?>

<!Doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title> Conducttr Communicator </title>
		
		<meta name="mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<link href="css/main_communicator.css"  rel="stylesheet" type="text/css" />

		<?php 
    echo '<link rel="shortcut icon" href="styles/' . $PROJECT_ID . '/images/favicon.ico" />';
    echo '<link rel="stylesheet" href="styles/' . $PROJECT_ID . '/communicator.css" type="text/css" />';
Exemplo n.º 4
0
<?php

session_start();
include_once "api.php";
if (isset($_SESSION['audience_id']) && isset($_SESSION['PROJECT_ID'])) {
    if (isset($_GET['b'])) {
        $audience_id = $_SESSION['audience_id'];
        $api = new Conducttr_API($_SESSION['audience_id']);
        $api->get_message_feeds();
        $icons = $api->print_icons();
    } else {
        $audience_id = $_SESSION['audience_id'];
        $api = new Conducttr_API($_SESSION['audience_id']);
        $icons = $api->print_icons();
    }
} else {
    header('Location: index.php');
}
?>

<!doctype html>
<html lang="en" >
	<head>
		<meta charset="utf-8">
		<title> Conducttr Communicator </title>
		
		<meta name="mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<link href="css/main_communicator.css"  rel="stylesheet" type="text/css" />

		<?php 
Exemplo n.º 5
0
    {
        $st = $this->db->prepare("INSERT INTO videos (id) VALUES ('1')");
        $st->execute();
        $data = $st->fetchAll(PDO::FETCH_ASSOC);
        $result = array("response" => "OK");
        return $result;
    }
    function get_video_size()
    {
        $st = $this->db->prepare('SELECT video_width, video_height FROM videos');
        $st->execute($params);
        $data = $st->fetchAll(PDO::FETCH_ASSOC);
        return $data[0];
    }
}
$api = new Conducttr_API();
$possible_method = array("GET", "POST", "PUT", "DELETE");
$value = "An error has occurred";
if (isset($_REQUEST["action"])) {
    $action = strtolower($_REQUEST["action"]);
    switch ($action) {
        case "get_user_info":
            $value = $api->get_user_info();
            break;
        case "get_nextvideo":
            if (isset($_REQUEST["audience_phone"])) {
                $value = $api->get_NextVideo($_REQUEST["audience_phone"]);
            } else {
                $value = "Missing argument";
            }
            break;
Exemplo n.º 6
0
            exit(json_encode($value));
            break;
    }
    exit(json_encode($value));
} else {
    if (isset($_REQUEST["action"])) {
        define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
        if (!IS_AJAX) {
            $result = array("Response" => array("status" => 401, "message" => "Access denied"));
            //return $result;
            exit(json_encode($result));
        }
        if (isset($_SESSION['audience_id'])) {
            $api = new Conducttr_API($_SESSION['audience_id']);
        } else {
            $api = new Conducttr_API(-1);
        }
        $possible_method = array("GET", "POST", "PUT", "DELETE");
        //$value = "An error has occurred";
        $value = array("Response" => "Error", "message" => "An error has occurred");
        $action = strtolower($_REQUEST["action"]);
        switch ($action) {
            case "create_db":
                $value = $api->create_db();
                break;
            case "oauth_call":
                if (isset($_REQUEST["method"]) && isset($_REQUEST["matchphrase"]) && in_array($_REQUEST["method"], $possible_method)) {
                    $value = $api->oauth_call($_REQUEST["method"], $_REQUEST["matchphrase"], $_REQUEST["audience_phone"]);
                } else {
                    $value = array("Response" => "Error");
                }
Exemplo n.º 7
0
<?php

session_start();
include_once "config.php";
include_once "api.php";
if (!isset($_SESSION["audience_id"])) {
    header('Location: index.php');
} else {
    $audience_id = $_SESSION['audience_id'];
    $project_id = $_SESSION['PROJECT_ID'];
    $api = new Conducttr_API($_SESSION['audience_id']);
    $db = new PDO('mysql:host=' . MYSQL_DBHOST . ';dbname=' . MYSQL_DBNAME, MYSQL_USER, MYSQL_PASS);
    $query = "SELECT * FROM audience WHERE id = '" . $audience_id . "'";
    $st = $db->prepare($query);
    $st->execute();
    //print_r($st->errorInfo());
    $data = $st->fetchAll(PDO::FETCH_ASSOC);
    if (isset($_POST['update'])) {
        if ($_POST['password_new'] != $_POST['password_new_confirm']) {
            echo "<script type='text/javascript'>alert('Error: passwords are different');</script>";
        } else {
            if (!empty($data)) {
                //echo "Old pass: "******"Old pass input: ".md5($_POST['password_old']);
                if (md5($_POST['password_old']) == $data[0]['password']) {
                    ///$query="UPDATE audience SET password=:password WHERE id = :id'
                    $st = $db->prepare('UPDATE audience SET password=:password WHERE id = :id');
                    $st->bindValue(':id', $audience_id, PDO::PARAM_INT);
                    $st->bindValue(':password', md5($_POST['password_new']), PDO::PARAM_STR);
                    if ($st->execute()) {
                        echo "<script type='text/javascript'>alert('Password updated correctly');</script>";
Exemplo n.º 8
0
<?php

session_start();
include_once "config.php";
include_once "api.php";
if (!isset($_SESSION["audience_id"])) {
    header('Location: index.php');
} else {
    $audience_id = $_SESSION['audience_id'];
    $project_id = $_SESSION['PROJECT_ID'];
    $api = new Conducttr_API($_SESSION['audience_id']);
    if (isset($_POST['update'])) {
        $sql_str = array();
        /** IMAGE UPLOAD **/
        if ($_FILES["profileImage"]["size"] != 0) {
            $target_dir = "styles/" . $project_id . "/profiles/";
            $target_file = $target_dir . basename($_FILES["profileImage"]["name"]);
            $uploadOk = 1;
            $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
            $check = getimagesize($_FILES["profileImage"]["tmp_name"]);
            if ($check !== false) {
                //echo "File is an image - " . $check["mime"] . ".<br>";
                $uploadOk = 1;
            } else {
                //echo "File is not an image.<br>";
                $uploadOk = 0;
            }
            if ($_FILES["profileImage"]["size"] > 1000000) {
                //echo "Sorry, your file is too large.<br>";
                $uploadOk = 0;
            }