Jump to content

Undefined function: timestamp


teentorque

Recommended Posts

Hello,

 

I'm getting the following error message:

 

Fatal error:  Call to undefined function  timestamp() in xxxxxxxxxx on line 6

 

When I look at line 6, it's:

 

$fletch = date ("Ymd");

 

There's no MySQL involved in this code, it's just PHP. For some reason it won't recognize today (current)'s date, but it recognizes anything backdated.

Link to comment
https://forums.phpfreaks.com/topic/190325-undefined-function-timestamp/
Share on other sites

Sorry! It was the sixth line from the top so I just assumed. . . .

 

I searched for "timestamp" and this was what came up:

 

function timestamp() {

global $date, $pest, $pest2, $year;

if ($date == "archive") {echo "Archive"; } else { echo "$pest $pest2, $year"; }

 

On the page where it's supposed to happen, it's:

 

<?php echo timestamp(); ?>

 

 

Code is below, if it helps?

 

<?php
if (file_exists("swnews.php")) {
include ('swnews.php'); }
if (file_exists("alttags.php")) {
include ('alttags.php'); }
$fletch = date ("Ymd");
$dir = dir("strips");
$num = 0;
$zam = $dir->read();
$zam = $dir->read();
$testarr = array();
$testarr2 = array();
$testarr3 = array();
while ($file[$num] = $dir->read()) {
$blext = substr($file[$num], 9, 3);
$blmonth = substr($file[$num], 0, 6);
$bodytag1 = str_replace ("$prefix", "", "$file[$num]");
$bodytag = str_replace ("$blext", "", "$bodytag1");
$bodytagx = str_replace (".", "", "$bodytag");
if (!isset($testarr[$bodytagx])) $testarr[$bodytagx] = $blext;
if (!isset($testarr2[$num])) $testarr2[$num] = $bodytagx;
if (!isset($testarr3[$bodytagx])) $testarr3[$bodytagx] = $bodytagx;
$num++;
}
$dir->close();
sort($file);
sort($testarr2);
sort($testarr3);
$bodytagg1 = str_replace ("$prefix", "", "$file[$num]");
$bodytagg = str_replace ("$blext", "", "$bodytagg1");
$garr1 = str_replace ("gif", "", "$bodytagg");
$garr2 = str_replace ("png", "", "$garr1");
$garr3 = str_replace ("jpg", "", "$garr2");
$bodytaggx = str_replace (".", "", "$garr3");
if ($date == "") {
$date = $bodytaggx; }
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day = substr($date, 6, 2);
$yearmonth = substr($date, 0, 6);
$bodytag1l = str_replace ("$prefix", "", "$file[1]");
$bodytagl = str_replace ("$blext", "", "$bodytag1l");
$bodytagxl = str_replace (".", "", "$bodytagl");
$stat = array_search ($date, $testarr2);
$blextarr = array("gif"=>'gif', "jpg"=>'jpg', "png"=>'png');
$blext = substr($file[$stat], 9, 3);
$ext = $blextarr[$blext];
$xy = $testarr2[$stat - 1];
$xz = $testarr2[$stat + 1];
$xf = $testarr2[0];
$xl = $testarr2[$num - 1];
$mot = substr($day, 0, 1);
if ($mot == "0") {
$pest2 = substr($day, 1, 1);
} else { 
$pest2 = $day; }
$monthname2 = array("01"=>'January', "02"=>'February', "03"=>'March', "04"=>'April', "05"=>'May', "06"=>'June', "07"=>'July', "08"=>'August', "09"=>'September', "10"=>'October',  "11"=>'November', "12"=>'December');
$pest = $monthname2[$month];
if (file_exists("upload/$fletch.$ext")) {
          rename("upload/$fletch.$ext","strips/$fletch.$ext"); 
     } elseif (file_exists("upload/$fletch.jpg")) {
          rename("upload/$fletch.jpg","strips/$fletch.jpg"); 
     } elseif (file_exists("upload/$fletch.png")) {
          rename("upload/$fletch.png","strips/$fletch.png"); 
     } elseif (file_exists("upload/$fletch.gif")) {
          rename("upload/$fletch.gif","strips/$fletch.gif"); 
     }
if (file_exists("upload/$fletch.php")) {
          rename("upload/$fletch.php","comments/$fletch.php"); 
     } elseif (file_exists("upload/$fletch.txt")) {
          rename("upload/$fletch.txt","comments/$fletch.txt"); 
     }
$imgletter = "96";
$imgletterx = "96";
function contentx() {
global $date, $ext, $fletch, $imgletter, $num, $file, $alttext;
$imgletter++;
if (file_exists("upload/" . $fletch . chr($imgletter) . ".gif")) {
rename("upload/" . $fletch . chr($imgletter) . ".gif","stripsx/" . $fletch . chr($imgletter) . ".gif"); 
} elseif (file_exists("upload/" . $fletch . chr($imgletter) . ".png")) {
rename("upload/" . $fletch . chr($imgletter) . ".png","stripsx/" . $fletch . chr($imgletter) . ".png"); 
} elseif (file_exists("upload/" . $fletch . chr($imgletter) . ".jpg")) {
rename("upload/" . $fletch . chr($imgletter) . ".jpg","stripsx/" . $fletch . chr($imgletter) . ".jpg"); 
}
if (file_exists("stripsx/" . $date . chr($imgletter) . ".gif")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".gif\" alt=\"$alttext[$cxdate]\"><br>";
break;
}} elseif (file_exists("stripsx/" . $date . chr($imgletter) . ".png")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".png\" alt=\"$alttext[$cxdate]\"><br>";
break;
}} elseif (file_exists("stripsx/" . $date . chr($imgletter) . ".jpg")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".jpg\" alt=\"$alttext[$cxdate]\"><br>";
break;
}}}
function comment() {
global $date, $fletch, $num, $file;
if (file_exists("comments/$date.php")) {
$commenturl = "comments/$date.php";
include ($commenturl); } elseif (file_exists("comments/$date.txt")) {
$commenturl = "comments/$date.txt";
include ($commenturl); }
}
function commentx() {
global $date, $fletch, $num, $imgletterx, $file;
$imgletterx++;
if (file_exists("upload/" . $fletch . chr($imgletterx) . ".php")) {
rename("upload/" . $fletch . chr($imgletterx) . ".php","comments/" . $fletch . chr($imgletterx) . ".php"); 
}
if (file_exists("upload/" . $fletch . chr($imgletterx) . ".txt")) {
rename("upload/" . $fletch . chr($imgletterx) . ".txt","comments/" . $fletch . chr($imgletterx) . ".txt"); 
}
if (file_exists("comments/" . $date . chr($imgletterx) . ".php")) {
while ($imgletterx <= 122) {
$commenturl = "comments/" . $date . chr($imgletterx) . ".php";
include ($commenturl); 
break;
}} elseif (file_exists("comments/" . $date . chr($imgletterx) . ".txt")) {
while ($imgletterx <= 122) {
$commenturl = "comments/" . $date . chr($imgletterx) . ".txt";
include ($commenturl); 
break;
}}}
function content() {
global $date, $prefix, $ext, $testarr, $stat, $num, $file, $bizzar, $bodytagxy, $bodytagxz, $testkey, $alttext, $altdefault;
echo "<img src=\"strips/$prefix$date.$testarr[$date]\" alt=\""; if ($alttext[$date]) {echo $alttext[$date];} else {echo $altdefault; } echo "\"><br>";
}
function archive() {
global $date, $num, $file;
if ($date == "archive") {
static $x = 1;
$staryear = 1990;  
$end_year = date("Y", time());
        $count = 1;
for ($i = $staryear; $i <= $end_year; $i++)
{
        $yeardates[$count] = $i;
        $count++;
}
$monthname = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$monthdate = array(1 => '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$monthnum = array(1 => '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
}
foreach ($yeardates as $yitti) {
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
if ($yitti == $year){
if ($yitti == $year){
$xyy++;
echo "<table><tr><td><center><table cellspacing=1 cellpadding=1 border=2 width=520><tr><td align=center valign=top><center>$yitti</center></td></tr></table>";
$jack = $year;
echo "<table width=500><tr><td valign=top>";
}
foreach ($monthnum as $jast) {
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
switch ($month){
default:
echo "<table cellspacing=1 cellpadding=1 border=2 width=170 height=150><tr><td align=center><table height=20><tr><td valign=top><center>$monthname[$jast]</center></td></tr></table></td></tr><tr><td valign=top><table height=130 valign=top><tr><td valign=top>";
break 2;}}
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
$jack2 = "$jack$monthdate[$jast]";
if ($bodytag = "") {
print "";
}elseif ($yearmonth == $jack2) {
print "<a href=\"?date=$year$month$day\">$day</a>\n";
$x++;
}}
echo "</td></tr></table></td></tr></td></table></td>";
if ($jast == 3 || $jast == 6 || $jast == 9 || $jast == 12)
{
   echo "</tr><tr><td valign=top>";
} else {
echo "<td valign=top>"; }
}
echo "</td></tr></table>";
break;}}}
echo "</td></tr></table></center></td></tr></table>";
}}
function navdrop() {
global $date, $date;
$dropdown = file("dropdown.txt");
$dropdownoption = file("dropdownurl.txt");
echo "<form NAME=\"SelectURL\"><select NAME=\"picker\">";
static $xnum = "0";
foreach ($dropdown as $t)  {
global $date, $date;
$fleck = $dropdownoption[$xnum];
print '<OPTION VALUE="'; print '?date='; echo $dropdownoption[$xnum]; if ($fleck >= $date) { print '" SELECTED>'; } else { print '">'; } echo $t; print '';
$xnum++;
};
echo "</select><input TYPE=\"BUTTON\" VALUE=\"Go\" onClick=\"GotoURL(this.form)\"><script LANGUAGE=\"JavaScript\"><!--
function GotoURL(f) {
top.location.href = f.picker.options[f.picker.selectedIndex].value;
}<!--end--></script><br>";}
function timestamp() {
global $date, $pest, $pest2, $year;
if ($date == "archive") {echo "Archive"; } else { echo "$pest $pest2, $year"; }
}
function first() {
global $date, $xf;
echo "?date=$xf";
}
function last() {
global $date, $xl;
echo "";
}
function previous() {
global $date, $xy, $xf;
if ($date >= $xy && $date > $xf) { echo "?date=$xy"; }
}
function forward() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "?date=$xz"; } else { echo ""; }
}
function firsttext() {
global $date, $file, $bodytagxl, $stat, $xf;
if ($date > $xf) { echo "<a href=\"?date=$xf\">"; echo "First"; echo "</a>"; }
}
function lasttext() {
global $date, $xl;
if ($date < $xl) { echo "<a href=\"\">"; echo "Current"; echo "</a>"; }
}
function previoustext() {
global $date, $xy, $xf;
if ($date >= $xy && $date > $xf) { echo "<a href=\"?date=$xy\">"; echo "Previous"; echo "</a>"; }
}
function forwardtext() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "<a href=\"?date=$xz\">"; echo "Next"; echo "</a>"; }
}
function firstbutton() {
global $date, $xf;
if ($date > $xf) { echo "<a href=\"?date=$xf\">"; echo "<img src=\"/navimg/first.jpg\" border=0 Alt=\"First\">"; echo "</a>"; }
}
function lastbutton() {
global $date, $num, $xl;
if ($date < $xl) { echo "<a href=\"./\">"; echo "<img src=\"/navimg/current.jpg\" border=0 Alt=\"Current\">"; echo "</a>"; }
}
function previousbutton() {
global $date, $xf, $xy;
if ($date >= $xy && $date > $xf) { echo "<a href=\"?date=$xy\">"; echo "<img src=\"/navimg/previous.jpg\" border=0 Alt=\"Previous\">"; echo "</a>"; }
}
function forwardbutton() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "<a href=\"?date=$xz\">"; echo "<img src=\"/navimg/next.jpg\" border=0 Alt=\"Next\">"; echo "</a>"; }
}
function poweredby() {
$ver = "7.0";
echo "Powered by <a href=\"http://downloads.atp.cx/\" STYLE=\"text-decoration: none\">ATP AutoSite $ver</a> © 2002 <a href=\"http://atp.cx/\" STYLE=\"text-decoration: none\">ATP Productions</a></font><br>";
}
function currentmonth() {
global $date, $num, $testarr2, $month, $yearmonth, $file;
$monthname = array("01" => 'January', "02" => 'February', "03" => 'March', "04" => 'April', "05" => 'May', "06" => 'June', "07" => 'July', "08" => 'August', "09" => 'September', "10" => 'October', "11" => 'November', "12" => 'December');
$monthdate = array(1 => '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$monthnum = array(1 => '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
switch ($monthx){
default:
echo "<table cellspacing=1 cellpadding=1 border=2 width=170 height=150><tr><td align=center><table height=20><tr><td valign=top><center>$monthname[$month]</center></td></tr></table></td></tr><tr><td valign=top><table height=130 valign=top><tr><td valign=top>";
break;}
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$yearx = substr($bodytag, 0, 4);
$monthx = substr($bodytag, 4, 2);
$dayx = substr($bodytag, 6, 2);
$yearmonthx = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
if ($yearmonth == $yearmonthx) {print "<a href=\"?date=$yearx$monthx$dayx\">$dayx</a>\n";
}}
echo "</td></tr></table></td></tr></td></table>";
}
function news() {
global $date, $xl;
if (!$date || $date == $xl) {
include ('news.php'); }
}
?>

Hello,

 

I'm getting the following error message:

 

Fatal error:  Call to undefined function  timestamp() in xxxxxxxxxx on line 6

 

When I look at line 6, it's:

 

$fletch = date ("Ymd");

 

There's no MySQL involved in this code, it's just PHP. For some reason it won't recognize today (current)'s date, but it recognizes anything backdated.

 

 

make something like that

$fletch = date ("Ymd",time());

 

or if u r fetching from database then fetching field be something lke that

$db_firld = strtotime('your db field');

$fletch = date ("Ymd",$db_firld);

 

 

Hi,

 

Thanks for looking at this. I tried the "$fletch = date ("Ymd",time());" suggestion, but it's still not working. Is there anything I'm supposed to add to the "time" part other than that?

 

That code above, named ATP-autosite.php, gets loaded into my main site with the below code:

 

<?php include 'ATP-autosite.php'; ?><html>
<head><title> EDITED OUT</title></head>
<body>
EDITED

<p align=right><b><?php echo timestamp(); ?></b></p>
<center>
<?php echo content(); ?>
<br><br>
<?php echo firstbutton(); ?> <?php echo previousbutton(); ?> <?php echo forwardbutton(); ?> <?php echo lastbutton(); ?></center>

EDITED
</body></html>

 

The fatal error message is the same, but I managed to figure out that the line it's referring to is the one that has "<?php echo timestamp(); ?>" in it. Am I just writing it wrong? Should there be a paragraph break in it or something?

Hi,

 

I changed it to require, and used the full URL so I could see any errors (for some reason if I use localized links eg. autosite.php instead of http://url/autosite.php, the error message won't show up). Still getting the "Fatal error: Call to undefined function timestamp()" message for the line with php echo timestamp. :(

 

You cannot include a file via a url and have its variables, functions or classes enter the current scope. All you get is the output of the file.

 

Put this at the top of your scipt.

 

<?php error_reporting(E_ALL) ; ini_set('display_errors', '1'); ?>

 

what errors do you get?

Oh, okay. I'm getting these:

 

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 30

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 42

Notice: Undefined variable: date in /home/tentativ/public_html/bp/ATP-autosite.php on line 48

Notice: Undefined variable: prefix in /home/tentativ/public_html/bp/ATP-autosite.php on line 54

Notice: Undefined offset: 7 in /home/tentativ/public_html/bp/ATP-autosite.php on line 62

 

This is the ATP-autosite code:

 

<?php
/*************************************************************************
*                                ATP AutoSite
*                                ATP-autosite.php
*                         
*   version		  : 7.0
*   begin		  : Friday, April 5, 2002
*   copyright             : (C) 2002 ATP Productions
*   email	          : [email protected]
**************************************************************************/

//WARNING!!! Changing the contents of this file in any way whatsoever could break the script entirely! 
//Only touch if you know what you are doing with php!

if (file_exists("swnews.php")) {
include ('swnews.php'); }
if (file_exists("alttags.php")) {
include ('alttags.php'); }
$fletch = date ("Ymd",time());
$dir = dir("strips");
$num = 0;
$zam = $dir->read();
$zam = $dir->read();
$testarr = array();
$testarr2 = array();
$testarr3 = array();
while ($file[$num] = $dir->read()) {
$blext = substr($file[$num], 9, 3);
$blmonth = substr($file[$num], 0, 6);
$bodytag1 = str_replace ("$prefix", "", "$file[$num]");
$bodytag = str_replace ("$blext", "", "$bodytag1");
$bodytagx = str_replace (".", "", "$bodytag");
if (!isset($testarr[$bodytagx])) $testarr[$bodytagx] = $blext;
if (!isset($testarr2[$num])) $testarr2[$num] = $bodytagx;
if (!isset($testarr3[$bodytagx])) $testarr3[$bodytagx] = $bodytagx;
$num++;
}
$dir->close();
sort($file);
sort($testarr2);
sort($testarr3);
$bodytagg1 = str_replace ("$prefix", "", "$file[$num]");
$bodytagg = str_replace ("$blext", "", "$bodytagg1");
$garr1 = str_replace ("gif", "", "$bodytagg");
$garr2 = str_replace ("png", "", "$garr1");
$garr3 = str_replace ("jpg", "", "$garr2");
$bodytaggx = str_replace (".", "", "$garr3");
if ($date == "") {
$date = $bodytaggx; }
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day = substr($date, 6, 2);
$yearmonth = substr($date, 0, 6);
$bodytag1l = str_replace ("$prefix", "", "$file[1]");
$bodytagl = str_replace ("$blext", "", "$bodytag1l");
$bodytagxl = str_replace (".", "", "$bodytagl");
$stat = array_search ($date, $testarr2);
$blextarr = array("gif"=>'gif', "jpg"=>'jpg', "png"=>'png');
$blext = substr($file[$stat], 9, 3);
$ext = $blextarr[$blext];
$xy = $testarr2[$stat - 1];
$xz = $testarr2[$stat + 1];
$xf = $testarr2[0];
$xl = $testarr2[$num - 1];
$mot = substr($day, 0, 1);
if ($mot == "0") {
$pest2 = substr($day, 1, 1);
} else { 
$pest2 = $day; }
$monthname2 = array("01"=>'January', "02"=>'February', "03"=>'March', "04"=>'April', "05"=>'May', "06"=>'June', "07"=>'July', "08"=>'August', "09"=>'September', "10"=>'October',  "11"=>'November', "12"=>'December');
$pest = $monthname2[$month];
if (file_exists("upload/$fletch.$ext")) {
          rename("upload/$fletch.$ext","strips/$fletch.$ext"); 
     } elseif (file_exists("upload/$fletch.jpg")) {
          rename("upload/$fletch.jpg","strips/$fletch.jpg"); 
     } elseif (file_exists("upload/$fletch.png")) {
          rename("upload/$fletch.png","strips/$fletch.png"); 
     } elseif (file_exists("upload/$fletch.gif")) {
          rename("upload/$fletch.gif","strips/$fletch.gif"); 
     }
if (file_exists("upload/$fletch.php")) {
          rename("upload/$fletch.php","comments/$fletch.php"); 
     } elseif (file_exists("upload/$fletch.txt")) {
          rename("upload/$fletch.txt","comments/$fletch.txt"); 
     }
$imgletter = "96";
$imgletterx = "96";
function contentx() {
global $date, $ext, $fletch, $imgletter, $num, $file, $alttext;
$imgletter++;
if (file_exists("upload/" . $fletch . chr($imgletter) . ".gif")) {
rename("upload/" . $fletch . chr($imgletter) . ".gif","stripsx/" . $fletch . chr($imgletter) . ".gif"); 
} elseif (file_exists("upload/" . $fletch . chr($imgletter) . ".png")) {
rename("upload/" . $fletch . chr($imgletter) . ".png","stripsx/" . $fletch . chr($imgletter) . ".png"); 
} elseif (file_exists("upload/" . $fletch . chr($imgletter) . ".jpg")) {
rename("upload/" . $fletch . chr($imgletter) . ".jpg","stripsx/" . $fletch . chr($imgletter) . ".jpg"); 
}
if (file_exists("stripsx/" . $date . chr($imgletter) . ".gif")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".gif\" alt=\"$alttext[$cxdate]\"><br>";
break;
}} elseif (file_exists("stripsx/" . $date . chr($imgletter) . ".png")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".png\" alt=\"$alttext[$cxdate]\"><br>";
break;
}} elseif (file_exists("stripsx/" . $date . chr($imgletter) . ".jpg")) {
while ($imgletter <= 122) {
$cxdate = "" . $date . chr($imgletter) . "";
	echo "<img src=\"stripsx/" . $date . chr($imgletter) . ".jpg\" alt=\"$alttext[$cxdate]\"><br>";
break;
}}}
function comment() {
global $date, $fletch, $num, $file;
if (file_exists("comments/$date.php")) {
$commenturl = "comments/$date.php";
include ($commenturl); } elseif (file_exists("comments/$date.txt")) {
$commenturl = "comments/$date.txt";
include ($commenturl); }
}
function commentx() {
global $date, $fletch, $num, $imgletterx, $file;
$imgletterx++;
if (file_exists("upload/" . $fletch . chr($imgletterx) . ".php")) {
rename("upload/" . $fletch . chr($imgletterx) . ".php","comments/" . $fletch . chr($imgletterx) . ".php"); 
}
if (file_exists("upload/" . $fletch . chr($imgletterx) . ".txt")) {
rename("upload/" . $fletch . chr($imgletterx) . ".txt","comments/" . $fletch . chr($imgletterx) . ".txt"); 
}
if (file_exists("comments/" . $date . chr($imgletterx) . ".php")) {
while ($imgletterx <= 122) {
$commenturl = "comments/" . $date . chr($imgletterx) . ".php";
include ($commenturl); 
break;
}} elseif (file_exists("comments/" . $date . chr($imgletterx) . ".txt")) {
while ($imgletterx <= 122) {
$commenturl = "comments/" . $date . chr($imgletterx) . ".txt";
include ($commenturl); 
break;
}}}
function content() {
global $date, $prefix, $ext, $testarr, $stat, $num, $file, $bizzar, $bodytagxy, $bodytagxz, $testkey, $alttext, $altdefault;
echo "<img src=\"strips/$prefix$date.$testarr[$date]\" alt=\""; if ($alttext[$date]) {echo $alttext[$date];} else {echo $altdefault; } echo "\"><br>";
}
function archive() {
global $date, $num, $file;
if ($date == "archive") {
static $x = 1;
$staryear = 1990;  
$end_year = date("Y", time());
        $count = 1;
for ($i = $staryear; $i <= $end_year; $i++)
{
        $yeardates[$count] = $i;
        $count++;
}
$monthname = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$monthdate = array(1 => '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$monthnum = array(1 => '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
}
foreach ($yeardates as $yitti) {
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
if ($yitti == $year){
if ($yitti == $year){
$xyy++;
echo "<table><tr><td><center><table cellspacing=1 cellpadding=1 border=2 width=520><tr><td align=center valign=top><center>$yitti</center></td></tr></table>";
$jack = $year;
echo "<table width=500><tr><td valign=top>";
}
foreach ($monthnum as $jast) {
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
switch ($month){
default:
echo "<table cellspacing=1 cellpadding=1 border=2 width=170 height=150><tr><td align=center><table height=20><tr><td valign=top><center>$monthname[$jast]</center></td></tr></table></td></tr><tr><td valign=top><table height=130 valign=top><tr><td valign=top>";
break 2;}}
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$year = substr($bodytag, 0, 4);
$month = substr($bodytag, 4, 2);
$day = substr($bodytag, 6, 2);
$yearmonth = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
$jack2 = "$jack$monthdate[$jast]";
if ($bodytag = "") {
print "";
}elseif ($yearmonth == $jack2) {
print "<a href=\"?date=$year$month$day\">$day</a>\n";
$x++;
}}
echo "</td></tr></table></td></tr></td></table></td>";
if ($jast == 3 || $jast == 6 || $jast == 9 || $jast == 12)
{
   echo "</tr><tr><td valign=top>";
} else {
echo "<td valign=top>"; }
}
echo "</td></tr></table>";
break;}}}
echo "</td></tr></table></center></td></tr></table>";
}}
function navdrop() {
global $date, $date;
$dropdown = file("dropdown.txt");
$dropdownoption = file("dropdownurl.txt");
echo "<form NAME=\"SelectURL\"><select NAME=\"picker\">";
static $xnum = "0";
foreach ($dropdown as $t)  {
global $date, $date;
$fleck = $dropdownoption[$xnum];
print '<OPTION VALUE="'; print '?date='; echo $dropdownoption[$xnum]; if ($fleck >= $date) { print '" SELECTED>'; } else { print '">'; } echo $t; print '';
$xnum++;
};
echo "</select><input TYPE=\"BUTTON\" VALUE=\"Go\" onClick=\"GotoURL(this.form)\"><script LANGUAGE=\"JavaScript\"><!--
function GotoURL(f) {
top.location.href = f.picker.options[f.picker.selectedIndex].value;
}<!--end--></script><br>";}
function timestamp() {
global $date, $pest, $pest2, $year;
if ($date == "archive") {echo "Archive"; } else { echo "$pest $pest2, $year"; }
}
function first() {
global $date, $xf;
echo "?date=$xf";
}
function last() {
global $date, $xl;
echo "";
}
function previous() {
global $date, $xy, $xf;
if ($date >= $xy && $date > $xf) { echo "?date=$xy"; }
}
function forward() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "?date=$xz"; } else { echo ""; }
}
function firsttext() {
global $date, $file, $bodytagxl, $stat, $xf;
if ($date > $xf) { echo "<a href=\"?date=$xf\">"; echo "First"; echo "</a>"; }
}
function lasttext() {
global $date, $xl;
if ($date < $xl) { echo "<a href=\"\">"; echo "Current"; echo "</a>"; }
}
function previoustext() {
global $date, $xy, $xf;
if ($date >= $xy && $date > $xf) { echo "<a href=\"?date=$xy\">"; echo "Previous"; echo "</a>"; }
}
function forwardtext() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "<a href=\"?date=$xz\">"; echo "Next"; echo "</a>"; }
}
function firstbutton() {
global $date, $xf;
if ($date > $xf) { echo "<a href=\"?date=$xf\">"; echo "<img src=\"navimg/first.jpg\" border=0 Alt=\"First\">"; echo "</a>"; }
}
function lastbutton() {
global $date, $num, $xl;
if ($date < $xl) { echo "<a href=\"./\">"; echo "<img src=\"navimg/current.jpg\" border=0 Alt=\"Current\">"; echo "</a>"; }
}
function previousbutton() {
global $date, $xf, $xy;
if ($date >= $xy && $date > $xf) { echo "<a href=\"?date=$xy\">"; echo "<img src=\"navimg/previous.jpg\" border=0 Alt=\"Previous\">"; echo "</a>"; }
}
function forwardbutton() {
global $date, $xz, $xl;
if ($date <= $xz && $date < $xl) { echo "<a href=\"?date=$xz\">"; echo "<img src=\"navimg/next.jpg\" border=0 Alt=\"Next\">"; echo "</a>"; }
}
function poweredby() {
$ver = "7.0";
echo "Powered by <a href=\"http://downloads.atp.cx/\" STYLE=\"text-decoration: none\">ATP AutoSite $ver</a> © 2002 <a href=\"http://atp.cx/\" STYLE=\"text-decoration: none\">ATP Productions</a></font><br>";
}
function currentmonth() {
global $date, $num, $testarr2, $month, $yearmonth, $file;
$monthname = array("01" => 'January', "02" => 'February', "03" => 'March', "04" => 'April', "05" => 'May', "06" => 'June', "07" => 'July', "08" => 'August', "09" => 'September', "10" => 'October', "11" => 'November', "12" => 'December');
$monthdate = array(1 => '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$monthnum = array(1 => '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
switch ($monthx){
default:
echo "<table cellspacing=1 cellpadding=1 border=2 width=170 height=150><tr><td align=center><table height=20><tr><td valign=top><center>$monthname[$month]</center></td></tr></table></td></tr><tr><td valign=top><table height=130 valign=top><tr><td valign=top>";
break;}
foreach ($file as $v) {
$bodytag1 = str_replace ("$prefix", "", "$v");
$bodytag = str_replace ("$ext", "", "$bodytag1");
$yearx = substr($bodytag, 0, 4);
$monthx = substr($bodytag, 4, 2);
$dayx = substr($bodytag, 6, 2);
$yearmonthx = substr($bodytag, 0, 6);
array_merge ($month, $monthname);
if ($yearmonth == $yearmonthx) {print "<a href=\"?date=$yearx$monthx$dayx\">$dayx</a>\n";
}}
echo "</td></tr></table></td></tr></td></table>";
}
function news() {
global $date, $xl;
if (!$date || $date == $xl) {
include ('news.php'); }
}
?>

Slapping my forehead right now. Thanks so much!!

 

Please bear with me. . . .

 

Okay, I put "$prefix = "";" at the top of the code, and that's taken out the repeated error notices. Now I'm seeing this:

 

Notice: Undefined variable: date in /home/tentativ/public_html/bp/ATP-autosite.php on line 49

Notice: Undefined offset: 7 in /home/tentativ/public_html/bp/ATP-autosite.php on line 63

 

So line 49 is:

 

if ($date == "") {

 

So that means  I haven't defined what the $date variable is, correct? I put this in the code:

 

$date = date ("Ymd");

 

So now I'm getting:

 

Notice: Undefined offset: 0 in /home/tentativ/public_html/bp/ATP-autosite.php on line 62

Notice: Undefined offset: -1 in /home/tentativ/public_html/bp/ATP-autosite.php on line 63

 

And then later on, where the image (YYYYMMDD.jpg) is supposed to appear, it reads:

 

Notice: Undefined index: 20100131 in /home/tentativ/public_html/bp/ATP-autosite.php on line 146

 

Is undefined offset/index similar to undefined variable? I'm looking at those lines and they seem to have been mentioned before. . . .

 

Sorry about this. I really appreciate the time you're taking to look at it.

Okay, I went back and removed the "$date = date ("Ymd");" line because it broke the rest of the site. Apparently that was not the thing to do. . . .

 

So that means it's just:

 

Notice: Undefined variable: date in /home/tentativ/public_html/bp/ATP-autosite.php on line 49

Notice: Undefined offset: 7 in /home/tentativ/public_html/bp/ATP-autosite.php on line 63

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.