Exemple #1
0
    <body>
        <?php 
session_start();
include_once '../classes/profile.php';
include_once '../classes/address.php';
include_once '../funcs.php';
include_once '../conf.php';
if (!isset($_POST['submit'])) {
    echo '<h1>You have done it again, you silly!</h1>';
    exit;
}
$disease = $_POST['desc'];
$json = getProfiles();
$profiles = json_decode($json);
foreach ($profiles as $profile) {
    if ($profile->profileID == $_POST['profileID']) {
        array_push($profile->diseases, $disease);
        $profile->token = $_SESSION['token'];
        echo $insert = editProfile($profile);
        break;
    }
}
if (empty($insert)) {
    header("Location: http://" . redirectLink() . "/SafeFront/index.php?action=profileDiseases&profileID=" . $_POST['profileID'] . "&method=Disease%20added%20Sucessfully");
} else {
    echo $insert;
}
?>
    </body>
</html>
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Client-ID ' . $client_id));
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
        $out = curl_exec($curl);
        curl_close($curl);
        $pms = json_decode($out, true);
        $url = $pms['data']['link'];
        $profile->photoLink = $url;
        /* if ($url != "") {
           echo "<h2>Uploaded Without Any Problem</h2>";
           echo "<img src='$url'/>";
           echo $url;
           } else {
           echo "<h2>There's a Problem</h2>";
           echo $pms['data']['error']['message'];
           } */
    }
}
$profile->token = $_SESSION['token'];
$insert = insertProfile($profile);
if (empty($insert)) {
    header("Location: http://" . redirectLink() . "/SafeFront/index.php?action=listProfiles&method=Profile inserted sucessfully");
} else {
    echo $insert;
}
//TODO  chamar web services com isto tudo
?>
    </body>
</html>
Exemple #3
0
                        <ul class="dropdown-menu">
                            <li><a href="./index.php?action=registerProfile">Add Profile</a></li>
                            <li><a href="./index.php?action=listProfiles">List Profiles</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Mobiles</li>
                            <li><a href="./index.php?action=androidActions">Android Actions</a></li>
                            <li><a href="./index.php?action=requestedPhotos">Requested Photos</a></li>
                            <li><a href="./index.php?action=requestedPoke">Requested Poke</a></li>
                        </ul>
                    </li>';
}
?>
                </ul>
                <ul class="nav pull-right">
                    <?php 
$link = "https://" . redirectAuthLink() . "/login?redirecturl=http://" . redirectLink() . "/SafeFront/index.php";
$imageSRC = "https://developers.google.com/+/images/branding/sign-in-buttons/Red-signin_Long_base_44dp.png";
$height = 150;
$widht = 150;
if (isset($_SESSION['id'])) {
    $link = "http://" . homeLink() . "/SafeFront/index.php?action=logout";
    $imageSRC = "./img/LogOut.png";
    $height = 70;
    $widht = 70;
    echo '<li class="active"><a href="">' . $_SESSION['name'] . '</a></li>';
    echo '<img style="" width="40" height="40" src="' . $_SESSION['picture'] . '">';
    echo '<a href="' . $link . '">&nbsp;&nbsp;<button class="btn btn-danger" style="vertical-align: top" type="button">Logout</button></a>';
} else {
    echo '<a href="' . $link . '"><img style="vertical-align: text-top;" width="' . $widht . '" height="' . $height . '"src="' . $imageSRC . '"></a>';
}
?>
Exemple #4
-1
function getJSON()
{
    parse_str($_SERVER['QUERY_STRING']);
    if (is_null($token)) {
        return 'token not set';
    }
    $fileContent = file_get_contents("https://*****:*****@" . authLink() . "/getData?token=" . $token);
    if ($fileContent == '') {
        header("Location: https://" . redirectAuthLink() . "/login?redirecturl=http://" . redirectLink() . "/SafeFront/index.php");
        /* Redirect browser */
        exit;
    }
    $json = json_decode($fileContent, true);
    if (!isset($_SESSION['id'])) {
        $_SESSION['id'] = getID($json);
        $_SESSION['name'] = getName($json);
        $_SESSION['picture'] = getImage($json);
        $_SESSION['mail'] = getEmail($json);
        $_SESSION['token'] = $token;
        $_SESSION['mobileImagesRequest'];
        $_SESSION['hasNewImages'] = 0;
        $_SESSION['gotOne'] = 0;
        $_SESSION['pokeReady'] = 0;
        $_SESSION['poke'];
        //$tokenToUse = getServerAccess();
        insertUser($token);
    }
    return null;
}