 |
phpffl.com phpFFL - Fantasy Football League Manager
|
| View previous topic :: View next topic |
| Author |
Message |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Fri Dec 18, 2009 4:42 pm Post subject: |
|
|
Noticed that I set up a table field wrong, which may cause issues when displaying the "Report Date" I've updated the link in the 1st post.
Anybody that DL the mod prior to this afternoon will need to change the date field in the playerInjuries table to varchar(10).
I did this via phpMyAdmin without any issues; then I manually ran the NFLTeamUpdates_injuries.php file. ALL the Injury Report Dates are now correct and displaying properly. _________________ My "hacks":
|
|
| Back to top |
|
 |
daverupe
Joined: 27 Jul 2006 Posts: 284 Location: Medina, OH
|
Posted: Sun Dec 20, 2009 11:32 am Post subject: |
|
|
I did the update and now the page looks like
Date Reported:
-0//12-1
It looks fine in phpMyAdmin... _________________ Regards,
daverupe
Commish
Chicora Football League
http://daverupe.com/ffl |
|
| Back to top |
|
 |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Mon Dec 21, 2009 8:56 am Post subject: |
|
|
| daverupe wrote: | I did the update and now the page looks like
Date Reported:
-0//12-1
It looks fine in phpMyAdmin... |
find the following variables in the injuryUpdate.php file:
- $reportyear
- $reportmonth
- $reportday
either c & p this in place of what's there or update the "substr($date," values to match what you see below:
| Code: |
$reportyear = substr($date, 0, 4);
$reportmonth = substr($date, 5, 2);
$reportday = substr($date, 8, 2);
|
_________________ My "hacks":
|
|
| Back to top |
|
 |
daverupe
Joined: 27 Jul 2006 Posts: 284 Location: Medina, OH
|
Posted: Tue Dec 29, 2009 11:26 pm Post subject: |
|
|
$reportyear, $reportmonth, $reportday are what you posted above. Still seeing the same thing.
Date Reported:
-0//12-1
Attached is a screenie of my playerInjuries table from phpMyAdmin.
injuryUpdate.php looks like this:
| Code: | <?php
include("program_files/config.php");
echo "<link href='$PHPFFL_WEB_ROOT/css/main.css' rel='stylesheet' type='text/css'>";
$playerid = $_REQUEST['playerid'];
$sql="select playerInjuries.status, playerInjuries.returndate, playerInjuries.bodypart, playerInjuries.comment, playerInjuries.team_id, playerInjuries.date, playerInjuries.last_update, players.firstname, players.positionID, players.lastname from playerInjuries
inner join players on playerInjuries.player_id = players.id
where showinjury = 'yes' AND playerInjuries.player_id=$playerid;";
$rs=$DB->Execute($sql);
if(!($rs->EOF))
{
$player_fn=$rs->fields("firstname");
$player_ln=$rs->fields("lastname");
$position=$rs->fields("positionID");
$status=$rs->fields("status");
$returndate=$rs->fields("returndate");
$bodypart=$rs->fields("bodypart");
$comment=$rs->fields("comment");
$team=$rs->fields("team_id");
$date=$rs->fields("date");
$last_update=$rs->fields("last_update");
$reportyear = substr($date, 0, 4);
$reportmonth = substr($date, 5, 2);
$reportday = substr($date, 8, 2);
$updateyear = substr($last_update, 0, 4);
$updatemonth = substr($last_update, 5, 2);
$updateday = substr($last_update, 8, 2);
$updatetime = substr($last_update, 11, 8);
//return the unix timestamp for the date passed
$reportdate = $reportmonth."/".$reportday."/".$reportyear;
$updatedate = $updatemonth."/".$updateday."/".$updateyear." @ ".$updatetime;
}
echo "<div align='center'>";
echo "<table class='detail-table' cellspacing='1' cellpadding='2' style='border: 0px solid #121055' bgcolor='#121055' width='90%'>";
echo "<tr><th colspan='3'><BR><div align='center'><img src='{$PHPFFL_IMAGE_PATH}logo/".$team."_helmetPhotoHeader.jpg' title=$team><br /> </th></tr>";
echo "<tr bgcolor='#D5DADF'><td width='33%'><span class='table_row_title'><div align='center'>Date Reported:</span>";
if ($date == "0000-00-00")
{
echo "<br />Unknown</td>";
}
else
{
echo "<br /> ".$reportdate."</td>";
}
echo "<td width='33%'><span class='table_row_title'><div align='center'><img src={$PHPFFL_IMAGE_PATH}nfl/$playerid.jpg></span></td>";
echo "<td width='33%'><span class='table_row_title'><div align='center'>Last Updated:</span><br /> ".$updatedate."</td></tr>";
echo "<tr bgcolor='#E7EBF7'><td colspan='3'><div><span class='table_row_title'>Player:</span><span class='table_data_large'> ".$player_fn. " ".$player_ln." - ".$position." </span><br /><span class='table_row_title'>Injury:</span> ".$bodypart." <br /><span class='table_row_title'>Status:</span> ".$status." - ".$returndate."<!-- <br /> --></div></td></tr>";
echo "<tr bgcolor='#D5DADF'><td colspan='3'><span class='table_row_title'>Comments:</span><br /> ".$comment."</td></tr>";
echo "</table>";
echo "</div>";
?> |
_________________ Regards,
daverupe
Commish
Chicora Football League
http://daverupe.com/ffl |
|
| Back to top |
|
 |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Wed Dec 30, 2009 7:26 am Post subject: |
|
|
Everything looks fine. Could you post your fetchInjuryData function? _________________ My "hacks":
|
|
| Back to top |
|
 |
daverupe
Joined: 27 Jul 2006 Posts: 284 Location: Medina, OH
|
Posted: Wed Dec 30, 2009 10:02 am Post subject: |
|
|
| El-Chupacabra wrote: | | Everything looks fine. Could you post your fetchInjuryData function? |
| Code: | function fetchInjuryData()
{
global $DB;
$sql="update playerInjuries set showInjury = 0;";
$rs=$DB->Execute($sql);
$INJURIES = file_get_contents("http://www.rotoworld.com/Content/injuries.aspx?sport=NFL");
$subinjuries = substr($INJURIES,strpos($INJURIES, "NFL Injuries"),strlen($INJURIES));
$length = strpos($subinjuries, "</a>") - strpos($subinjuries, "<a href");
$newinjuries = substr($subinjuries,strpos($subinjuries, "<a href"),$length + 4);
$subinjuries = substr($subinjuries,strpos($subinjuries, "</a>"),strlen($subinjuries));
$length = strpos($subinjuries, "</tr>") - strpos($subinjuries, "<tr>");
$player = substr($subinjuries,strpos($subinjuries, "<tr>"),$length + 5);
while (strlen($subinjuries) > 5)
{
$year = get_current_number_year();
$subinjuries = substr($subinjuries,strpos($subinjuries, "</tr>")+5,strlen($subinjuries));
$length = strpos($subinjuries, "</tr>") - strpos($subinjuries, "<tr>");
$player = substr($subinjuries,strpos($subinjuries, "<tr>"),$length + 5);
if (strpos($player,"<a href") > 0)
{
$length = strpos($player, "</td>") - strpos($player, "<a href");
$FinalInjury = substr($player,strpos($player, "<a href"),$length + 5);
$length = strpos($FinalInjury, "</") - strpos($FinalInjury, ">");
$name = substr($FinalInjury, strpos($FinalInjury, ">")+1,$length-1 );
$fullname = explode(" ",$name);
$firstname = $fullname[0];
$lastname = $fullname[1];
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$pos = substr($player,strpos($player, "<td>"),$length + 5);
$length = strpos($pos, "</") - strpos($pos, ">");
$pos = substr($pos, strpos($pos, ">")+1,$length-1 );
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$status = substr($player,strpos($player, "<td>"),$length + 5);
$length = strpos($status, "</") - strpos($status, ">");
$status = substr($status, strpos($status, ">")+1,$length-1 );
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$date = substr($player,strpos($player, "<td>"),$length + 5);
$length = strpos($date, "</") - strpos($date, ">");
$date = substr($date, strpos($date, ">")+1,$length-1 );
//echo $date.":";
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$bodypart = substr($player,strpos($player, "<td>"),$length + 5);
$length = strpos($bodypart, "</") - strpos($bodypart, ">");
$bodypart = substr($bodypart, strpos($bodypart, ">")+1,$length-1 );
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$return = substr($player,strpos($player, "<td>"),$length + 5);
$length = strpos($return, "</") - strpos($return, ">");
$return = substr($return, strpos($return, ">")+1,$length-1 );
$subinjuries = substr($subinjuries,strpos($subinjuries, "</tr>")+5,strlen($subinjuries));
$length = strpos($subinjuries, "</tr>") - strpos($subinjuries, "<tr>");
$player = substr($subinjuries,strpos($subinjuries, "<tr>"),$length + 5);
$player = substr($player,strpos($player, "</td>")+5,strlen($player));
$length = strpos($player, "</td>") - strpos($player, "<td>");
$latest = substr($player,strpos($player, "<br>"),$length + 5);
$length = strpos($latest, "</") - strpos($latest, ">");
$latest = substr($latest, strpos($latest, ">")+1,$length-1 );
//echo $firstname.",".$lastname.":";
//echo $pos." - ".$status." - ".$date." - ".$bodypart." - ".$return." - ".$latest."<BR><BR>";
$lastname = str_replace("'","''",$lastname);
$firstname = str_replace("'","''",$firstname);
$latest = str_replace("'","''",$latest);
$return= str_replace("'","''",$return);
$bodypart= str_replace("'","''",$bodypart);
$date = $date." ".$year;
$date = strtotime($date);
//echo " ".date("m",$date)." ";
if(date("m",$date) > date("m"))
{
//echo date("m",$date);
$month=date("m",$date);
$day=date("d",$date);
$year=date("y",$date);
$year = $year-1;
//echo "new date $year";
$date = mktime(0, 0, 0, $month, $day, $year);
}
$datetime = date("m-d-y",$date);
echo " $firstname $lastname - $datetime<BR>";
//echo "$datetime<BR><BR>";
$sql="select ID, teamID from players where lastname='".$lastname."' and firstname = '".$firstname."';";
$rs=$DB->Execute($sql);
if(!($rs->EOF))
{
$ID=$rs->fields("ID");
$team_id = $rs->fields("teamID");
}
$sql="select injury_id from playerInjuries where player_id = '$ID' and comment = '$latest' and date = '$datetime';";
$rs=$DB->Execute($sql);
if(!($rs->EOF))
{
$sql="update playerInjuries set showInjury = 1 where player_id = '$ID' and comment = '$latest' and date = '$datetime';";
$DB->Execute($sql);
}
else
{
$sql="insert into playerInjuries (player_id, team_id, status, returndate, bodypart, comment, date,year) values ('$ID', '$team_id', '$status', '$return', '$bodypart','$latest', '$datetime', '$year');";
echo "<BR><BR>".$sql."<BR><BR>";
$DB->Execute($sql);
}
}
}
} |
_________________ Regards,
daverupe
Commish
Chicora Football League
http://daverupe.com/ffl |
|
| Back to top |
|
 |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Wed Dec 30, 2009 10:17 am Post subject: |
|
|
In the fetchInjuryData function, find:
| Code: |
$date = mktime(0, 0, 0, $month, $day, $year);
}
$datetime = date("m-d-y",$date);
|
and change it to:
| Code: |
$date = mktime(0, 0, 0, $year, $month, $day);
}
$datetime = date("Y-m-d",$date);
|
I guess I'll need to check the latest version this weekend and make sure that change is already in there...
EDIT: After making the above change, if you want to immediately correct the date issue, you will need to manually run the player injury script once. If you don't manually run the script, it should correct db field when your cron runs.... _________________ My "hacks":
|
|
| Back to top |
|
 |
daverupe
Joined: 27 Jul 2006 Posts: 284 Location: Medina, OH
|
Posted: Wed Dec 30, 2009 2:11 pm Post subject: |
|
|
yup that did the trick! Thanks. I also checked the DL from your site. It is
| Code: | $date = mktime(0, 0, 0, $month, $day, $year);
}
$datetime = date("m-d-y",$date); |
_________________ Regards,
daverupe
Commish
Chicora Football League
http://daverupe.com/ffl |
|
| Back to top |
|
 |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Wed Dec 30, 2009 2:44 pm Post subject: |
|
|
| daverupe wrote: | yup that did the trick! Thanks. I also checked the DL from your site. It is
| Code: | $date = mktime(0, 0, 0, $month, $day, $year);
}
$datetime = date("m-d-y",$date); |
|
Thanks. DL version has been updated to reflect the required correction to the fetchInjuryData function.  _________________ My "hacks":
|
|
| Back to top |
|
 |
daverupe
Joined: 27 Jul 2006 Posts: 284 Location: Medina, OH
|
Posted: Mon Aug 23, 2010 2:50 pm Post subject: |
|
|
TEN_helmetPhotoHeader.jpg and WAS_helmetPhotoHeader in the images/logo folder appear to be corrupt. Does anyone have these files to offer up? _________________ Regards,
daverupe
Commish
Chicora Football League
http://daverupe.com/ffl |
|
| Back to top |
|
 |
El-Chupacabra
Joined: 05 Jun 2008 Posts: 209 Location: FL, USA
|
Posted: Mon Aug 23, 2010 4:01 pm Post subject: |
|
|
| daverupe wrote: | | TEN_helmetPhotoHeader.jpg and WAS_helmetPhotoHeader in the images/logo folder appear to be corrupt. Does anyone have these files to offer up? |
 _________________ My "hacks":
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|