<?php
        require("/home/hogdb/public_html/wp-load.php");
	include("/home/hogdb/Connections/db_connect.php");
	$nav_select = "roster";
?>
<?php $y = $_GET['year'];?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title><?php echo $y; ?> Arkansas Razorbacks Football Roster | Hog Database</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<meta name="description" content="The <?php echo $y; ?> Arkansas Razorback Football Roster" />
		<meta name="keywords" content="Arkansas Razorback Roster, <?php echo $y; ?>, stats, History, Arkansas Football, Broyles, Petrino, Hogs" />
		<link rel="canonical" href="http://www.hogdb.com/db/roster/name-<?php echo $y; ?>/" />
		<meta property="og:title" content="The <?php echo $y; ?> Arkansas Razorback Football Roster"/>
		<meta property="og:site_name" content="hogdb.com"/>
		<meta property="og:image" content="http://cdn.hogdb.net/img/logos/lrg/121.gif"/>
		<!--Stylesheets-->
			<link href="http://wp.hogdb.net/wp-content/themes/punchcut/stylesheets/master.css" type="text/css" media="screen" rel="stylesheet" />
		<!--[if lt IE 8]>
			<link rel="stylesheet" type="text/css" media="screen" href="http://wp.hogdb.net/wp-content/themes/punchcut/stylesheets/ie.css" />
			<script type="text/javascript" src="http://wp.hogdb.net/wp-content/themes/punchcut/javascripts/nav.js"></script>
		<![endif]-->
		<!--[if IE 6]>
			<link rel="stylesheet" type="text/css" media="screen" href="http://wp.hogdb.net/wp-content/themes/punchcut/stylesheets/ie6.css" />
			<script type="text/javascript" src="http://wp.hogdb.net/wp-content/themes/punchcut/javascripts/pngfix.js"></script>
			<script type="text/javascript"> DD_belatedPNG.fix('#navigation, div.comments a');</script>
		<![endif]-->
		<!--WP Hook-->
		<!-- End WP Hook-->
	<body <?php body_class(); ?>>
		<div id="fb-root"></div>
		<div id="dbtitle">
			<div id="dbheader">
			<h1><a href="http://www.hogdb.com/">Arkansas Razorback Football</a></h1>
			</div>
		</div>
		<?php include "/home/hogdb/public_html/hdb_menu.php";?>
		<div id="headertitle">
			<h2><a href="http://www.hogdb.com/roster/">Yearly Roster</a></h2>
			<ul id="headerlinks">
				<li>LINKS</li>
				<li>Another Link</li>
			</ul>
		</div>
		<div class="container">
			<div class="wrapper">
				<div class="full-box">
					<h2><?php echo $y; ?> Arkansas Razorback Football Roster</h2>
					<h3></h3>
					<div id="yearly">

						<table width="910" cellpadding="5" cellspacing="0" class="tablesorter">
							<thead class="table_head">
								<tr>
									<TH width="60px" align="left" class="table_head">No.</TH>
									<TH width="190px" align="left" class="table_head" colspan="2">Name</TH>
									<TH width="72px" align="left" class="table_head">Position</TH>
									<TH width="72px" align="left" class="table_head">Height</TH>
									<TH width="72px" align="left" class="table_head">Weight</TH>
									<TH width="72px" align="left" class="table_head">Class</TH>
									<TH width="72px" align="left" class="table_head">Exp</TH>
									<TH width="300px" align="left" class="table_head">Hometown / Previous School</TH>
								</TR>
							</thead>
							
							<?php
							include_once('/home/hogdb/Connections/environment.php');
							$link = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD);
							mysql_select_db(MYSQL_DATABASE, $link);
							$sql = 'SELECT p.person_ID AS id, `last_name`, `first_name`, `season`, `jersey_number`, `height_FT`, `height_IN`, `weight_LBS`, `class`, `rl_state_city_Name`, `rl_state_NameShort`, `rl_player_pos_ShortName`, `prev_sch_name`,`rl_player_expShortName` 
							FROM `hdb_person_roster_relationships` r, `hdb_person` p, `hdb_person_hometown` h, `rl_state_city` c, `rl_state` st, `hdb_person_play_pos` po, `hdb_person_prev_sch_relationships` sr, `hdb_person_prev_sch` s,  `hdb_person_play_exp` ex 
							WHERE p.person_ID = r.person_ID 
							AND p.person_ID = h.person_ID
							AND h.state_city_ID  = c.rl_state_city_ID
							AND c.rl_state_city_State = st.rl_state_ID
							AND r.position = po.rl_player_pos_ID
							AND p.person_ID = sr.person_ID
							AND sr.prev_sch_ID = s.prev_sch_ID
							AND r.experience = ex.rl_player_expID';
							
							//Check for URL parameters
							if (isset($_GET['year'])){
								$year = addslashes($_GET['year']);
								$sql .= " AND r.season = '$year'";
							}
							
							if (isset($_GET['letter'])){
								$letter = addslashes($_GET['letter']);
								$sql .= " AND p.last_name LIKE '$letter%'";
							}	
							
							if (isset($_GET['sort'])){
								$sort = addslashes($_GET['sort']);
								if ($sort == 'number'){
									$sql .= " GROUP BY p.person_ID ORDER BY r.jersey_number ASC";
								} elseif ($sort == 'name'){
									$sql .= " GROUP BY p.person_ID ORDER BY p.last_name ASC";
								} 
								
							}						
							
							if (!isset($_GET['sort'])){
								$sql .= ' GROUP BY p.person_ID';
							}
							$sql .= " LIMIT 150";
							//echo $sql;
							$res = mysql_query($sql) or die(mysql_error());
							while ($row = mysql_fetch_array($res)) {
							?>
								<tr onMouseOver=\"this.bgColor='#e6e6e6'\" onMouseOut=\"this.bgColor='#FFFFFF'\">
								<td class="line" align="left">
								<?php 
								if ($row['jersey_number'] != 0){
									echo $row['jersey_number']; 
								} ?>
								</td>
								<td class="line" align="left" width="55px">
									<?php 
									$id = $row['id'];
									if (file_exists('http://cdn.hogdb.net/img/people/'.$id.'.png')) {
										echo '<img src="http://cdn.hogdb.net/img/people/'.$id.'.png" width="50px" height="50px"/>';
									} else {
										echo '<img src="http://cdn.hogdb.net/img/people/default-person.png" width="50px" height="50px"/>';
									} ?> 
								</td>
								<td class="line" align="left" width="145px" style="line-height:20px;"><?php echo $row['first_name']; ?><br /><?php echo $row['last_name']; ?></td>
								<td class="line" align="left"><?php echo $row['rl_player_pos_ShortName']; ?></td>
								<td class="line" align="left"><?php echo $row['height_FT']; ?>'<?php echo $row['height_IN']; ?>"</td>
								<td class="line" align="left"><?php echo $row['weight_LBS']; ?></td>
								<td class="line" align="left">
								<?php
								$class = array(1 => 'FR', 2 => 'SO', 3 => 'JR', 4 => 'SR');
								$num = $row['class'];
								echo $class[$num];
								?>
								</td>
								<td class="line" align="left"><?php echo $row['rl_player_expShortName']; ?></td>
								<td class="line" align="left" style="line-height:20px;"><?php echo $row['rl_state_city_Name']; ?>,<?php echo $row['rl_state_NameShort']; ?><br /><?php echo $row['prev_sch_name']; ?></td>
								</tr>
							<?php } ?>
						</table>
						<!-- // Display the Totals -->
						<table width="925px">
							<tr>
								<td width="925px" class="line" align="left">1 to 1</td>
							</tr>
						</table>
						<div style="width:925px;margin:augo;text-align:center; padding-top:15px;">
							<script type="text/javascript"> 
								<!--
								google_ad_client = "pub-1470730367186271";
								/* 728x90, created 4/2/10 */
								google_ad_slot = "3746095674";
								google_ad_width = 728;
								google_ad_height = 90;
								//-->
							</script> 
							<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
						</div>
						<h3>If you have information that you would like to have inclded in the database and can provide a verifiable source please <a href="http://www.hogdb.com/contact/">contact me</a>.</h3>
					</div>
				</div>
<?php get_footer(); ?>
