OSdata.com: holistic issues 

OSdata.com

example source code
team.php

    Building a game — open source code This is the actual source code from a new web game. See the game at thissideofsanity.com and read how this was built starting at example code.

    This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.

    Copyright 2013, 2014 Milo (for software), Distribution and website handled by Strazbick.com

    Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    This narrative uses anchor links so that you can follow the building of this software in chronological order. Go to software explanation to start reading. Go to thissideofsanity.com to see the working software.

Google

example source code
team.php

    This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.

flash sports
first pass

    Started work on the flash sports pages.

    The goal here is a self-contained flash sports feed.

    This work is split off into its own set of example code for the time being.

    Initial skeleton file:

<?php

   // include function files for this application
   require_once('../php/accounts.php');
   require_once('../php/datavalidation.php');
   require_once('../php/databasefunctions.php');
   require_once('../php/newregistration.php');
   require_once('../php/login.php');
   require_once('../sports/teamfunctions.php');

/* SESSION MANAGEMENT */
SessionManagement(); /* located in accounts.php */
$accountemail = CheckValidUser(); /* located in accounts.php */
/* empty string if not signed in, or string holds the official account email */

/* READ GET */
/* INITIALIZATIONS */
if(empty($_GET))
  { /*go away if no valid requests */

    $noinput = true;

  }
else
  { /*collect input from user */

    $teamnumber = $_GET['team']; /* a team page, ID by number */

  } /* END if on GET */

/* GET DATABASE INFO */
/* DATABASE CONNECTION */
$result = ConnectCelebDataBase(0); /* located in databasefunctions.php */

/* GET OLD ROUND NUMBER */
$newquery = "SELECT * FROM teams WHERE keynumber=".$teamnumber." ";

$selectresult = mysql_query($newquery);

$row = mysql_fetch_array($selectresult);

$kind = $row["kind"];
$school = $row["school"];
$shortname = $row["shortname"];
$nickname = $row["nickname"];
$city = $row["city"];
$state = $row["state"];

/* SET DEFAULTS */
if ($kind == 'C') /* college team */
  {
    $fullteamname = $school.' '.$nickname;
    $shortteamname = $shortname.' '.$nickname;
  }



?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en" dir="ltr">
<head><title>SlamZee Flash Sports<?php echo ' '.$fullteamname; ?></title>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<meta name="revisit-after" content="15 days"></meta>
<meta name="robots" content="all"></meta>
<meta name="description" content="SlamZee -- Flash Sports <?php echo ' '.$fullteamname; ?>."></meta>
<meta name="keywords" content="SlamZee sports"></meta>
<meta name="creation" content="2013-12-21"></meta>
<meta name="last-modified" content="2013-12-21"></meta>
<meta name="MSSmartTagsPreventParsing" content="TRUE"></meta>
<link rel="stylesheet" type="text/css" href="../style.css">

<!--asdf CSS style-->
    <style type="text/css">

      body {
        margin:0;
        padding:0;
      }
    </style>

<!--asdf JavaScript-->
<script type="text/javascript">
<!--

 /* GLOBALS (property of window object) */
<!-- this javascript snippet draws the temptation box -->
var temptationdelaytime = 6000; /* 6 second delay */
var intervalhandle;

var hourcounter = 0;
var minutecounter = 0;
var secondcounter = 0;
var tenthsecondcounter = 0;
var hundredthsecondcounter = 0;

function checktimedispatcher() {

//document.getElementById("slamcounterelement").innerHTML= slamcounter; /* DEBUG */

var currentdate=new Date();
var currenttime= currentdate.toLocaleTimeString();
/*document.getElementById("timerelement").innerHTML= currenttime;*/

/* knocked out so that we look better - restore for debugging */
/* hundredthsecondcounter = hundredthsecondcounter +1;
document.getElementById("hundredthelement").innerHTML= hundredthsecondcounter;
if ( (hundredthsecondcounter%10) == 0 ) {
  tenthsecondcounter = tenthsecondcounter +1;
  document.getElementById("tenthelement").innerHTML= tenthsecondcounter;
  if ( (tenthsecondcounter%10) == 0) {
    secondcounter = secondcounter + 1;
    document.getElementById("secondelement").innerHTML= secondcounter;
    if ( (secondcounter%60) == 0) {
      minutecounter = minutecounter + 1;
      document.getElementById("minuteelement").innerHTML= minutecounter;
      if ( (minutecounter%60) == 0) {
        hourcounter = hourcounter + 1;
        document.getElementById("hourelement").innerHTML= hourcounter;
      } /* END hour check */
/*    } /* END minute check */
/*  } /* END second check */
/*} /* END tenth second check */

} /* END FUNCTION checktimedispatcher */



/*!--asdf on window load init--*/


//-->
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>

<!--asdf main HTML-->
<body text="#ffffff" bgcolor="black" onload="intervalhandle=window.setInterval(function() {checktimedispatcher() },10);">

<div id="mainpage">

<h1 align="center">SlamZee Flash Sports
<br><?php echo ' '.$shortteamname; ?></h1>

<div id="gamecontent">

<h3 align="center"><a href="./sports.php">return to sports page</a>
<br><a href="../game.php">play the game</a></h3>

</div><!--gamecontent-->

<?php

/* check to see if an incoming new registration form and process as needed */

if ( $_GET['action'] == 'logout' )
  {
    require_once('../php/logout.php');
    echo '<div id="loginarea">';
    ProcessLogOut();
    $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */
//echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */
    echo '<p align="center">please play again soon!</p>';
    echo '</div><!--loginarea-->';
    DisplayLoginForm(); /* and show the login form */
  }
elseif ($accountemail != '')
  {
    echo '<div id="loginarea">';
    echo '<p align="center">currently logged in as ',GetAccountNameFromAccountNumber(GetAccountNumberFromEmail($accountemail)),'<br>';
//echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */
    echo '<a href="../index.php?action=logout">logout</a></p>';
    echo '<h3 align="center" id="topstartgamearea"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>';
    echo '</div><!--loginarea-->';
  }
elseif ( $_GET['action'] == 'createaccount' )
  {
    echo '<div id="loginarea">';
    ProcessRegistrationForm();
    $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */
//echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */
    echo '<p align="center"><a href="../index.php?action=logout">logout</a></p>';
    echo '<h3 align="center"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>';
    echo '</div><!--loginarea-->';
  }
elseif ( $_GET['action'] == 'login' )
  {
    echo '<div id="loginarea">';
    ProcessLoginForm();
    $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */
//echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */
    echo '<p align="center"><a href="../index.php?action=logout">logout</a></p>';
    echo '<h3 align="center"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>';
    echo '</div><!--loginarea-->';
  }
else
  {
    DisplayLoginForm(); /* default to showing a login form */
//echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */
    echo '<p align="center">login to play now!<br>or sign up for free!</p>';
  }

?>

</div><!--mainpage-->

</body>
</html>

return to explanation of sports code

add bowl game function
second pass

    Add a function to give bowl game information.

<?php

DisplayBowlInfo($teamnumber);

?>

return to explanation of sports code

return to explanation of source code


OSdata.com is used in more than 300 colleges and universities around the world

Find out how to get similar high web traffic and search engine placement.


OSdata.com is used in more than 300 colleges and universities around the world

Read details here.


    A web site on dozens of operating systems simply can’t be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.

    Click here for our privacy policy.


previous page next page
previous page next page

home page


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2013 Milo

    Last Updated: December 26, 2013

    Created: December 21, 2013

previous page next page
previous page next page