A-2 About Page
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="logo"></div>
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="about_page">
<div id="names">
<a href="At_Bats.html">At Bats</a><br />
<a href="Single.html">Single</a><br />
<a href="Double.html">Double</a><br />
<a href="Triple.html">Triple</a><br />
<a href="Home_Run.html">Home Run</a><br />
<a href="RBI.html">RBI</a><br />
<a href="Strike_Outs.html">Strike Outs</a><br />
<a href="Walks.html">Walks/HBP</a><br />
<a href="OBP.html">OBP</a><br />
<a href="AVG.html">AVG</a><br />
</div>
<div class="history">
<h2><i>Some History</i></h2>
<p class="small_text">Baseball evolved from the British
game of rounders, and is a cousin to cricket in that it also involves two
teams that alternate on defense and
offense and involve throwing a ball to a batsman who
attempts to "bat" it away and run safely to a base. The first documentation
of base ball is in 1838, but there
are references to a game of base ball going back to the
late 1700s.
</p>
<br>
<p class="small_text">Softball, especially fast-pitch
softball, is considered mostly a women's game in the 21st century. But it
didn't begin that way - it began as
an offshoot of baseball for men that could be played
indoors in the winter. It was first played in 1887 with a boxing glove rolled
up into a ball (which was soft) and
fielders didn't wear gloves.
</p>
</div>
</div>
</div>
</body>
</html>
A-3 Parents/Coaches Page
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="logo"></div>
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="parents_page">
<div id="names">
<a href="login.html">Login</a><br />
<a href="registration.html">Register</a><br />
</div>
<div class="history">
<h2 align="center"><i>Welcome Parents, Coaches, &
Players</i></h2>
<br>
<p id="font">Hello This section you can login from or
register. Once you are registered you will be
able to view stats of the players. If you are a coach you
will get rights to also add stats and update.
</div>
</div>
</div>
</body>
</html>
A-4 Registration Page
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="register_page">
<div id="names">
<a href="login.html">Login</a><br />
<a href="registration.html">Register</a><br />
</div>
<div class="history">
<form action="registration.php" method="post" >
<br>
<p><span class="error">* required field.</span></p>
<br>
<label>First Name</label><span
class='error'>*</span><br>
<input type="text" name="firstname"><br>
<label>Last Name</label><span
class='error'>*</span><br>
<input type="text" name="lastname"><br>
<label>Address</label><span
class='error'>*</span><br>
<input type="text" name="address"><br>
<label>City</label><span class='error'>*</span><br>
<input type="text" name="city"><br>
<label>State</label><span class='error'>*</span><br>
<select name="state" onChange="combo(this, 'state')">
<option value="">Select One</option><option
value="AL">AL</option><option value="AK">AK</option>
<option value="AZ">AZ</option><option
value="AR">AR</option><option value="CA">CA</option>
<option value="CO">CO</option><option
value="CT">CT</option><option value="DE">DE</option>
<option value="FL">FL</option><option
value="GA">GA</option><option value="HI">HI</option>
<option value="ID">ID</option><option
value="IL">IL</option><option value="IN">IN</option>
<option value="IA">IA</option><option
value="KS">KS</option><option value="KY">KY</option>
<option value="LA">LA</option><option
value="ME">ME</option><option value="MD">MD</option>
<option value="MA">MA</option><option
value="MI">MI</option><option value="MN">MN</option>
<option value="MS">MS</option><option
value="MO">MO</option><option value="MT">MT</option>
<option value="NE">NE</option><option
value="NV">NV</option><option value="NH">NH</option>
<option value="NJ">NJ</option><option
value="NM">NM</option><option value="NY">NY</option>
<option value="NC">NC</option><option
value="ND">ND</option><option value="OH">OH</option>
<option value="OK">OK</option><option
value="OR">OR</option><option value="PA">PA</option>
<option value="RI">RI</option><option
value="SC">SC</option><option value="SD">SD</option>
<option value="TN">TN</option><option
value="TX">TX</option><option value="UT">UT</option>
<option value="VT">VT</option><option
value="VA">VA</option><option value="WA">WA</option>
<option value="WV">WV</option><option
value="WI">WI</option><option value="WY">WY</option>
</select><br>
<label>Zip Code</label><span
class='error'>*</span><br>
<input type="text" name="zip"><br>
<label>Phone Number</label><span
class='error'>*</span><br>
<input type="text" name="phone"><label
for='phone'>Ex. 555-555-5555</label><br>
<label>Email</label><span class='error'>*</span><br>
<input type="text" name="email"><br>
<label>User Name</label><span
class='error'>*</span><br>
<input type="text" name="username"><br>
<label>Password</label><span
class='error'>*</span><br>
<input type="password" name="password"><br>
<br>
<input type="submit" name="submit" value="Register">
</form>
</div>
</div>
</div>
</body>
</html>
A-5 Registration PHP
<!DOCTYPE html>
<html>
<?php
if (isset($_POST['submit']))
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$errors= '';
if (strlen($firstname) >=2 and strlen($firstname) <=20)
{
if (strlen($lastname) >=2 and strlen($lastname) <=20)
{
if (strlen($address) >=5 and strlen($address) <=50)
{
if (strlen($city) >=2 and strlen($city) <=20)
{
if(!empty($state))
{
if (preg_match('/^[0-9]{5}$/', $zip))
{
if (ereg('^[2-9]{1}[0-9]{2}-[0-
9]{3}-[0-9]{4}$', $phone))
{
if (preg_match("/^[^0-9][a-
zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-
Z]{2,4}?$/i",$email))
{
if (strlen($username)
>=5 and strlen($username) <=25)
{
if
(strlen($password) >=5 and strlen($password) <=20)
{
// Create
connection
$con=
mysqli_connect("localhost","root","","softball");
// Check
connection
if
(mysqli_connect_errno($con))
{
echo
"Failed to connect to MySQL: " . mysqli_connect_error();
}
//Query
$sql2="INSERT INTO LOGIN (UserName, Password)
VALUES('$username','$password')";
if
(!mysqli_query($con,$sql2))
{
die('Error: ' . mysqli_error($con));
}
$id =
mysqli_insert_id($con);
$sqli =
"INSERT INTO MEMBERS(FirstName, LastName, Address, City, State, Zip,
PhoneNumber, Email, LoginID)
VALUES('$firstname', '$lastname', '$address', '$city', '$state','$zip',
'$phone', '$email', '$id')";
if
(!mysqli_query($con,$sqli))
{
die('Error: ' . mysqli_error($con));
}
//echo
strtr(file_get_contents('http://localhost/Webpage/thankyou.html'), $aParams);
header
('Location: thankyou.html');
mysqli_close($con);
}
else
{
echo
"Please enter a valid alphanumeric password that is at least 5 characters
long.<br/>Click on the back button on browser";
}
}
else
{
echo "Please
enter a username is at least 5 characters long.<br/>Click on the back button
on browser";
}
}
else
{
echo "Please enter a
valid E-Mail address.<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter a valid
phone number.<br/>Click on the back button on browser";
}
}
else
{
echo "Zip Code is
invalid.<br/>Click on the back button on browser";
}
}
else
{
echo "Please select the state";
}
}
else
{
echo "Please enter a valid City name.<br/>Click
on the back button on browser";
}
}
else
{
echo "Please enter a valid address name.<br/>Click on
the back button on browser";
}
}
else
{
echo "Please enter your lastname in the field
provided<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter your firstname in the field provided<br/>Click
on the back button on browser";
}
}
?>
</html>
A-6 Login Page
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="login_page">
<div id="names">
<a href="login.html">Login</a><br />
<a href="registration.html">Register</a><br />
</div>
<div class="history">
<form action="login.php" method="post">
<br>
<table>
<tr>
<td>
Username:
</td>
<td>
<input type="text" name="username"><br>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr>
</table>
<input type="submit" name="submit" value="Log-in">
</form>
</div>
</div>
</div>
</body>
</html>
A-7 Login PHP
<!DOCTYPE html>
<html>
<?php
if(isset($_POST['submit']))
{
// Create connection
$con= mysql_connect("localhost","root","")
or die("Error connecting to database.");
//Connect to database
mysql_select_db("softball",$con)
or die("Couldn't select the database.");
//search the databse for the user name and password
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$sql = mysql_query("SELECT * FROM LOGIN WHERE
UserName='$username' AND Password='$password' LIMIT 1");
if(mysql_num_rows($sql) == 1)
{
$row = mysql_fetch_array($sql);
session_start();
$_SESSION['username'] = $row['UserName'];
$_SESSION['admin'] = $row['Adminstrator'];
$_SESSION['logged'] = TRUE;
include("successful_login.php"); // Modify to go to the
page you would like
exit;
}
else
{
header ('Location: login.html');
exit;
}
}
?>
</html>
A-8 Login Successful PHP
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="logo"></div>
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="parents_page">
<div id="names">
<a href="stats_output.html">Show Stats</a><br>
<a href="player_stats.html">Enter Stats</a><br />
</div>
<div class="history">
<?PHP
if(!$_SESSION['logged'])
{
header("Location: login.html");
exit;
}
echo '<h2 id="bold">Welcome, '.$_SESSION['username'].'</h2>';
?>
<p id="font" class="center">Now on the left side there is tabs to
look at stats for the players (Stats),
enter the stats for a player (Enter Stats), and logout
(logout).
</p>
</div>
</div>
</div>
</body>
</html>
A-9 Stats Entry Page
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="register_page">
<div id="names">
<a href="stats_output.html">Show Stats</a><br />
<a href="player_stats.html">Enter Stats</a><br />
</div>
<div class="history">
<form action="player_stats.php" method="post" >
<p id="bold">Enter Player Stats</p>
<br>
<table>
<tr>
<td>
<label>Team Name</label>
</td>
<td>
<label>City</label>
</td>
<td>
<label>State</label>
</td>
</tr>
<tr>
<td>
<input type="text" name="teamname">
</td>
<td>
<input type="text" name="city">
</td>
<td>
<select name="state"
onChange="combo(this, 'state')">
<option value="">Select
One</option><option value="AL">AL</option><option value="AK">AK</option>
<option
value="AZ">AZ</option><option value="AR">AR</option><option
value="CA">CA</option>
<option
value="CO">CO</option><option value="CT">CT</option><option
value="DE">DE</option>
<option
value="FL">FL</option><option value="GA">GA</option><option
value="HI">HI</option>
<option
value="ID">ID</option><option value="IL">IL</option><option
value="IN">IN</option>
<option
value="IA">IA</option><option value="KS">KS</option><option
value="KY">KY</option>
<option
value="LA">LA</option><option value="ME">ME</option><option
value="MD">MD</option>
<option
value="MA">MA</option><option value="MI">MI</option><option
value="MN">MN</option>
<option
value="MS">MS</option><option value="MO">MO</option><option
value="MT">MT</option>
<option
value="NE">NE</option><option value="NV">NV</option><option
value="NH">NH</option>
<option
value="NJ">NJ</option><option value="NM">NM</option><option
value="NY">NY</option>
<option
value="NC">NC</option><option value="ND">ND</option><option
value="OH">OH</option>
<option
value="OK">OK</option><option value="OR">OR</option><option
value="PA">PA</option>
<option
value="RI">RI</option><option value="SC">SC</option><option
value="SD">SD</option>
<option
value="TN">TN</option><option value="TX">TX</option><option
value="UT">UT</option>
<option
value="VT">VT</option><option value="VA">VA</option><option
value="WA">WA</option>
<option
value="WV">WV</option><option value="WI">WI</option><option
value="WY">WY</option>
</select>
</td>
</tr>
</table>
<table>
<tr>
<td>
<label>Sport</label>
</td>
<td>
<label>Division</label>
</td>
</tr>
<tr>
<td>
<select name="sport"
onChange="combo(this, 'state')">
<option value="">Select
One</option>
<option
value="Baseball">Baseball</option>
<option
value="Softball">Softball</option>
</select>
</td>
<td>
<input type="text" name="division">
</td>
</tr>
</table>
<table>
<tr>
<td>
<label>First Name</label>
</td>
<td>
<label>Last Name</label>
</td>
<td>
<label>Birthdate <i
class="error">ex.YYYY-MM-DD</i></label>
</td>
</tr>
<tr>
<td>
<input type="text"
name="firstname">
</td>
<td>
<input type="text" name="lastname">
</td>
<td>
<input type="text" name="birthday">
</td>
</tr>
</table>
<br>
<label><b>At Bats</b></label>
<select name="atbats">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Singles</b></label>
<select name="singles">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Doubles</b></label>
<select name="doubles">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Triples</b></label>
<select name="triples">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select><br><br>
<label><b>Home Run</b></label>
<select name="homerun">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Walks</b></label>
<select name="walks">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>RBI</b></label>
<select name="rbi">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>HBP</b></label>
<select name="hbp">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select><br><br>
<label><b>Strikeouts</b></label>
<select name="strikeouts">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Drop 3rd Strike</b></label>
<select name="drop3strike">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Sac</b></label>
<select name="sac">
<option value="">Select One</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select><br><br>
<input type="submit" name="submit" value="Submit
Stats">
</form>
</div>
</div>
</div>
</body>
</html>
A-10 Stats Entry PHP
<!DOCTYPE html>
<html>
<?php
if (isset($_POST['submit']))
{
$teamname = $_POST['teamname'];
$city = $_POST['city'];
$state = $_POST['state'];
$sport = $_POST['sport'];
$division = $_POST['division'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$birthday = $_POST['birthday'];
$atbats = $_POST['atbats'];
$singles = $_POST['singles'];
$doubles = $_POST['doubles'];
$triples = $_POST['triples'];
$homerun = $_POST['homerun'];
$walks = $_POST['walks'];
$rbi = $_POST['rbi'];
$hbp = $_POST['hbp'];
$strikeouts = $_POST['strikeouts'];
$drop3strike = $_POST['drop3strike'];
$sac = $_POST['sac'];
$errors= '';
if (strlen($teamname) >=2 and strlen($teamname) <=25)
{
if (strlen($city) >=2 and strlen($city) <=25)
{
if(!empty($state))
{
if(!empty($sport))
{
if (strlen($division) >=2 and strlen($division)
<=10)
{
if (strlen($firstname) >=2 and
strlen($firstname) <=20)
{
if (strlen($lastname) >=2 and
strlen($lastname) <=20)
{
if (ereg('([0-9]{4})-([0-
9]{1,2})-([0-9]{1,2})', $birthday))
{
if(!empty($atbats))
{
if(!empty($singles) >=0)
{
if(!empty($doubles) >= 0)
{
if(!empty($triples) >= 0)
{
if(!empty($homerun) >= 0)
{
if(!empty($walks) >= 0)
{
if(!empty($rbi) >= 0)
{
if(!empty($hbp) >= 0)
{
if(!empty($strikeouts) >= 0)
{
if(!empty($drop3strike) >= 0)
{
if(!empty($sac) >= 0)
{
// Create connection
$con=
mysqli_connect("localhost","root","","softball");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to
MySQL: " . mysqli_connect_error();
}
//Query
$sql2 = "INSERT INTO SPORTS(Sport)
VALUES('$sport')";
if (!mysqli_query($con,$sql2))
{
die('Error: ' .
mysqli_error($con));
}
$id = mysqli_insert_id($con);
$sql3 = "INSERT INTO
TEAMS(TeamName, City, State, Division, SportID)
VALUES('$teamname', '$city',
'$state', '$division', '$id')";
if (!mysqli_query($con,$sql3))
{
die('Error: ' .
mysqli_error($con));
}
$id2 = mysqli_insert_id($con);
$sql1 = "INSERT INTO
PLAYERS(FirstName, LastName, BirthDate, TeamID)
VALUES('$firstname', '$lastname',
'$birthday', '$id2')";
if (!mysqli_query($con,$sql1))
{
die('Error: ' .
mysqli_error($con));
}
$id3 = mysqli_insert_id($con);
$sql4 = "INSERT INTO
STATS(PlayerID, AtBats, Singles, Doubles, Triples, HomeRuns, Walks, RBI,
HitByPitch, StrikeOuts, D3Strike, Sac)
VALUES('$id3', '$atbats',
'$singles', '$doubles', '$triples', '$homerun', '$walks', '$rbi', '$hbp',
'$strikeouts', '$drop3strike', '$sac')";
if (!mysqli_query($con,$sql4))
{
die('Error: ' .
mysqli_error($con));
}
//echo
strtr(file_get_contents('http://localhost/Webpage/thankyou.html'), $aParams);
header ('Location:
stats_output.html');
mysqli_close($con);
}
else
{
echo "Please select from the drop
down box number of Sacrifices<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down
box number of Drop 3rd Strikes<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box
number of Strikeouts<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box number of
hit by pitches<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box number of runs
batted in<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box number of
walks<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box number of home
runs<br/>Click on the back button on browser";
}
}
else
{
echo "Please select from the drop down box number of triples<br/>Click
on the back button on browser";
}
}
else
{
echo
"Please select from the drop down box number of doubles<br/>Click on the back
button on browser";
}
}
else
{
echo
"Please select from the drop down box number of singles<br/>Click on the back
button on browser";
}
}
else
{
echo "Please
select from the drop down box number of at bats<br/>Click on the back button
on browser";
}
}
else
{
echo "Please enter
vaild Birthdate as the example<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter the
players last name<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter the palyer's
first name<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter the division<br/>Click
on the back button on browser";
}
}
else
{
echo "Please select the sport<br/>Click on the
back button on browser";
}
}
else
{
echo "Please select the state<br/>Click on the back
button on browser";
}
}
else
{
echo "Please enter your Team's City in the field
provided<br/>Click on the back button on browser";
}
}
else
{
echo "Please enter your Team Name in the field provided<br/>Click
on the back button on browser";
}
}
?>
</html>
A-11 Stats Output
<!DOCTYPE html>
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div id="container">
<div id="header">
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="register_page">
<div id="names">
<a href="stats_output.html">Show Stats</a><br />
<a href="player_stats.html">Enter Stats</a><br />
</div>
<div class="history">
<form action="stats_output.php" method="post" >
<br>
<p id="bold" class ="center">Enter players name for
stats</p>
<table>
<tr>
<td>
<label>First</label>
</td>
<td>
<input type="text" name="firstname">
</td>
</tr>
<tr>
<td>
<label>Last</label>
</td>
<td>
<input type="text" name="lastname">
</td>
</tr>
</table>
<br>
<input type="submit" name="submit" value="View Stats">
</form>
</div>
</div>
</div>
</body>
</html>
A-12 Output PHP
<!DOCTYPE html>
<html>
<header>
<link href="stylesheet.css" rel="stylesheet" />
</header>
<body>
<!--
$hits + STATS.Walks + STATS.HitByPitch) / (STATS.AtBats + STATS.Sac)) AS
"OBP"
-->
<div id="container">
<div id="header">
<div id="title"><h1>Coaches Best Friend.com</h1></div>
</div>
<div id="menu">
<div id="home">
<a href="home_page.html"><span
class="black">HOME</span></a>
</div>
<div id="about">
<a href="about_page.html"><span
class="black">ABOUT</span></a>
</div>
<div id="parents">
<a href="parents_page.html"><span
class="black">PARENTS/COACHES</span></a>
</div>
</div>
<div id="register_page">
<div id="names">
<a href="stats_output.html">Show Stats</a><br />
<a href="player_stats.html">Enter Stats</a><br />
</div>
<div class="history">
<h2 class="center" id="bold">Stats of Player selected</h2>
<br>
<form>
<?PHP
$first = $_POST['firstname'];
$last = $_POST['lastname'];
// Create connection
$con= mysql_connect("localhost","root","")
or die("Error connecting to database.");
//Connect to database
mysql_select_db("softball",$con)
or die("Couldn't select the database.");
if ((!$first) || (!$last))
{
echo "Please enter a First Name and a
Last Name<br>Click the back button on the browser!";
}
else
{
$sql = "Select DISTINCT TEAMS.TeamName,
PLAYERS.FirstName, PLAYERS.LastName, STATS.AtBats, STATS.Singles,
STATS.Doubles, STATS.Triples,
STATS.HomeRuns, STATS.Walks, STATS.RBI, STATS.HitByPitch, STATS.StrikeOuts,
STATS.D3Strike, STATS.Sac
FROM PLAYERS
INNER JOIN TEAMS ON PLAYERS.TeamID
= TEAMS.TeamID
INNER JOIN STATS ON STATS.PlayerID
= PLAYERS.PlayerID
WHERE FirstName LIKE '%$first' AND
LastName LIKE '%$last'";
$result= mysql_query($sql, $con);
$num_results = mysql_num_rows($result);
for ($i = 0; $i <
mysql_num_rows($result); $i++)
{
$row = mysql_fetch_assoc($result);
$hits = $row['Singles'] +
$row['Doubles'] + $row['Triples'] + $row['HomeRuns'];
$avg = $hits / $row['AtBats'];
$obp = ($hits + $row['Walks'] +
$row['HitByPitch']) / ($row['AtBats'] + $row['Sac']);
print "<b>" . $row['FirstName'] . "
" . $row['LastName'] . "</b>";
echo
"<br><table border='1'>
<tr>
<th>
At Bats
</th>
<th>
Singles
</th>
<th>
Doubles
</th>
<th>
Triples
</th>
<th>
Home Runs
</th>
<th>
Walks
</th>
</tr>
<tr>
<td>"
. $row['AtBats']
.
"</td>
<td>"
. $row['Singles']
.
"</td>
<td>"
. $row['Doubles']
.
"</td>
<td>"
. $row['Triples']
.
"</td>
<td>"
.
$row['HomeRuns'] .
"</td>
<td>"
. $row['Walks'] .
"</td>
</tr>
<tr>
<th>
RBI's
</th>
<th>
Hit by Pitch
</th>
<th>
Strike Outs
</th>
<th>
Drop 3rd Strikes
</th>
<th>
Sacrifices
</th>
</tr>
<tr>
<td>"
. $row['RBI'] .
"</td>
<td>"
.
$row['HitByPitch'] .
"</td>
<td>"
.
$row['StrikeOuts'] .
"</td>
<td>"
.
$row['D3Strike'] .
"</td>
<td>"
. $row['Sac'] .
"</td>
</tr>
</table>
<br>
<table border='1'>
<tr>
<th>
Amount of
Hits
</th>
<td>"
. $hits .
"</td>
</tr>
<tr>
<th>
Batting
Average(AVG)
</th>
<td>"
.
number_format($avg, 3) .
"</td>
</tr>
<tr>
<th>
On Base
Percentage (OBP)
</th>
<td>"
.
number_format($obp, 3) .
"</td>
</tr>
</table>";
}
}
mysql_close($con);
?>
</form>
</div>
</div>
</div>
</body>
</html>
A-13 Style Sheet
body {margin: 0 auto; background-color:black;}
h1 {font-style:italic; font-size:50px; font-family:Times; margin-top:5px;}
li {margin:0;}
p {margin:0;}
h2 {margin-bottom:0;}
ul {margin:0;}
#bold {text-align:center; font-size:30px; color:red;}
.class {text-align:center;}
#head {text-align:center;}
#container { width:800px; height:800px; background-color:gray; margin: 0 auto;
border-radius:25px}
.small_text{font-size:16px;}
/* Header Section */
#header { width:800px; height:150px; background-color:#ed2913; background-
image: url('baseball_softball.jpg'); border-top-left-radius:25px; border-top-
right-radius:25px}
#title {text-align:center;color:#0C0C0C}
/* Menu- tabs */
#menu {width:800px; height:25px; background-image: url('baseball_grass.jpg');}
#home, #about, #pics, #coaches {width:70px; height:25px; float:left; padding-
left:5px;}
#parents {width:80px; height:25px; float:left;}
.black {color:black;}
/* Main Page */
#main_page { width:800px; height:625px; background-color:#ED2913;
color:#24F2E8; border-bottom-left-radius:25px; border-bottom-right-
radius:25px}
#main_top {
padding:20px;
width:760px;
height:325px;
font-size:30px;
font-family: cursive;
font-style:italic;
text-align:center;
}
#main_bottom {font-family: Times New Roman;
font-size: 30px;
height: 280px;
text-align: left;
width: 780px;
padding:10px;
}
/* About Page */
#about_page, #parents_page , #coaches_page, #login_page, #register_page {
width:796px;
height:621px;
background-color:white;
overflow:auto;
color:black;
padding:2px;
border-bottom-left-radius:25px;
border-bottom-right-radius:25px;
}
#names {
width:75px;
height:611px;
float:left;
border:5px solid yellow;
border-radius:25px;
text-align:center;
}
.history {
width:691px;
height:611px;
float:left;
padding-left:5px;
padding-right:5px;
border:5px solid blue;
border-radius:25px;
font-family: cursive;
}
.center {
text-align:center;
}
#font {font-size:15px;}
/*Registration Page
Form attributes */
.error {color: #FF0000;}

Capstone Website Code

  • 1.
    A-2 About Page <!DOCTYPEhtml> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="logo"></div> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <div id="about_page"> <div id="names"> <a href="At_Bats.html">At Bats</a><br /> <a href="Single.html">Single</a><br /> <a href="Double.html">Double</a><br /> <a href="Triple.html">Triple</a><br /> <a href="Home_Run.html">Home Run</a><br /> <a href="RBI.html">RBI</a><br /> <a href="Strike_Outs.html">Strike Outs</a><br /> <a href="Walks.html">Walks/HBP</a><br /> <a href="OBP.html">OBP</a><br /> <a href="AVG.html">AVG</a><br /> </div> <div class="history"> <h2><i>Some History</i></h2> <p class="small_text">Baseball evolved from the British game of rounders, and is a cousin to cricket in that it also involves two teams that alternate on defense and offense and involve throwing a ball to a batsman who attempts to "bat" it away and run safely to a base. The first documentation
  • 2.
    of base ballis in 1838, but there are references to a game of base ball going back to the late 1700s. </p> <br> <p class="small_text">Softball, especially fast-pitch softball, is considered mostly a women's game in the 21st century. But it didn't begin that way - it began as an offshoot of baseball for men that could be played indoors in the winter. It was first played in 1887 with a boxing glove rolled up into a ball (which was soft) and fielders didn't wear gloves. </p> </div> </div> </div> </body> </html> A-3 Parents/Coaches Page <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="logo"></div> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <div id="parents_page"> <div id="names">
  • 3.
    <a href="login.html">Login</a><br /> <ahref="registration.html">Register</a><br /> </div> <div class="history"> <h2 align="center"><i>Welcome Parents, Coaches, & Players</i></h2> <br> <p id="font">Hello This section you can login from or register. Once you are registered you will be able to view stats of the players. If you are a coach you will get rights to also add stats and update. </div> </div> </div> </body> </html> A-4 Registration Page <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div>
  • 4.
    <div id="register_page"> <div id="names"> <ahref="login.html">Login</a><br /> <a href="registration.html">Register</a><br /> </div> <div class="history"> <form action="registration.php" method="post" > <br> <p><span class="error">* required field.</span></p> <br> <label>First Name</label><span class='error'>*</span><br> <input type="text" name="firstname"><br> <label>Last Name</label><span class='error'>*</span><br> <input type="text" name="lastname"><br> <label>Address</label><span class='error'>*</span><br> <input type="text" name="address"><br> <label>City</label><span class='error'>*</span><br> <input type="text" name="city"><br> <label>State</label><span class='error'>*</span><br> <select name="state" onChange="combo(this, 'state')"> <option value="">Select One</option><option value="AL">AL</option><option value="AK">AK</option> <option value="AZ">AZ</option><option value="AR">AR</option><option value="CA">CA</option> <option value="CO">CO</option><option value="CT">CT</option><option value="DE">DE</option> <option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option> <option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option> <option value="IA">IA</option><option value="KS">KS</option><option value="KY">KY</option> <option value="LA">LA</option><option value="ME">ME</option><option value="MD">MD</option> <option value="MA">MA</option><option value="MI">MI</option><option value="MN">MN</option> <option value="MS">MS</option><option value="MO">MO</option><option value="MT">MT</option> <option value="NE">NE</option><option value="NV">NV</option><option value="NH">NH</option> <option value="NJ">NJ</option><option value="NM">NM</option><option value="NY">NY</option> <option value="NC">NC</option><option value="ND">ND</option><option value="OH">OH</option> <option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option> <option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option> <option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option> <option value="VT">VT</option><option value="VA">VA</option><option value="WA">WA</option> <option value="WV">WV</option><option
  • 5.
    value="WI">WI</option><option value="WY">WY</option> </select><br> <label>Zip Code</label><span class='error'>*</span><br> <inputtype="text" name="zip"><br> <label>Phone Number</label><span class='error'>*</span><br> <input type="text" name="phone"><label for='phone'>Ex. 555-555-5555</label><br> <label>Email</label><span class='error'>*</span><br> <input type="text" name="email"><br> <label>User Name</label><span class='error'>*</span><br> <input type="text" name="username"><br> <label>Password</label><span class='error'>*</span><br> <input type="password" name="password"><br> <br> <input type="submit" name="submit" value="Register"> </form> </div> </div> </div> </body> </html> A-5 Registration PHP <!DOCTYPE html> <html> <?php if (isset($_POST['submit'])) { $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; $username = $_POST['username']; $password = $_POST['password']; $errors= ''; if (strlen($firstname) >=2 and strlen($firstname) <=20) { if (strlen($lastname) >=2 and strlen($lastname) <=20) {
  • 6.
    if (strlen($address) >=5and strlen($address) <=50) { if (strlen($city) >=2 and strlen($city) <=20) { if(!empty($state)) { if (preg_match('/^[0-9]{5}$/', $zip)) { if (ereg('^[2-9]{1}[0-9]{2}-[0- 9]{3}-[0-9]{4}$', $phone)) { if (preg_match("/^[^0-9][a- zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA- Z]{2,4}?$/i",$email)) { if (strlen($username) >=5 and strlen($username) <=25) { if (strlen($password) >=5 and strlen($password) <=20) { // Create connection $con= mysqli_connect("localhost","root","","softball"); // Check connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //Query $sql2="INSERT INTO LOGIN (UserName, Password) VALUES('$username','$password')"; if (!mysqli_query($con,$sql2)) { die('Error: ' . mysqli_error($con)); } $id = mysqli_insert_id($con); $sqli =
  • 7.
    "INSERT INTO MEMBERS(FirstName,LastName, Address, City, State, Zip, PhoneNumber, Email, LoginID) VALUES('$firstname', '$lastname', '$address', '$city', '$state','$zip', '$phone', '$email', '$id')"; if (!mysqli_query($con,$sqli)) { die('Error: ' . mysqli_error($con)); } //echo strtr(file_get_contents('http://localhost/Webpage/thankyou.html'), $aParams); header ('Location: thankyou.html'); mysqli_close($con); } else { echo "Please enter a valid alphanumeric password that is at least 5 characters long.<br/>Click on the back button on browser"; } } else { echo "Please enter a username is at least 5 characters long.<br/>Click on the back button on browser"; } } else { echo "Please enter a valid E-Mail address.<br/>Click on the back button on browser"; } } else { echo "Please enter a valid phone number.<br/>Click on the back button on browser"; } } else { echo "Zip Code is invalid.<br/>Click on the back button on browser"; } } else { echo "Please select the state"; }
  • 8.
    } else { echo "Please entera valid City name.<br/>Click on the back button on browser"; } } else { echo "Please enter a valid address name.<br/>Click on the back button on browser"; } } else { echo "Please enter your lastname in the field provided<br/>Click on the back button on browser"; } } else { echo "Please enter your firstname in the field provided<br/>Click on the back button on browser"; } } ?> </html> A-6 Login Page <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents">
  • 9.
    <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <div id="login_page"> <divid="names"> <a href="login.html">Login</a><br /> <a href="registration.html">Register</a><br /> </div> <div class="history"> <form action="login.php" method="post"> <br> <table> <tr> <td> Username: </td> <td> <input type="text" name="username"><br> </td> </tr> <tr> <td> Password: </td> <td> <input type="password" name="password"> </td> </tr> </table> <input type="submit" name="submit" value="Log-in"> </form> </div> </div> </div> </body> </html> A-7 Login PHP <!DOCTYPE html> <html> <?php if(isset($_POST['submit'])) { // Create connection $con= mysql_connect("localhost","root","") or die("Error connecting to database."); //Connect to database mysql_select_db("softball",$con)
  • 10.
    or die("Couldn't selectthe database."); //search the databse for the user name and password $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $sql = mysql_query("SELECT * FROM LOGIN WHERE UserName='$username' AND Password='$password' LIMIT 1"); if(mysql_num_rows($sql) == 1) { $row = mysql_fetch_array($sql); session_start(); $_SESSION['username'] = $row['UserName']; $_SESSION['admin'] = $row['Adminstrator']; $_SESSION['logged'] = TRUE; include("successful_login.php"); // Modify to go to the page you would like exit; } else { header ('Location: login.html'); exit; } } ?> </html> A-8 Login Successful PHP <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="logo"></div> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span
  • 11.
    class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <divid="parents_page"> <div id="names"> <a href="stats_output.html">Show Stats</a><br> <a href="player_stats.html">Enter Stats</a><br /> </div> <div class="history"> <?PHP if(!$_SESSION['logged']) { header("Location: login.html"); exit; } echo '<h2 id="bold">Welcome, '.$_SESSION['username'].'</h2>'; ?> <p id="font" class="center">Now on the left side there is tabs to look at stats for the players (Stats), enter the stats for a player (Enter Stats), and logout (logout). </p> </div> </div> </div> </body> </html> A-9 Stats Entry Page <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="title"><h1>Coaches Best Friend.com</h1></div>
  • 12.
    </div> <div id="menu"> <div id="home"> <ahref="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <div id="register_page"> <div id="names"> <a href="stats_output.html">Show Stats</a><br /> <a href="player_stats.html">Enter Stats</a><br /> </div> <div class="history"> <form action="player_stats.php" method="post" > <p id="bold">Enter Player Stats</p> <br> <table> <tr> <td> <label>Team Name</label> </td> <td> <label>City</label> </td> <td> <label>State</label> </td> </tr> <tr> <td> <input type="text" name="teamname"> </td> <td> <input type="text" name="city"> </td> <td> <select name="state" onChange="combo(this, 'state')"> <option value="">Select One</option><option value="AL">AL</option><option value="AK">AK</option> <option value="AZ">AZ</option><option value="AR">AR</option><option
  • 13.
    value="CA">CA</option> <option value="CO">CO</option><option value="CT">CT</option><option value="DE">DE</option> <option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option> <option value="ID">ID</option><optionvalue="IL">IL</option><option value="IN">IN</option> <option value="IA">IA</option><option value="KS">KS</option><option value="KY">KY</option> <option value="LA">LA</option><option value="ME">ME</option><option value="MD">MD</option> <option value="MA">MA</option><option value="MI">MI</option><option value="MN">MN</option> <option value="MS">MS</option><option value="MO">MO</option><option value="MT">MT</option> <option value="NE">NE</option><option value="NV">NV</option><option value="NH">NH</option> <option value="NJ">NJ</option><option value="NM">NM</option><option value="NY">NY</option> <option value="NC">NC</option><option value="ND">ND</option><option value="OH">OH</option> <option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option> <option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option> <option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option> <option value="VT">VT</option><option value="VA">VA</option><option value="WA">WA</option> <option value="WV">WV</option><option value="WI">WI</option><option value="WY">WY</option> </select> </td> </tr> </table> <table> <tr> <td> <label>Sport</label> </td> <td> <label>Division</label>
  • 14.
    </td> </tr> <tr> <td> <select name="sport" onChange="combo(this, 'state')"> <optionvalue="">Select One</option> <option value="Baseball">Baseball</option> <option value="Softball">Softball</option> </select> </td> <td> <input type="text" name="division"> </td> </tr> </table> <table> <tr> <td> <label>First Name</label> </td> <td> <label>Last Name</label> </td> <td> <label>Birthdate <i class="error">ex.YYYY-MM-DD</i></label> </td> </tr> <tr> <td> <input type="text" name="firstname"> </td> <td> <input type="text" name="lastname"> </td> <td> <input type="text" name="birthday"> </td> </tr> </table> <br> <label><b>At Bats</b></label> <select name="atbats"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option>
  • 15.
    <option value="7">7</option> <option value="8">8</option> <optionvalue="9">9</option> <option value="10">10</option> </select> <label><b>Singles</b></label> <select name="singles"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>Doubles</b></label> <select name="doubles"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>Triples</b></label> <select name="triples"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select><br><br> <label><b>Home Run</b></label> <select name="homerun"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option>
  • 16.
    <option value="4">4</option> <option value="5">5</option> <optionvalue="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>Walks</b></label> <select name="walks"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>RBI</b></label> <select name="rbi"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>HBP</b></label> <select name="hbp"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select><br><br> <label><b>Strikeouts</b></label> <select name="strikeouts"> <option value="">Select One</option> <option value="0">0</option>
  • 17.
    <option value="1">1</option> <option value="2">2</option> <optionvalue="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>Drop 3rd Strike</b></label> <select name="drop3strike"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <label><b>Sac</b></label> <select name="sac"> <option value="">Select One</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select><br><br> <input type="submit" name="submit" value="Submit Stats"> </form> </div> </div> </div> </body> </html>
  • 18.
    A-10 Stats EntryPHP <!DOCTYPE html> <html> <?php if (isset($_POST['submit'])) { $teamname = $_POST['teamname']; $city = $_POST['city']; $state = $_POST['state']; $sport = $_POST['sport']; $division = $_POST['division']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $birthday = $_POST['birthday']; $atbats = $_POST['atbats']; $singles = $_POST['singles']; $doubles = $_POST['doubles']; $triples = $_POST['triples']; $homerun = $_POST['homerun']; $walks = $_POST['walks']; $rbi = $_POST['rbi']; $hbp = $_POST['hbp']; $strikeouts = $_POST['strikeouts']; $drop3strike = $_POST['drop3strike']; $sac = $_POST['sac']; $errors= ''; if (strlen($teamname) >=2 and strlen($teamname) <=25) { if (strlen($city) >=2 and strlen($city) <=25) { if(!empty($state)) { if(!empty($sport)) { if (strlen($division) >=2 and strlen($division) <=10) { if (strlen($firstname) >=2 and strlen($firstname) <=20) { if (strlen($lastname) >=2 and strlen($lastname) <=20) { if (ereg('([0-9]{4})-([0- 9]{1,2})-([0-9]{1,2})', $birthday)) { if(!empty($atbats)) { if(!empty($singles) >=0) {
  • 19.
    if(!empty($doubles) >= 0) { if(!empty($triples)>= 0) { if(!empty($homerun) >= 0) { if(!empty($walks) >= 0) { if(!empty($rbi) >= 0) { if(!empty($hbp) >= 0) { if(!empty($strikeouts) >= 0) { if(!empty($drop3strike) >= 0) { if(!empty($sac) >= 0) { // Create connection $con= mysqli_connect("localhost","root","","softball"); // Check connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
  • 20.
    //Query $sql2 = "INSERTINTO SPORTS(Sport) VALUES('$sport')"; if (!mysqli_query($con,$sql2)) { die('Error: ' . mysqli_error($con)); } $id = mysqli_insert_id($con); $sql3 = "INSERT INTO TEAMS(TeamName, City, State, Division, SportID) VALUES('$teamname', '$city', '$state', '$division', '$id')"; if (!mysqli_query($con,$sql3)) { die('Error: ' . mysqli_error($con)); } $id2 = mysqli_insert_id($con); $sql1 = "INSERT INTO PLAYERS(FirstName, LastName, BirthDate, TeamID) VALUES('$firstname', '$lastname', '$birthday', '$id2')"; if (!mysqli_query($con,$sql1)) { die('Error: ' . mysqli_error($con)); } $id3 = mysqli_insert_id($con);
  • 21.
    $sql4 = "INSERTINTO STATS(PlayerID, AtBats, Singles, Doubles, Triples, HomeRuns, Walks, RBI, HitByPitch, StrikeOuts, D3Strike, Sac) VALUES('$id3', '$atbats', '$singles', '$doubles', '$triples', '$homerun', '$walks', '$rbi', '$hbp', '$strikeouts', '$drop3strike', '$sac')"; if (!mysqli_query($con,$sql4)) { die('Error: ' . mysqli_error($con)); } //echo strtr(file_get_contents('http://localhost/Webpage/thankyou.html'), $aParams); header ('Location: stats_output.html'); mysqli_close($con); } else { echo "Please select from the drop down box number of Sacrifices<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of Drop 3rd Strikes<br/>Click on the back button on browser"; } } else
  • 22.
    { echo "Please selectfrom the drop down box number of Strikeouts<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of hit by pitches<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of runs batted in<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of walks<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of home runs<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of triples<br/>Click on the back button on browser"; }
  • 23.
    } else { echo "Please select fromthe drop down box number of doubles<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of singles<br/>Click on the back button on browser"; } } else { echo "Please select from the drop down box number of at bats<br/>Click on the back button on browser"; } } else { echo "Please enter vaild Birthdate as the example<br/>Click on the back button on browser"; } } else { echo "Please enter the players last name<br/>Click on the back button on browser"; } } else { echo "Please enter the palyer's first name<br/>Click on the back button on browser"; } } else { echo "Please enter the division<br/>Click on the back button on browser"; } } else { echo "Please select the sport<br/>Click on the back button on browser"; } } else { echo "Please select the state<br/>Click on the back button on browser"; }
  • 24.
    } else { echo "Please enteryour Team's City in the field provided<br/>Click on the back button on browser"; } } else { echo "Please enter your Team Name in the field provided<br/>Click on the back button on browser"; } } ?> </html> A-11 Stats Output <!DOCTYPE html> <html> <head> <link href="stylesheet.css" rel="stylesheet" /> <title></title> </head> <body> <div id="container"> <div id="header"> <div id="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div>
  • 25.
    <div id="register_page"> <div id="names"> <ahref="stats_output.html">Show Stats</a><br /> <a href="player_stats.html">Enter Stats</a><br /> </div> <div class="history"> <form action="stats_output.php" method="post" > <br> <p id="bold" class ="center">Enter players name for stats</p> <table> <tr> <td> <label>First</label> </td> <td> <input type="text" name="firstname"> </td> </tr> <tr> <td> <label>Last</label> </td> <td> <input type="text" name="lastname"> </td> </tr> </table> <br> <input type="submit" name="submit" value="View Stats"> </form> </div> </div> </div> </body> </html> A-12 Output PHP <!DOCTYPE html> <html> <header> <link href="stylesheet.css" rel="stylesheet" /> </header> <body> <!-- $hits + STATS.Walks + STATS.HitByPitch) / (STATS.AtBats + STATS.Sac)) AS "OBP"
  • 26.
    --> <div id="container"> <div id="header"> <divid="title"><h1>Coaches Best Friend.com</h1></div> </div> <div id="menu"> <div id="home"> <a href="home_page.html"><span class="black">HOME</span></a> </div> <div id="about"> <a href="about_page.html"><span class="black">ABOUT</span></a> </div> <div id="parents"> <a href="parents_page.html"><span class="black">PARENTS/COACHES</span></a> </div> </div> <div id="register_page"> <div id="names"> <a href="stats_output.html">Show Stats</a><br /> <a href="player_stats.html">Enter Stats</a><br /> </div> <div class="history"> <h2 class="center" id="bold">Stats of Player selected</h2> <br> <form> <?PHP $first = $_POST['firstname']; $last = $_POST['lastname']; // Create connection $con= mysql_connect("localhost","root","") or die("Error connecting to database."); //Connect to database mysql_select_db("softball",$con) or die("Couldn't select the database."); if ((!$first) || (!$last)) { echo "Please enter a First Name and a Last Name<br>Click the back button on the browser!"; } else { $sql = "Select DISTINCT TEAMS.TeamName,
  • 27.
    PLAYERS.FirstName, PLAYERS.LastName, STATS.AtBats,STATS.Singles, STATS.Doubles, STATS.Triples, STATS.HomeRuns, STATS.Walks, STATS.RBI, STATS.HitByPitch, STATS.StrikeOuts, STATS.D3Strike, STATS.Sac FROM PLAYERS INNER JOIN TEAMS ON PLAYERS.TeamID = TEAMS.TeamID INNER JOIN STATS ON STATS.PlayerID = PLAYERS.PlayerID WHERE FirstName LIKE '%$first' AND LastName LIKE '%$last'"; $result= mysql_query($sql, $con); $num_results = mysql_num_rows($result); for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_assoc($result); $hits = $row['Singles'] + $row['Doubles'] + $row['Triples'] + $row['HomeRuns']; $avg = $hits / $row['AtBats']; $obp = ($hits + $row['Walks'] + $row['HitByPitch']) / ($row['AtBats'] + $row['Sac']); print "<b>" . $row['FirstName'] . " " . $row['LastName'] . "</b>"; echo "<br><table border='1'> <tr> <th> At Bats </th> <th> Singles </th> <th> Doubles </th> <th> Triples </th> <th> Home Runs </th> <th> Walks </th> </tr> <tr> <td>" . $row['AtBats'] .
  • 28.
    "</td> <td>" . $row['Singles'] . "</td> <td>" . $row['Doubles'] . "</td> <td>" .$row['Triples'] . "</td> <td>" . $row['HomeRuns'] . "</td> <td>" . $row['Walks'] . "</td> </tr> <tr> <th> RBI's </th> <th> Hit by Pitch </th> <th> Strike Outs </th> <th> Drop 3rd Strikes </th> <th> Sacrifices </th> </tr> <tr> <td>" . $row['RBI'] . "</td> <td>" . $row['HitByPitch'] . "</td> <td>" . $row['StrikeOuts'] . "</td> <td>" . $row['D3Strike'] . "</td> <td>" . $row['Sac'] . "</td>
  • 29.
    </tr> </table> <br> <table border='1'> <tr> <th> Amount of Hits </th> <td>" .$hits . "</td> </tr> <tr> <th> Batting Average(AVG) </th> <td>" . number_format($avg, 3) . "</td> </tr> <tr> <th> On Base Percentage (OBP) </th> <td>" . number_format($obp, 3) . "</td> </tr> </table>"; } } mysql_close($con); ?> </form> </div> </div> </div> </body> </html> A-13 Style Sheet body {margin: 0 auto; background-color:black;} h1 {font-style:italic; font-size:50px; font-family:Times; margin-top:5px;} li {margin:0;}
  • 30.
    p {margin:0;} h2 {margin-bottom:0;} ul{margin:0;} #bold {text-align:center; font-size:30px; color:red;} .class {text-align:center;} #head {text-align:center;} #container { width:800px; height:800px; background-color:gray; margin: 0 auto; border-radius:25px} .small_text{font-size:16px;} /* Header Section */ #header { width:800px; height:150px; background-color:#ed2913; background- image: url('baseball_softball.jpg'); border-top-left-radius:25px; border-top- right-radius:25px} #title {text-align:center;color:#0C0C0C} /* Menu- tabs */ #menu {width:800px; height:25px; background-image: url('baseball_grass.jpg');} #home, #about, #pics, #coaches {width:70px; height:25px; float:left; padding- left:5px;} #parents {width:80px; height:25px; float:left;} .black {color:black;} /* Main Page */ #main_page { width:800px; height:625px; background-color:#ED2913; color:#24F2E8; border-bottom-left-radius:25px; border-bottom-right- radius:25px} #main_top { padding:20px; width:760px; height:325px; font-size:30px; font-family: cursive; font-style:italic; text-align:center; } #main_bottom {font-family: Times New Roman; font-size: 30px; height: 280px; text-align: left; width: 780px; padding:10px; } /* About Page */ #about_page, #parents_page , #coaches_page, #login_page, #register_page { width:796px; height:621px; background-color:white; overflow:auto; color:black; padding:2px;
  • 31.
    border-bottom-left-radius:25px; border-bottom-right-radius:25px; } #names { width:75px; height:611px; float:left; border:5px solidyellow; border-radius:25px; text-align:center; } .history { width:691px; height:611px; float:left; padding-left:5px; padding-right:5px; border:5px solid blue; border-radius:25px; font-family: cursive; } .center { text-align:center; } #font {font-size:15px;} /*Registration Page Form attributes */ .error {color: #FF0000;}