Hello
Can some offer me some help; I have minimal knowledge of PHP, the original script I have was written for me, I have made some minor updates but don't really have a full understanding of how it works.
A good example of what I currently have can be found at http://www.stroudskittles.co.uk/team.php?div=A&team=PatchRatsA
The script Highlights the date for the Cup game in Blue and the Bank holiday in Red; what I'm looking to achieve is modify the Opponents value so that after the team name it states "Cup Game" or Bank Holiday"
The Script reads a csv file, when the value for $tdate equals $bankHols or $cup the colour is changed; however I want to change $tverses as well
The script I have is as follows; any assistance would be appreciated
Many Thanks
<?php
$div = $_GET["div"];
$team = $_GET["team"];
$localTime=time();
$localTime=$localTime - (60 * 60 * 1);
$thisDay = date("d",$localTime);
$thisMonth = date("m",$localTime);
$thisYear = date("Y",$localTime);
$bankHols = '[25 Mar 16][28 Mar 16][14 Apr 17][17 Apr 17][30 Mar 18][2 Apr 18][19 Apr 19][22 Apr 19][10 Apr 20][13 Apr 20]';
$cupdate = '[12 Sep 16][13 Sep 16][14 Sep 16][15 Sep 16][16 Sep 16]';
$embold='N';
if (strlen($div) == 1){
$divCsv = 'csv/dSection'.$div.'.csv';
$SectionName = 'Section '.$div;
}
else {
$divCsv = 'csv/dLadiesSection'.substr($div,1,1).'.csv';
$SectionName = 'Ladies Section '.substr($div,1,1);
}
$fCnt=0;
// process list file
$fd = fopen ("$divCsv", "r");
// initialize a loop to go through each line of the file
while (!feof ($fd)) {
// declare an array to hold all of the contents of each row, indexed
$buffer = fgetcsv($fd, 4096);
// the 10 represents the number of columns in the text file
for ($i = 0; $i < 10; ++$i){
if ($i == 0){
$id = $buffer[$i];
}
if ($i == 1){
$name = $buffer[$i];
}
if ($i == 2){
$alley = $buffer[$i];
}
if ($i == 3){
$day = $buffer[$i];
}
if ($i == 4){
$captain = $buffer[$i];
}
if ($i == 5){
$vice = $buffer[$i];
}
if ($i == 6){
$phone = $buffer[$i];
}
if ($i == 7){
$vicephone = $buffer[$i];
}
if ($i == {
$tcsv = $buffer[$i];
}
if ($i == 9){
$www = $buffer[$i];
}
}
if ($team == $tcsv){
$nameH = $name;
$alleyH = $alley;
$dayH = $day;
$captainH = $captain;
$viceH = $vice;
$phoneH = $phone;
$vicephoneH = $vicephone;
$wwwH = $www;
}
}
$pageTitle = $nameH ;
include ('pageheader.php');
echo "<p align=\"left\"><span class=\"title\">$nameH League Fixtures</span></p>";
?>
<center>
<b><script language="JavaScript1.2" src="javascript/fixtures.js"></script></b>
<?php include ('amendment'.$div.'.php'); ?>
<script language="JavaScript1.2" src="javascript/amendment.js"></script>
<br>
</center>
<?php
echo "<table width=\"755\" align=\"center\">\n";
echo "<tr>\n";
echo "<td valign=\"TOP\" width=\"755\" align=\"center\">\n";
echo "<table class=\"BORDER\">\n";
fclose ($fd);
$mmOld='';
$csvFile = 'csv/t'.$team.'.csv';
// process division file
$fd = fopen ("$csvFile", "r");
// initialize a loop to go through each line of the file
while (!feof ($fd)) {
// declare an array to hold all of the contents of each row, indexed
$buffer = fgetcsv($fd, 4096);
// the 6 represents the number of columns in the text file
for ($i = 0; $i < 6; ++$i){
if ($i == 0){
$tweek = $buffer[$i];
}
if ($i == 1){
$tdate = $buffer[$i];
if (strpos($bankHols, '['.$tdate.']') !== false) {
$tdate = strtoupper($tdate);
$tdate = "<span style=\"color:red\"><b><i>$tdate</i></b></span>";
}
else if ($i == 1){
$tdate = $buffer[$i];
if (strpos($cupdate, '['.$tdate.']') !== false) {
$tdate = strtoupper($tdate);
$tdate = "<span style=\"color:blue\"><b><i>$tdate</i></b></span>";
}
}
list($fDay, $fMonth, $fYear) = split(" ", $tdate);
$chkMonth = $fMonth;
$date_formatted = "$fDay $fMonth $fYear";
$final_date = strtotime($date_formatted);
$fDay = date("d",$final_date);
$fMonth = date("m",$final_date);
$fYear = date("Y",$final_date);
if ($fYear == $thisYear & $fMonth == $thisMonth & $fDay == $thisDay & $embold=='N'){
$embold = 'Y';
}
elseif ($fYear == $thisYear & $fMonth == $thisMonth & $fDay >= $thisDay & $embold=='N'){
$embold = 'Y';
}
elseif ($fYear >= $thisYear & $fMonth > $thisMonth & $embold=='N'){
$embold = 'Y';
}
elseif ($fYear > $thisYear & $embold=='N'){
$embold = 'Y';
}
}
if ($i == 2){
$tday = $buffer[$i];
}
if ($i == 3){
$tversus = $buffer[$i];
}
if ($i == 4){
$thora = $buffer[$i];
}
if ($i == 5){
$talley = $buffer[$i];
}
}
++$fCnt;
if ($fCnt == 1){
echo "<tr>\n";
echo "<td NOWRAP class=\"HDR\" colspan=\"6\"><b>$nameH</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td NOWRAP class=\"NORMAL\" colspan=\"6\">\n";
echo "<b>$SectionName</b>\n";
echo "<br>Captain: <b>$captainH</b> Tel: <b>$phoneH</b>\n";
{
echo "<br><i>Vice Captain: <b>$viceH</b> Tel: <b>$vicephoneH</b></i>\n";
}
$alleyAbbrev = preg_replace("/[^a-zA-Z0-9]/", "", $alleyH);
echo "<br>Home: <b>$alleyH</b> Home Night: <b>$dayH</b>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"50\" align=\"center\"><b>Week</b></td>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"90\" align=\"center\"><b>Date</b></td>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"90\" align=\"center\"><b>Day</b></td>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"225\" align=\"center\"><b>Versus</b></td>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"75\" align=\"center\"><b>H/A</b></td>\n";
echo "<td NOWRAP class=\"TITLE\" width=\"225\" align=\"left\"><b>Alley</b></td>\n";
echo "</tr>\n";
}
if ($chkMonth == 'Jan' and $mmOld == 'Dec'){
echo "<tr>\n";
echo "<td NOWRAP colspan=\"6\" class=\"TITLECENTER\"><img src=\"image/blank.gif\"></td>\n";
echo "</tr>\n";
}
if ($tweek != '' & $embold != 'Y'){
echo "<tr>\n";
echo "<td NOWRAP class=\"NORMALCENTER\" width=\"50\" align=\"center\">$tweek</td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"90\" align=\"center\">$tdate</td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"90\" align=\"center\">$tday</td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"225\" align=\"center\">$tversus</td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"75\" align=\"center\">$thora</td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"225\" align=\"left\">$talley</td>\n";
echo "</tr>\n";
}
if ($tweek != '' & $embold == 'Y'){
echo "<tr>\n";
echo "<td NOWRAP class=\"NORMALCENTER\" width=\"50\" align=\"center\"><b>$tweek</b></td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"90\" align=\"center\"><b>$tdate</b></td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"90\" align=\"center\"><b>$tday</b></td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"225\" align=\"center\"><b>$tversus</b></td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"75\" align=\"center\"><b>$thora</b></td>\n";
echo "<td NOWRAP class=\"NORMAL\" width=\"225\" align=\"left\"><b>$talley</b></td>\n";
$embold='X';
echo "</tr>\n";
}
$mmOld = $chkMonth;
}
fclose ($fd);