function fbc_display_login_button($hidden = false) { $user = wp_get_current_user(); if ($user->ID) { // For the moment disallow connecting existing accounts return; } if ($hidden) { $visibility = 'style="visibility:hidden"'; } else { $visibility = ''; } $site_url = get_option('siteurl'); $button = render_fbconnect_button(); echo <<<EOF <div class="fbc_hide_on_login fbc_connect_button_area" {$visibility} id="fbc_login"> <span><small>Connect with your Facebook Account</small></span> <br/> {$button} </div> EOF; }
go_home(); } if ($error) { echo '<div class="error">' . $error . '</div>'; } ?> <!-- Eventually do CSSification --> <div class="register"> <div class="login_sector"> <h2>Do you use Facebook?</h2> Use Facebook to register for The Run Around:<br/><br /> <?php echo render_fbconnect_button('large'); ?> </div> <div class="login_sector_fb"> <h2>Register</h2> <form action="register.php" method="post"> <table> <tr> <td> <label id="label_username" for="username">Username:</input> </td> <td> <input id="username" class="inputtext" type="text" size="20" value="" name="username"/> </td> </tr> <tr>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>MrWQ</title> <link type="text/css" rel="Stylesheet" href="./css/master.css" /> </head> <body> <div id="wrapper"> <div id="nav"> <?php if (!$user) { // DISPLAY PAGE WHEN USER IS NOT LOGGED IN TO FB CONNECT print '<div class="fbconnect_login">'; print render_fbconnect_button('medium'); print '</div>'; } ?> </div> <div id="graphic"> <img src="./img/top-graphic.jpg" width="874" height="168" alt="MrQW" /> </div> <div id="main_links"> <ul> <li <?php print $currhome; ?> ><a href="login.php"><span>Home</span></a></li> <li <?php
function userdata($ir, $lv, $fm, $dosessh = 1) { global $db, $c, $userid, $set, $home, $user, $casino, $twoplayer, $arcade; $IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $db->query("UPDATE users SET laston=unix_timestamp(),lastip='{$IP}' WHERE userid='{$userid}'"); $u = $ir['username']; $bgcolor = 'CDCDCD'; if ($ir['guest'] == 0) { $logouttxt = sprintf('<a href="#" onClick="FB.Connect.logout(function() { refresh_page(); })">' . 'Logout' . '</a>', $_SERVER['REQUEST_URI']); $logouttxt = " | " . $logouttxt; } else { $fb_active_session = FALSE; // DISPLAY PAGE WHEN USER IS NOT LOGGED IN TO FB CONNECT $logouttxt = ' <div class="fbconnect_login" style="display:inline;">'; $logouttxt .= render_fbconnect_button('medium'); $logouttxt .= '</div>'; } print <<<EOF \t\t<body> \t\t<div id="wrapper"> \t\t\t<div id="nav"> \t\t\t\t<div id="logo"> \t\t\t\t\t<img src="./img/logo.jpg" width="55" height="15" alt="MRWQ" /> \t\t\t\t\t<br /><span id="logo_text">Play 2-player games against your friends!</span> \t\t\t\t</div> \t\t\t\t<div id="login"> \t\t\t\t\t<table><tr><td>Welcome, {$ir['username']}</td><td>{$logouttxt}</td></tr></table> \t\t\t\t</div> \t\t\t</div> \t\t\t<div id="graphic"> \t\t\t\t<img src="./img/top-graphic.jpg" width="874" height="168" alt="MrWQ" /> \t\t\t</div> \t\t\t<div id="main_links"> \t\t\t\t<ul> EOF; $htext = ""; $twoptext = ""; $casinotext = ""; $arctext = ""; if ($home == 1) { $htext = " class=\"current\""; } if ($twoplayer == 1) { $twoptext = " class=\"current\""; } if ($casino == 1) { $casinotext = " class=\"current\""; } if ($arcade == 1) { $arctext = " class=\"current\""; } echo <<<EOF \t\t\t\t\t<li {$htext}><a href="index.php"><span>Home</span></a></li> \t\t\t\t\t<li {$twoptext}><a href="twoplayergames.php"><span>2-Player Games</span></a></li> \t\t\t\t\t<li {$casinotext}><a href="casinogames.php"><span>Casino Games</span></a></li> \t\t\t\t\t<li {$arctext}><a href="arcade.php"><span>Arcade Games</span></a></li> \t\t\t\t</ul> \t\t\t</div> \t\t\t<div id="left_nav"> \t\t\t\t<table> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class="header" colspan="2"><center>{$ir['username']} EOF; print "\t\t\t\t\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr valign=\"top\">\n\t\t\t\t\t\t<td class=\"subinfo\" colspan=\"2\">\n\t\t\t\t\t\t\t<div>\n\t\t"; print "<strong>Q-Cash:</strong> {$fm}"; echo <<<EOF \t\t \t\t\t\t\t\t\t</div>\t\t\t \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</table> EOF; global $challengeheadertext; if ($_GET['challengeid']) { include "challenge.php"; } $pendingchal = $db->num_rows($db->query("SELECT `to` FROM challenge WHERE `to`={$userid} AND accepted!={$userid}")); if ($pendingchal) { $tick = $db->query("SELECT * FROM challenge WHERE `to`={$userid} AND accepted!={$userid} ORDER BY rand() LIMIT 1"); $tic = $db->fetch_row($tick); $unamef = $db->fetch_row($db->query("SELECT username,laston FROM users WHERE userid={$tic['from']}")); $gnamef = $db->fetch_row($db->query("SELECT * FROM multgames WHERE short='{$tic['game']}'")); if ($unamef['laston'] > time() - 60 * 15 || $tic['time_left'] > 40) { if ($tic['time_left'] == 86400) { $tleng = "1 day"; } else { if ($tic['time_left'] == 259200) { $tleng = "3 days"; } else { if ($tic['time_left'] == 604800) { $tleng = "1 week"; } else { $tleng = "30 seconds"; } } } $challengeheadertext = "<table class='table' width=95%><tr>"; $challengeheadertext .= "<td id='newsheader'><center><strong>{$unamef['username']} challenged you to a game of {$gnamef['name']} with turns of {$tleng} each!\n\t\t<br /><a href='index.php?challengeid={$tic['id']}&act=accept'><font color=green>Accept</font></a> | <a href='index.php?challengeid={$tic['id']}&act=reject'><font color=red>Reject</font></a></strong></center></td>"; $challengeheadertext .= "</tr></table><br />"; } } $challhead = $db->query("SELECT * FROM challenge WHERE (`to` = {$userid} OR `from`={$userid}) AND accepted!={$userid}"); $challheada = $db->num_rows($challhead); if ($challheada > 0) { echo <<<EOF \t\t\t\t<table> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class="header" colspan="2">My Challenges</td> \t\t\t\t\t</tr> \t EOF; while ($chh = $db->fetch_row($challhead)) { if ($userid == $chh['from']) { if ($chh['accepted'] != $chh['to']) { $usrfull = $db->fetch_row($db->query("SELECT username FROM users WHERE userid='{$chh['to']}'")); $gamfull = $db->fetch_row($db->query("SELECT * FROM multgames WHERE short='{$chh['game']}'")); if (!$usrfull['username']) { $friendinf = $user->fbc_get_friend_name($chh['to']); if (empty($friendinf)) { $usrfull['username'] = "******"; } else { $usrfull['username'] = $friendinf[0]['first_name'] . ' ' . $friendinf[0]['last_name']; } } print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"sub\" colspan=\"2\">» {$usrfull['username']} - {$gamfull['name']} <br />\n\t\t\t\t\t\t<center><i>Pending...</i><a href='index.php?challengeid={$chh['id']}&act=cancel'><font color=red>Cancel?</font></a></center></td>\n\t\t\t\t</tr>\n\t\t\t\t"; } else { $usrfull = $db->fetch_row($db->query("SELECT username FROM users WHERE userid='{$chh['to']}'")); $gamfull = $db->fetch_row($db->query("SELECT * FROM multgames WHERE short='{$chh['game']}'")); print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"sub\" colspan=\"2\">» {$usrfull['username']} - {$gamfull['name']} <br />\n\t\t\t\t\t\t<center><font color=green>Live! <a href='sb_game.php?g={$chh['game']}&act=joining&challengeid={$chh['id']}&id={$chh['room']}'>Join Game!</a></font></center></td>\n\t\t\t\t</tr>\n\t\t\t\t"; } } else { $usrfull = $db->fetch_row($db->query("SELECT username,laston FROM users WHERE userid='{$chh['from']}'")); $gamfull = $db->fetch_row($db->query("SELECT * FROM multgames WHERE short='{$chh['game']}'")); if ($usrfull['laston'] > time() - 60 * 15 || $chh['time_left'] > 40) { print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"sub\" colspan=\"2\">» {$usrfull['username']} - {$gamfull['name']} <br />\n\t\t\t\t\t\t<center><a href='?challengeid={$chh['id']}&act=accept'><font color=green>Accept</font></a> / <a href='?challengeid={$chh['id']}&act=reject'><font color=red>Reject</font></a></center></td>\n\t\t\t\t</tr>\n\t\t\t\t"; } else { print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"sub\" colspan=\"2\">» {$usrfull['username']} - {$gamfull['name']} <br />\n\t\t\t\t\t\t<center><font color=grey>-Friend Currently Offline</font></center></td>\n\t\t\t\t</tr>\n\t\t\t\t"; } } } print "</table>"; } echo <<<EOF \t\t\t\t<table> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class="header" colspan="2">2-Player Games I'm In</td> \t\t\t\t\t</tr> \t EOF; $gan22 = $db->query("SELECT * FROM multgames ORDER BY name ASC"); $tot = 0; while ($gan2 = $db->fetch_row($gan22)) { $short = $gan2['short']; $roomsin = check_room($short, $ir['userid']); if (is_array($roomsin)) { foreach ($roomsin as &$room) { $ar = $db->fetch_row($db->query("SELECT p1,p2,turn FROM {$short}_room WHERE id={$room}")); if ($ar['p1'] && $ar['p2']) { if ($ar['turn'] == $ir['userid']) { $acttxt = "<font color=green><b>Play</b></font>"; } else { $acttxt = "Play"; } } else { $acttxt = "Waiting"; } echo <<<EOF \t\t\t\t\t<tr> \t\t\t\t\t\t<td class="sub" colspan="2">» {$gan2['name']} [<a href='sb_game.php?g={$short}&id={$room}'>{$acttxt}</a>] [<a href='sb_rooms.php?g={$short}&act=leave&id={$room}'>Leave</a>]</td> \t\t\t\t\t</tr> EOF; } $tot++; } } if ($tot == 0) { echo <<<EOF \t\t\t\t<tr> \t\t\t\t\t<td class="sub" colspan="2"><i>None... :(</i></td> \t\t\t\t</tr> EOF; } else { print "\n\t\t<tr><td class=\"sub\" colspan=\"2\" align='center'>\n\t\tIf 'Play' is green, it's your turn.\n\t\t</td></tr>\n\t\t"; } print "</table>"; if ($ir['guest'] == 0) { $friends = $user->fbc_get_all_friends(); $friusers = array(); foreach ($friends as $friend) { $friusers[] = $friend['uid']; } $allfriends = implode(",", $friusers); if (empty($friend)) { $html = '<table>'; $html .= '<tr><td class="header" colspan="2">' . $title . '</td></tr>'; $html .= '<tr><td class="sub" colspan="2">No friends here!</td></tr>'; $html .= '</table>'; print $html; } else { $html = '<table>'; $html .= '<tr><td class="header" colspan="2"><center>Friends on our Site</center></td></tr>'; $fris = $db->query("SELECT * FROM users WHERE userid IN ({$allfriends}) ORDER BY laston DESC"); while ($fri = $db->fetch_row($fris)) { $newname = str_replace(" ", "_", $fri['username']); $laston = $fri['laston']; $ctime = time(); $last15 = time() - 60 * 15; $last60 = time() - 60 * 60; if ($laston > $last15) { $lastonimg = "<img src='images/online.png'> "; } else { if ($laston > $last60) { $lastonimg = "<img src='images/idle.png'> "; } else { $lastonimg = "<img src='images/offline.png'> "; } } $html .= '<tr><td class="sub" colspan="2">' . $lastonimg . '<a href="javascript:void(0)" onclick="javascript:chatWith(\'' . $newname . '\');"> ' . $fri['username'] . '</a> [<a href="challenge.php?act=prechallenge&player=' . $fri['userid'] . '">C</a>] [<a target="_blank" href="http://www.facebook.com/profile.php?id=' . $fri['userid'] . '">P</a>]</td></tr>'; } $html .= '<tr><td class="sub" colspan="2" align="center"><b>C</b> = Challenge | <b>P</b> = Profile</td></tr> <tr><td class="sub" colspan="2" align="center">Click a friend\'s name to chat.</td></tr></table>'; print $html; } } else { $fb_active_session = FALSE; // DISPLAY PAGE WHEN USER IS NOT LOGGED IN TO FB CONNECT print '<br /><div class="fbconnect_login"><center>'; print render_fbconnect_button('medium'); print '</center></div>'; } echo <<<EOF \t\t\t</div> \t\t\t<div id="content"> EOF; print $challengeheadertext; }
function render_logged_out_index() { $html = '<div class="fbconnect_title_wrapper">'; $html .= '<h2>Login to this application using facebook</h2>'; $html .= '</div>'; if (is_fbconnect_enabled()) { $html .= '<div class="fbconnect_login">'; $html .= render_fbconnect_button('medium'); $html .= '</div>'; } return $html; }
function render_logged_out_index() { $html = '<img src="http://www.somethingtoputhere.com/therunaround/images/runaround_image.jpg" class="welcome_img" />'; $html .= '<div class="welcome_dialog">'; $html .= '<h3>Welcome to the Run Around</h3>'; $html .= '<p>This is a simple site where you can log your runs and chart progress on your ' . 'workout routine.</p>'; $html .= '<div class="clearfix"><form action="login.php" method="post">' . '<div class="login_sector">' . '<div class="login_prompt"><b>Login</b>:</div>' . '<div class="clearfix"><label>Username:</label><input name="username" class="inputtext" type="text" size="20" value="" /></div> ' . '<div class="clearfix"><label>Password:</label><input name="password" class="inputtext" type="password" size="20" value=""/></div> ' . '<input id="submit" class="inputsubmit" value="Login" name="submit" type="submit" />' . '</div>'; if (is_fbconnect_enabled()) { $html .= '<div class="login_sector_fb">'; $html .= '<div class="login_prompt">Or <b>login</b> with Facebook:</div>'; $html .= render_fbconnect_button('medium'); $html .= '</div>'; } $html .= '</form></div>'; $html .= '<div class="signup_container"> ' . 'Don\'t have an account? <a href="register.php">Register Now!</a> '; $html .= '</div></div>'; return $html; }