Пример #1
0
 $gb4 = round($available4 / 1000000, 1);
 $gb4_display = $gb4 <= $validGB_display ? "<span class=\"warning\">{$gb4}</span>" : "<span class=\"checked\">{$gb4}</span>";
 #############  Login Section for Remote HPC ###############
 ### show or hide login/logout/refresh blocks depending on token status ###
 $conditional_display_logged_out = $access_token == "" ? "" : "display_off";
 # display 'logged out' message only if user is logged out (no access token)
 $conditional_display_login = $access_token == "" && $refresh_token == "" ? "" : "display_off";
 # display 'login' option only if user is logged out (no access token) and no refresh token is present
 $conditional_display_logout = $access_token != "" ? "" : "display_off";
 # display login details and 'logout' option only if user is logged in.
 $conditional_display_refresh = $refresh_token != "" ? "" : "display_off";
 # display 'refresh' option only if refresh_token is present
 if ($GSQ_CompResources == "Remote" || $GTH_CompResources == "Remote") {
     $logged_in = "";
     // the grey box at top of form showing logged in user
     $auth_url = get_auth_url("Admin");
     //login_functions.inc.php
     /*/debug: 
     		$id=$_SESSION['id'];
     		$usersession=$_SESSION['username'];
     		$userpost=$_POST['username'];
     		$access_token_session=$_SESSION['access_token'];
     		$http_code_session=$_SESSION['http_code'];
     		$posted_action=$_POST['action']; //now posted to login.php; should be blank.
     #		$timeout=$_SESSION['timeout'];
     		$time=time();
     		$timeU=date("U");
     		echo "id=$id; login-msg=$login_msg; http_code=$http_code_session; username=$username; auth_url=$auth_url; user-session=$usersession; user-post=$userpost; token= $access_token; token-session=$tokensession; posted_action=$action; now=$now; expires-session=$expires; lifespan-session =$lifespan; issued-session=$issued; timeU=$timeU; ";
     // end debug */
     $login_redirect = $refresh_token == "" ? "<div style=\"background: #CCC; border: 2px solid yellow\" width=\"93%\" >\n        <p style=\"padding:2px\"><a  href=\"/XGDB/jobs/login.php?id={$ID}&#login\">Go to login page</a></p>\t\t\n\t\t</div>" : "<div style=\"background: #CCC; border: 2px solid #888\" >\n        <span class=\"smallerfont {$conditional_display_refresh}\">\n            <form action=\"/XGDB/jobs/login_exec.php\" method=\"post\">\n                <input type=\"hidden\" name=\"action\" value=\"refresh\" />\n                <input type=\"hidden\" name=\"redirect\" value=\"view\" />\n                <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n                <input type=\"submit\" name=\"refresh\" value=\" refresh\">\n            </form>\n        </span>\n\t\t</div>";
     //Determine login status and display appropriate text/form.
Пример #2
0
<?php

session_start();
header("Content-type:text/html; charset=UTF-8;");
define('IN_ECS', true);
if (file_exists(dirname(__FILE__) . '/config/taobao_config.php')) {
    include_once dirname(__FILE__) . '/config/taobao_config.php';
} else {
    echo "后台未正确安装或未启用淘宝插件,请联系管理员!<a href='/'>点击返回</a>";
    exit;
}
//保存时间请求参数
$state = time();
$_SESSION["tb_state"] = $state;
$ret_url = get_auth_url($state);
//保存来路URL,最后将返回
$back_url = empty($_GET['callback']) ? "/index.php" : $_GET['callback'];
$_SESSION["back_url"] = $back_url;
header("location:" . $ret_url);
//页面调用
function get_auth_url($state)
{
    $redirect_url = "http://" . $_SERVER["HTTP_HOST"] . str_replace("tb_index.php", "tb_callback.php", $_SERVER["REQUEST_URI"]);
    $url = "https://oauth.taobao.com/authorize";
    //https://oauth.taobao.com/authorize?response_type=code&client_id=21234035&redirect_uri=http://www.zocms.com/oauthLogin.php&state=1
    $params = array("response_type" => "code", "client_id" => APP_KEY, "redirect_uri" => $redirect_url, "state" => $state);
    foreach ($params as $key => $val) {
        $get[] = $key . "=" . urlencode($val);
    }
    return $url . "?" . join("&", $get);
}
Пример #3
0
<html>
<head>
<?php 
require "common/globals.php";
require "common/oauth_helper.php";
require "new-feed-owners/getreqtoken.php";
?>
<title>Pay Per Tweet</title>
</head>
<body>
<h2>Welcome to Pay Per Tweet, an application which allows you to generate income from your twitter feed.</h2>
<p>To start making money from your tweets you'll need to make sure your Twitter feed is private. Once you've done this, all you need to do is authorise the Pay Per Tweet&#153; application to manage your private Twitter feed.</p> 
<p>To authorise Pay Per Tweet&#153; to manage your feed, click the following link and log in with your Twitter details:</p>
<p><a href="<?php 
get_auth_url();
?>
">Authorise Pay Per Tweet&#153;</a></p>
<p>When you complete the authorisation process you'll be redirected back to the Pay Per Tweett&#153; website to complete the setup process.</p>
</body>
</html>