Draft Card

[insert_php]

// includes our database functions
//include(‘db_fns.php’);

db_connect();

// Owner’s Draft Number Code to allow for draft pick
$leaguestart = $_GET[‘leaguestart’];

// Owner’s Draft Number Code to allow for draft pick
$teamcount = $_POST[‘teamcount’];

$method = $_SERVER[‘REQUEST_METHOD’];
//$request = explode(“/”, substr(@$_SERVER[‘PATH_INFO’], 1));

if($method == “POST”) {
// Pass Current Page
$draftsection = $_POST[‘draftsection’];
// Owner’s Draft Number Code to allow for draft pick
$draftcode = $_POST[‘draftcode’];
}
else {
// Pass Current Page
$draftsection = $_GET[‘draftsection’];
// Owner’s Draft Number Code to allow for draft pick
$draftcode = $_GET[‘draftcode’];
}
echo “DRAFT SECTION: $draftsection
“;

// Owner’s Draft Number Code to allow for draft pick
$draftfield = $_GET[‘draftfield’];

// Owner’s Pick Selection
$picklocation = $_GET[‘picklocation’];

// SELF LINK
$self = “index.php”;

// GET DIRECTORY
$folder = “http://fantasymasters.com/card-selection/”;

$leaguecode = substr($draftcode, 0, 4);

// CHECK IF THE LEAGUE IS NEW
if ($leaguestart == “yes”) {

echo ” 
“;
echo “

\r\n”;
echo “Team Count: \r\n”;
echo “\r\n”;
echo “\r\n”;
echo “

\r\n”;
echo ” 
“;
echo ” 
“;
}
else
{
// IF NO DATA PASSED WITH GET OR POST, SHOW INPUT FOR DRAFT CODE
if(!$draftsection)
{
echo ” 
“;
echo “

\r\n”;
echo “Draft Code: ” . “
\r\n”;

echo “\r\n”;
echo “\r\n”;
echo “

“;
echo ” 
“;
echo ” 
“;
echo ” 
“;
}
}
// CHECK IF IT’S A NEW LEAGUE AND TIME TO PUT IN ALL EMAILS
if ($draftsection == “emails”) {
if ($teamcount > 0) {
if ($teamcount <= 16) { echo "

\r\n”;
echo “League Name: ” . “
\r\n”;
for ($x=1; $x <= $teamcount; $x++) { echo "Owner Name #" . $x . ": \r\n”;
echo “Email #” . $x . “:
\r\n”;
}
echo “\r\n”;
echo “\r\n”;
echo “\r\n”;
echo “

“;
}
else
{
echo “Team count must be greater than 0 and less than or equal to 16

\r\n”;
}
}
else
{
echo “Team count must be over 0 and less than or equal to 16

\r\n”;
}
}
// CHECK IF EMAILS WERE SUBMITTED AND IF THEY ARE ALL VALID
$emailstatus = “valid”;
if ($draftsection == “checkemails”)
{
echo “CE”;
if ($teamcount <= 16) { // Check if all emails valid for ($x=1; $x <= $teamcount; $x++) { $emailacct = "email" . $x; $emailcheck = $_POST[$emailacct]; echo "$emailcheck
“;
if (!preg_match(“/([\w\-]+\@[\w\-]+\.[\w\-]+)/”,$emailcheck)) {
$emailstatus = “invalid”;
}
}
// IF EMAILS ARE ALL VALID, SAVE ALL OWNERS
if ($emailstatus == “valid”)
{

do {
$leaguecode = rand(1100, 9895);
$query = sprintf(“SELECT * FROM draftpickowners WHERE draftpickowners.leaguecode = ‘%s'”,
mysql_real_escape_string($leaguecode));
$results = mysql_query($query);
$Row = mysql_fetch_assoc($results);
} while ( $Row != false);

// RETRIEVE LEAGUE NAME FROM FORM
$leaguename = $_POST[‘leaguename’];

// RETRIEVE TODAY’S DATE
$today = date(“Ymd”);

// RANDOMIZE DRAFT PICKS
$pickcnt = 1;
$picksum = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
$pickorder = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

for ($y=1; $y <= 5; $y++) { for ($z=1; $z<=$teamcount; $z++) { $rannum = rand(125, 999); $picksum[$z] += $rannum; } } for ($a=1; $a<=$teamcount; $a++) { $low = 9999; for ($b=1; $b<=$teamcount; $b++) { if ($picksum[$b]<$low) { $low = $picksum[$b]; $lowpick = $b; } } $picksum[$lowpick] = 99999; $pickorder[$a] = $lowpick; echo "PICK: " . $a . " " . $pickorder[$a] . $picksum[$lowpick] . "
“;
$lowpick = 99;
}

// SAVE RANDOMIZED DRAFT ORDER
$comma_pickorder = implode(“,”, $pickorder);

// SAVE NEW LEAGUE DATA
$sql = “INSERT INTO draftpickleagues (leaguename, leaguecode, teamcount, leaguedate, randomorder) ” .
“VALUES (\”$leaguename\”, $leaguecode, $teamcount, \”$today\”, \”$comma_pickorder\”)”;

//echo “$sql

“;

$retval = mysql_query( $sql);

if(!$retval)
{
die(‘Could not update data: ‘ . mysql_error());
}

for ($t=1; $t <= $teamcount; $t++) { // DEFINE DRAFT CODE FOR INDIVIDUAL OWNER $leaguecodeone = rand(110, 995); $draftcode = $leaguecode . $leaguecodeone . $t; $draftname = $_POST["ownername" . $t]; // RETRIEVE EMAIL ACCOUNT FOR CURRENT OWNER $emailacct = $_POST["email" . $t]; $sql = "INSERT INTO draftpickowners (name, email, teamnumber, leaguecode, draftcode, teamcount) " . "VALUES (\"$draftname\", \"$emailacct\", $t, $leaguecode, $draftcode, $teamcount)"; //echo "$sql “; $retval = mysql_query( $sql); if(!$retval) { die(‘Could not update data: ‘ . mysql_error()); } // REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS. $to = $emailacct; $subject = $_POST [ “leaguename” ] . ” Draft Code”; $message = “Your commissioner has registered your league with FantasyMasters.com for the sole purpose of selecting your draft order. The confirmation code below is specific to your team. Enter the code at www.fantasymasters.com/draftorder to make your selection. If your selection is not made within 72 hours, a draft position will be selected for you at random. ” . “Your confirmation code: ” . $draftcode . “ “; //$message = “It is almost time for your draft. Below, you will find your draft pick code number. This will be used to make your draft order selection. Follow this link to make your selection. Use this confirmation to make the selection: ” . $draftcode;
// NOT SUGGESTED TO CHANGE THESE VALUES
$message = $draftname . PHP_EOL . $message;
$headers = ‘From: ‘ . ‘draft@fantasymasters.com’ . PHP_EOL ;
echo “TO: $to

SUBJECT: $subject

MESSAGE: $message

HEADERS: $headers
“;
//mail ( $to, $subject, $message, $headers ) ;

// THE TEXT IN QUOTES BELOW IS WHAT WILL BE
// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.
echo “Your e-mail has been sent! You should receive a reply within 24 hours!

“;

}

}
// IF EMAILS ARE NOT VALID, DISPLAY ERROR TO USER
else
{
echo “Invalid email, check emails again

“;
for ($x=1; $x <= $teamcount; $x++) { echo "

“;
echo “Team #” . $x . “: “;
echo “Email:
“;
}
echo ““;
echo ““;
echo “

“;
}
}
}

if ($draftsection == “draftcodeinput”) {
// VERIFY DRAFTCODE EXISTS
$query = sprintf(“SELECT * FROM draftpickowners WHERE draftpickowners.draftcode = ‘%s'”,
mysql_real_escape_string($draftcode));

$results = mysql_query($query);
$ownerRow = mysql_fetch_assoc($results);

echo “TEST1 $draftsection
“;
echo “

";
		print_r ($ownerRow);
		echo "

“;

// RETRIEVE WHICH CARDS ARE AVAILABLE AND WHICH WERE ALREADY SELECTED
$query = sprintf(“SELECT * FROM draftpickleagues WHERE draftpickleagues.leaguecode = ‘%s'”,
mysql_real_escape_string($leaguecode));

$results = mysql_query($query);
$leagueRow = mysql_fetch_assoc($results);

echo “TEST1
“;
echo “

";
		print_r ($leagueRow);
		echo "

“;

$teamorder = $leagueRow[‘teamorder’];
echo “RANDOM: $teamorder
“;
$teamcount = $leagueRow[‘teamcount’];
$selections = explode(“,”, $teamorder);
$teampicknumber = $ownerRow[‘picknumber’];

echo “TEST1
“;
echo “

";
		print_r ($selections);
		echo "

“;

echo “

“;
echo “ “;
echo “
“;
if ($teampicknumber == 0) {
echo “

“;
}
else {
echo “

“;
}
echo “

“;
echo “

“;
echo “

“;

if ($teampicknumber == 0) {
$twocount = 0;
for ($i=1; $i <= $teamcount; $i++) { $twocount++; $draftfield = "draftpick" . $i; if ($twocount == 1) { echo "

“;
}
if($selections[$i] == 0) {
echo “

“;
}
else {
echo “

“;
}
if ($twocount >= 2) {
echo “

“;
$twocount = 0;
}
}
}
else {
echo “

“;
echo “

“;
echo “

“;
}
echo “

“;
echo “

Choose one of the cards below, Numbers shown represent picks already selected Your Draft Pick
\"\" \"\"
\"\"

“;

}

if ($draftsection == “draftcodeselected”) {
// VERIFY DRAFTCODE EXISTS
$query = sprintf(“SELECT * FROM draftpickowners WHERE draftpickowners.draftcode = ‘%s'”,
mysql_real_escape_string($draftcode));

$results = mysql_query($query);
$ownerRow = mysql_fetch_assoc($results);

//$ownerRow = mysql_fetch_assoc($results);

echo “TEST4 $draftcode
“;
echo “

";
		print_r ($ownerRow);
		echo "

“;

if($ownerRow) {
// RETRIEVE WHICH CARDS ARE AVAILABLE AND WHICH WERE ALREADY SELECTED
$query = sprintf(“SELECT * FROM draftpickleagues WHERE draftpickleagues.leaguecode = ‘%s'”,
mysql_real_escape_string($leaguecode));

$results = mysql_query($query);
$leagueRow = mysql_fetch_assoc($results);

echo “TEST2
“;
echo “

";
			print_r ($leagueRow);
			echo "

“;

$teamorder = $leagueRow[‘teamorder’];
$randomorder = $leagueRow[‘randomorder’];
echo “RANDOM: $randomorder
“;
$teamcount = $leagueRow[‘teamcount’];
$leaguecode = $ownerRow[‘leaguecode’];
$teamnumber = $ownerRow[‘teamnumber’];
$teampicknumber = $ownerRow[‘picknumber’];
$teamselections = explode(“,”, $teamorder);
$randomselections = explode(“,”, $randomorder);
echo “CARD TAKEN $picklocation T” . $randomselections[$picklocation] . “T” . $teamnumber . “
“;
if ($teamselections[$picklocation] == 0) {
if ($teampicknumber == 0) {
echo “Your Selection
mysql_real_escape_string($leaguecode));
$results = mysql_query($query);
$Row = mysql_fetch_assoc($results);
} while ( $Row != false);

// RETRIEVE LEAGUE NAME FROM FORM
$leaguename = $_POST[‘leaguename’];

// RETRIEVE TODAY’S DATE
$today = date(“Ymd”);

// RANDOMIZE DRAFT PICKS
$pickcnt = 1;
$picksum = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
$pickorder = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

for ($y=1; $y <= 5; $y++) { for ($z=1; $z<=$teamcount; $z++) { $rannum = rand(125, 999); $picksum[$z] += $rannum; } } for ($a=1; $a<=$teamcount; $a++) { $low = 9999; for ($b=1; $b<=$teamcount; $b++) { if ($picksum[$b]<$low) { $low = $picksum[$b]; $lowpick = $b; } } $picksum[$lowpick] = 99999; $pickorder[$a] = $lowpick; echo "PICK: " . $a . " " . $pickorder[$a] . $picksum[$lowpick] . "
“;
$lowpick = 99;
}

// SAVE RANDOMIZED DRAFT ORDER
$comma_pickorder = implode(“,”, $pickorder);

// SAVE NEW LEAGUE DATA
$sql = “INSERT INTO draftpickleagues (leaguename, leaguecode, teamcount, leaguedate, randomorder) ” .
“VALUES (\”$leaguename\”, $leaguecode, $teamcount, \”$today\”, \”$comma_pickorder\”)”;

//echo “$sql

“;

$retval = mysql_query( $sql);

if(!$retval)
{
die(‘Could not update data: ‘ . mysql_error());
}

for ($t=1; $t <= $teamcount; $t++) { // DEFINE DRAFT CODE FOR INDIVIDUAL OWNER $leaguecodeone = rand(110, 995); $draftcode = $leaguecode . $leaguecodeone . $t; $draftname = $_POST["ownername" . $t]; // RETRIEVE EMAIL ACCOUNT FOR CURRENT OWNER $emailacct = $_POST["email" . $t]; $sql = "INSERT INTO draftpickowners (name, email, teamnumber, leaguecode, draftcode, teamcount) " . "VALUES (\"$draftname\", \"$emailacct\", $t, $leaguecode, $draftcode, $teamcount)"; //echo "$sql “; $retval = mysql_query( $sql); if(!$retval) { die(‘Could not update data: ‘ . mysql_error()); } // REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS. $to = $emailacct; $subject = $_POST [ “leaguename” ] . ” Draft Code”; $message = “Your commissioner has registered your league with FantasyMasters.com for the sole purpose of selecting your draft order. The confirmation code below is specific to your team. Enter the code at www.fantasymasters.com/draftorder to make your selection. If your selection is not made within 72 hours, a draft position will be selected for you at random. ” . “Your confirmation code: ” . $draftcode . “ “; //$message = “It is almost time for your draft. Below, you will find your draft pick code number. This will be used to make your draft order selection. Follow this link to make your selection. Use this confirmation to make the selection: ” . $draftcode;
// NOT SUGGESTED TO CHANGE THESE VALUES
$message = $draftname . PHP_EOL . $message;
$headers = ‘From: ‘ . ‘draft@fantasymasters.com’ . PHP_EOL ;
echo “TO: $to

SUBJECT: $subject

MESSAGE: $message

HEADERS: $headers
“;
//mail ( $to, $subject, $message, $headers ) ;

// THE TEXT IN QUOTES BELOW IS WHAT WILL BE
// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.
echo “Your e-mail has been sent! You should receive a reply within 24 hours!

“;

}

}
// IF EMAILS ARE NOT VALID, DISPLAY ERROR TO USER
else
{
echo “Invalid email, check emails again

“;
for ($x=1; $x <= $teamcount; $x++) { echo "

“;
echo “Team #” . $x . “: “;
echo “Email:
“;
}
echo ““;
echo ““;
echo “

“;
}
}
}

if ($draftsection == “draftcodeinput”) {
// VERIFY DRAFTCODE EXISTS
$query = sprintf(“SELECT * FROM draftpickowners WHERE draftpickowners.draftcode = ‘%s'”,
mysql_real_escape_string($draftcode));

$results = mysql_query($query);
$ownerRow = mysql_fetch_assoc($results);

echo “TEST1 $draftsection
“;
echo “

";
		print_r ($ownerRow);
		echo "

“;

// RETRIEVE WHICH CARDS ARE AVAILABLE AND WHICH WERE ALREADY SELECTED
$query = sprintf(“SELECT * FROM draftpickleagues WHERE draftpickleagues.leaguecode = ‘%s'”,
mysql_real_escape_string($leaguecode));

$results = mysql_query($query);
$leagueRow = mysql_fetch_assoc($results);

echo “TEST1
“;
echo “

";
		print_r ($leagueRow);
		echo "

“;

echo “RANDOM: $teamorder
“;
$teamcount = $leagueRow[‘teamcount’];
$teampicknumber = $ownerRow[‘picknumber’];

for ($m=1; $m <= $teamcount; $m++) { $selections[$m] = $leagueRow["teamorder" . $m]; } echo "TEST1
“;
echo “

";
		print_r ($selections);
		echo "

“;

echo “

“;
echo “ “;
echo “
“;
if ($teampicknumber == 0) {
echo “

“;
}
else {
echo “

“;
}
echo “

“;
echo “

“;
echo “

“;

if ($teampicknumber == 0) {
$twocount = 0;
for ($i=1; $i <= $teamcount; $i++) { $twocount++; $draftfield = "draftpick" . $i; if ($twocount == 1) { echo "

“;
}
if($selections[$i] == 0) {
echo “

“;
}
else {
echo “

“;
}
if ($twocount >= 2) {
echo “

“;
$twocount = 0;
}
}
}
else {
echo “

“;
echo “

“;
echo “

“;
}
echo “

“;
echo “

Choose one of the cards below, Numbers shown represent picks already selected Your Draft Pick
\"\" \"\"
\"\"

“;

}

if ($draftsection == “draftcodeselected”) {
// VERIFY DRAFTCODE EXISTS
$query = sprintf(“SELECT * FROM draftpickowners WHERE draftpickowners.draftcode = ‘%s'”,
mysql_real_escape_string($draftcode));

$results = mysql_query($query);
$ownerRow = mysql_fetch_assoc($results);

//$ownerRow = mysql_fetch_assoc($results);

echo “TEST4 $draftcode
“;
echo “

";
		print_r ($ownerRow);
		echo "

“;

if($ownerRow) {
// RETRIEVE WHICH CARDS ARE AVAILABLE AND WHICH WERE ALREADY SELECTED
$query = sprintf(“SELECT * FROM draftpickleagues WHERE draftpickleagues.leaguecode = ‘%s'”,
mysql_real_escape_string($leaguecode));

$results = mysql_query($query);
$leagueRow = mysql_fetch_assoc($results);

$teamcount = $leagueRow[‘teamcount’];

echo “TEST2
“;
echo “

";
			print_r ($leagueRow);
			echo "

“;

echo “HERE ” . $leagueRow[‘teamorder5’];

for ($n=1; $n <= $teamcount; $n++) { $indx = "teamorder" . $n; $teamselections[$n] = $leagueRow[$indx]; } $randomorder = $leagueRow['randomorder']; echo "RANDOM: $randomorder
“;
$leaguecode = $ownerRow[‘leaguecode’];
$teamnumber = $ownerRow[‘teamnumber’];
$teampicknumber = $ownerRow[‘picknumber’];
$randomselections = explode(“,”, $randomorder);
echo “CARD TAKEN $picklocation T ” . $randomselections[$picklocation] . “T ” . $teamnumber . “
“;
echo “TMS: ” . $teamselections[$picklocation] . “
“;
if ($teamselections[$picklocation] == 0) {
if ($teampicknumber == 0) {

echo “

“;
echo “ “;
echo “
“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

Your Draft Pick
\"\"

“;

$teamselections[$picklocation] = $teamnumber;

$sql = “UPDATE draftpickleagues “.
“SET teamorder” . $picklocation . “=” . $teamnumber . ” “.
“WHERE leaguecode=$leaguecode” ;
mysql_query($sql) or die (“Error: “.mysql_error());
echo “SQL: $sql” . “
“;

$sql = “UPDATE draftpickowners “.
“SET picknumber=” . $randomselections[$picklocation] . ” ” .
“WHERE draftcode=$draftcode” ;
mysql_query($sql) or die (“Error: “.mysql_error());
echo “SQL: $sql” . “
“;
}
}

}
else {
echo “Draft Code is invalid.

Do not edit the links provided

“;
}
}

function db_connect()
{
$connection = mysql_pconnect(‘db537827035.db.1and1.com’, ‘dbo537827035’, ‘pitstop69’);
mysql_set_charset(‘utf8’,$connection);
if(!$connection)
{
return false;
}

if(!mysql_select_db(‘db537827035’))
{
return false;
}

return $connection;
}
[/insert_php]

NFL Training Camp Dates

The 2014 schedule of starting dates for NFL training camps. Dates subject to change.

 

Team Report Date Practice Dates
Arizona Cardinals July 25 July 26-Aug. 22
Atlanta Falcons July 24 July 25-Aug. 12
Baltimore Ravens July 23 July 24-Aug. 14
Buffalo Bills July 18 July 20-Aug. 21
Carolina Panthers July 24 July 26-Aug. 12
Chicago Bears July 24 July 25-Aug. 13
Cincinnati Bengals July 23 July 24-Aug. 14
Cleveland Browns July 25 July 26-Aug. 13
Dallas Cowboys July 22 July 24-Aug. 15
Denver Broncos July 23 July 24-Aug. 15
Detroit Lions July 27 July 28-Aug. 13
Green Bay Packers July 25 July 26-Aug. 25
Houston Texans July 25 July 26-Aug. 26
Indianapolis Colts July 23 July 24-Aug. 13
Jacksonville Jaguars July 24 July 25-Aug. 12
Kansas City Chiefs July 23 July 24-Aug. 14
Miami Dolphins July 24 July 25-Aug. 16
Minnesota Vikings July 24 July 25-Aug. 14
New England Patriots July 23 July 24-Aug. 15
New Orleans Saints July 24 July 25-Aug. 27
Oakland Raiders\ July 24 July 25-TBA
New York Giants July 21 July 22-Aug. 14
New York Jets July 23 July 24-Aug. 21
Philadelphia Eagles July 25 July 26-Aug. 28
Pittsburgh Steelers July 25 July 26-Aug. 16
San Diego Chargers July 23 July 24-Aug. 12
San Francisco 49ers July 23 July 24-TBA
Seattle Seahawks July 24 July 25-Aug. 12
St Louis Rams July 24 July 25-Aug. 20
Tampa Bay Buccaneers July 24 July 25-Aug. 14
Tennessee Titans July 25 July 26-Aug. 27
Washington Redskins July 23 July 24-Aug. 11

Strength of Schedule

Here are the 2015 team schedules ranked in order of difficulty, based on opponents’ 2014 results. (Combined 2014 record of all 16 opponents, combined winning percentage)

Rank Team Opp W/L Opp Win % Quality Opp
1 Pittsburgh 147-107-2 0.579 11
2 St. Louis 147-108-0 0.574 9
3 Cincinnati 144-112-0 0.563 11
4 Arizona 142-113-0 0.555 8
5 Seattle 142-112-0 0.555 8
6 Oakland 139-116-1 0.545 11
7 Kansas City 139-116-1 0.545 11
8 Cleveland 138-116-2 0.543 11
9 Denver 138-117-1 0.541 11
10 Baltimore 137-117-2 0.539 9
11 Minnesota 138-118-0 0.539 9
12 San Francisco 137-118-0 0.535 9
13 Chicago 136-120-0 0.531 9
14 Detroit 135-121-0 0.527 8
15 Green Bay 135-120-0 0.527 8
16 San Diego 132-123-1 0.518 9
17 Miami 126-130-0 0.492 10
18 NY Jets 125-131-0 0.488 8
19 Buffalo 124-131-0 0.484 8
20 Washington 122-133-0 0.477 6
21 New England 122-134-0 0.477 8
22 NY Giants 122-133-0 0.477 6
23 Philadelphia 121-134-0 0.473 6
24 Dallas 119-136-1 0.467 6
25 Jacksonville 118-137-1 0.463 8
26 Tennessee 111-144-1 0.435 6
27 Carolina 111-145-0 0.434 6
28 New Orleans 109-145-0 0.426 6
29 Tampa Bay 108-146-0 0.422 4
30 Houston 106-148-2 0.417 6
31 Indianapolis 106-149-1 0.416 6
32 Atlanta 104-150-0 0.406 4