/scotlandyardphp/header.php
PHP | 418 lines | 326 code | 78 blank | 14 comment | 17 complexity | bc334adff82b8363c963ca654dd20053 MD5 | raw file
Possible License(s): GPL-2.0
- <?php
- require 'openid/openid.php';
- try {
- # Change 'localhost' to your domain name.
- $openid = new LightOpenID('http://www.hamte.com/scotlandyard');
- if(!$openid->mode) {
- if(isset($_POST['openid_identifier'])) {
- $openid->identity = $_POST['openid_identifier'];
- $openid->required = array( 'namePerson/friendly',
- 'contact/email',
- 'namePerson',
- 'birthDate',
- 'person/gender',
- 'contact/postalCode/home',
- 'contact/country/home',
- 'pref/language',
- 'pref/timezone',
- 'namePerson/first',
- 'namePerson/last',
- 'pref/language'
- );
- header('Location: ' . $openid->authUrl());
- }
- }elseif($openid->mode == 'cancel') {
- //echo 'User has canceled authentication!';
- } else {
- //echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
-
- if($openid->validate()){
- $arr = $openid->getAttributes();
-
- header('Location: connect_through_openid.php?gender=M&img=images/profile/d0.gif&userid=' . $arr['contact/email'] . '&email=' . $arr['contact/email'] . '&name=' . $arr['namePerson/first'] . ' ' . $arr['namePerson/last']);
-
- //setcookie("user", $arr['namePerson/first'], time()+3600);
- //setcookie("email", $arr['contact/email'], time()+3600);
- //header('Location: index.php');
-
- }
-
- }
- } catch(ErrorException $e) {
- echo $e->getMessage();
- }
-
- $email = nz($_COOKIE['email']);
- $img = nz($_COOKIE['img']);
- $f_name = nz($_COOKIE['f_name']);
- $l_name = nz($_COOKIE['l_name']);
- $n_name = nz($_COOKIE['n_name']);
-
- function nz($v,$r=''){
- if(isset($v) && !is_null($v)){
- return $v;
- }
- return $r;
- }
-
- header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
-
- ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <!--
- Author : Hussain Al-Mutawa
- Date : 02-08-2011
- main page for scotlandyard game
- -->
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
-
- <head>
-
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>ScotlandYard Game</title>
-
- <link href="css/jquery/alerts.css" type="text/css" rel="stylesheet" />
- <link href="css/ui-lightness/jquery-ui-1.8.14.custom.css" type="text/css" rel="stylesheet" />
-
- <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
-
- <style type="text/css">
- * {
- font-family: Arial,Trebuchet MS, Tahoma, Verdana, sans-serif
- }
- .divider
- {
- vertical-align:top;
-
- }
- .loc-icon{
- background-position:left;
- background-attachement:fixed;
- background-repeat:no-repeat;
- font-weight:normal;
- }
- .loc-icon-facebook{
- background-image:url(images/icons/Facebook-icon.png);
- }
- .loc-icon-facebook{
- background-image:url(images/icons/google-icon.png);
- }
- .mainLinks{
- background-color:black;
- padding:5pt;
- color:#eee;
- }
- .subLinks{
- background-color:grey;
- padding:5pt;
- color:#ccc;
- }
- #op1 {color:#000}
- #op1 a.sublink_a { color:navy }
- .mainLinks a,.subLinks a{
- color:#fff;
- text-decoration:none;
- margin:3pt;
- }
- div.mainLinks a:hover {
- text-decoration:underline;
- }
- div.subLinks a:hover {
- text-decoration:underline;
- }
- div#save_reg_result,div#login_result,div#game_result,div#whoisonline_result{
- background-color:rgb(230,241,243);
- padding:5pt;
- text-align:center;
- }
- thead tr td {
- font-weight:bold;
- color:green;
- }
- img.loading{
- vertical-align:middle;
- align:center;
- width:100%;
- height:100%;
- }
- div#signup_div_t{
- color:#ffffff;
- font-size:larger;
- font-weight:bold;
- background-color:rgb(100,110,230);
- padding:3pt;
- margin-top:0;
- margin-bottom:3px;
- margin-left:0;
- margin-right:0;
- }
- body{
- background-image: url(images/body-bg.png);
- background-attachment: scroll;
- background-position:top;
- background-repeat: repeat-x;
- background-color: rgb(230,241,243)
- }
- </style>
- <script type="text/javascript" src="js/jQuery.js"></script>
-
- <script type="text/javascript" src="js/jquery.alerts.js"></script>
-
- <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
- <script type="text/javascript" src="js/jquery.corner.js"></script>
-
-
-
- <script src="http://jqueryui.com/ui/jquery.ui.core.js"></script>
- <script src="http://jqueryui.com/ui/jquery.ui.widget.js"></script>
- <script src="http://jqueryui.com/ui/jquery.ui.accordion.js"></script>
-
- <script type="text/javascript">
- //<!--
-
- jQuery.ajaxSetup({
- beforeSend: function() {
- $('#loader').show()
- },
- complete: function(){
- $('#loader').hide()
- },
- success: function() {}
- });
-
- function load_dialog(dialog){
- $( "#" + dialog ).css("display","normal");
- $( "#" + dialog ).css("visibility","visible");
- $( "#" + dialog ).dialog({modal:true});
- }
-
- function unload_dialog(dialog){
- $( "#" + dialog ).dialog().dialog( "destroy" );
- }
-
- function setCookie(c_name,value,exdays)
- {
- var exdate=new Date();
- exdate.setDate(exdate.getDate() + exdays);
- var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
- document.cookie=c_name + "=" + c_value;
- }
-
-
- //-->
- </script>
-
- </head>
- <body><div id="fb-root"></div>
-
-
-
- <script type="text/javascript">
- FB.init({
- appId : '196915460364965',
- status : true, // check login status
- cookie : true, // enable cookies to allow the server to access the session
- xfbml : true//, // parse XFBML
- //channelURL : 'http://www.hamte.com/scotlandyard/channel.html', // channel.html file
- //oauth : true // enable OAuth 2.0
- });
-
-
- function after_facebook_login(){
-
- $('#div_form').html("<span style='color:orange;padding:10pt'>"+
-
- "<img src='images/loading-2.gif' width='105' height='105' alt='loading' style='vertical-align:middle;display:inline-block' /> <strong>You are authenticated</strong> . Redirecting, just wait a second..."
-
- +"</span>");
-
- FB.getLoginStatus(function(login_status){
- if(login_status.session){
- FB.api('/me',
- function(user){
- if(user.id){
-
- FB.api(
- {
- method: 'fql.query',
- query: 'SELECT uid,name,email,sex FROM user WHERE uid='+user.id
- },
- function(response) {
-
- if(response[0].uid==user.id){
-
- $.get('connect_through_facebook.php?gender='+response[0].sex+'&img=https://graph.facebook.com/' + user.id + '/picture&userid='+user.id+'&name='+response[0].name+'&email='+response[0].email,
- function(result){
- if(result=='ok'){
- location.reload();
- }else{
- $('#div_form').html("<span style='font-size:larger;font-weight:bold;color:red'>"+result+"</span>");
- }
- }
- );
-
- }
-
- }
- );
-
- }
- }
-
- );
- }
- });
- }
-
-
- function getCookie(c_name)
- {
- var i,x,y,ARRcookies=document.cookie.split(";");
- for (i=0;i<ARRcookies.length;i++)
- {
- x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
- y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
- x=x.replace(/^\s+|\s+$/g,"");
- if (x==c_name)
- {
- return unescape(y);
- }
- }
- }
-
- </script>
-
-
-
- <div id="l1201" class="mainLinks">
- <a href="index.php">Home</a> |
- <a href="about.php">About</a> |
- <a href="bugs.php">Report a bug</a> |
- <a href="privacy.php">Privacy policy</a> |
- <a href="tac.php">Terms and conditions</a> |
- <a href="feedback.php">Feedback</a> |
- <a href="faq.php">FAQ</a> |
- </div>
- <div style="display:inline-block;vertical-align:top;float:left;margin:10pt">
- <a href="index.php">
- <img src="images/scotland-icon.gif" height="68" width="68" style="border:0px;width:68px;height:68px" alt="logo" />
- </a>
- </div>
- <h1 style="color: #ffffff">Welcome to ScotlandYard Game</h1>
- <p style="color: #ffffff">A project developed by Team 2, Software Engineering C
- from School of Engineering and Advanced
- Technology (SEAT) at Massey University in
- Palmerston North, New Zealand. © 2011</p>
-
- <br />
-
-
- <div id="l1202" class="subLinks">
- <div id="op1" style="background-color:white;margin:0.2em;border:1px solid #eeeeee">
- <table width="100%">
- <tr>
- <?php
- if(!(isset($_COOKIE['user']) && $_COOKIE['user']!='')){
- ?>
- <td>
- <!--<a href="javascript:void($.get('signup.php',function(data){$('#div_form').html(data);}))">Sign Up</a> |
- <a href="javascript:void($.get('facebook_registeration.php',function(data){$('#div_form').html(data);}))">Facebook registeration</a> |
- -->
-
- <table><tr><td>
-
- Guest </td><td>|
-
-
- <!--
- <div style='background-image:url(images/facebook_button.png);background-repeat:no-repeat;background-position:top;background-attachement:fixed;height:24px;width:101px;text-align:center;padding-left:12pt;padding-top:3pt;font-weight:bold;font-family:tahoma;font-size:8pt;display:inline-block'><a href="#" onclick="$.get('facebook_registeration.php',function(data){$('#div_form').html(data);})">Register</a></div>
- -->
-
- <fb:login-button perms="email,user_checkins" onlogin="after_facebook_login()">Log In</fb:login-button>
-
- </td><td>
-
-
- <form action="" method="post">
-
- <!--
- <select id="openid_identifier" name="openid_identifier" >
- <option value="https://www.google.com/accounts/o8/id">Google</option>
- <option value="http://openid.yahoo.com/">Yahoo</option>
- <option value="http://orange.fr/">Orange</option>
- </select>
- -->
- <input type="hidden" value="https://www.google.com/accounts/o8/id" name="openid_identifier" id="openid_identifier" />
- <button>
- <img style="vertical-align:middle;display:block-inline" src="images/openid.png" height="20" width="20" alt="g" />
- <span style="font-size:9pt">Google OpenID OAuth</span>
- </button>
- </form>
-
-
- <!--<a href="#" onclick="FB.Connect.logout(function (){ document.location='http://www.hamte.com/scotlandyard/index.php'; });">-->
-
-
- </td></tr></table>
- <!--<a href="javascript:void($.get('login.php',function(data){$('#div_form').html(data);}))">Log In</a>-->
- </td><td>
- <?php
- }else{
- $links = "
- <a class='sublink_a' href='#'>test link 1</a> |
- <a class='sublink_a' href='#'>test link 2</a> |
- <a class='sublink_a' href='#'>test link 3</a>
- ";
- echo("<td>$links</td><td align='right'><span> welcome ");
- ?>
- <div style='color:black;display:inline-block;vertical-align:middle' id="connected_status">Guest</div>
- <script type="text/javascript">
-
- $('#connected_status').html("<table><tr><td>" +
- "<img class='profile_img_of_" + getCookie('n_name') + "' height='32' width='32' src='"+ getCookie('img') +"' /></td>" +
- "<th>" + getCookie('n_name').replace('+',' ') +
- "</th><td><pre>" +
- " [" + getCookie('userid') + "]" +
- "</pre></td></tr></table>"
- );
-
- </script>
-
- <button onclick="$.get('logout.php',function(){location.reload()})">
- <img style="vertical-align:middle;display:block-inline" src="images/openid.png" height="20" width="20" alt="g" />
- <img id="fb_logout_image" src="http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif"
- style="vertical-align:middle;border: none;" alt="Connect" />
- </button>
-
- <?php } // end if-else ?>
- </td></tr></table>
- </div></div>
- <script type="text/javascript">
- //<!--
-
-
-
- $("button").button();
- $(document).ready(function(){
- $('#l1201').corner();
- $('#l1202').corner();
- $('#op1').corner();
- });
- //-->
- </script>
- <br />
-
- <?php
-
- if(nz($email)=='')
- include 'social.txt';
-
- ?>
-
- <div id="div_form" style="align:center;padding:5pt"></div>
-
- <?php
- function finish(){
- echo '</body></html>';
- }
- ?>