<?PHP
//COPYRIGHT 2002, Daniel Pascal Lamblin. All Rights Reserved.
//Configuration Variables
$server = "www.syntaxerr.org";//The name of your server
$home = "/home"; //[most] UNIX style
$public = "public_html"; //[most] UNIX style
//$home = "/Users"; //MacOS X Style
//$public = "Sites"; //MacOS X Style
$user = $_GET['user'];
$days = $_GET['days'];
//////**ERROR CHECKING SEGMENT BEGIN
//Generate an errors page if arguments not specified or just plain bad/evil.
//[was] header("Location: whatsnew_error.html");
$badness = "";
if (!isset($user,$days)) {
$badness = "The variables 'user' and/or 'days' were not defined. <BR>
Try: <A HREF=\"${PHP_SELF}?days=14&user=jvdietsc\">${PHP_SELF}?days=14&user=jvdietsc</A>";
} else {
//since $user and $days were specified. We can safely define $pub
$pub = $home . "/" . $user . "/" . $public;
if ($days <= 0) {
$badness = "I can't check the last '$days' days for modifications.";
} else {
if ($days > 365) {
$badness = "In the interest of world peace and harmony, searches in excess of 365 days are not supported.";
} else {
if (!file_exists($pub)) {
$badness = "The user does not have a public web directory or does not exist.";
} else {
if ( ((fileperms($pub) & 5) ^ 5) ) {
$badness = "The user does not have a public web directory or does not exist.";
}
}
}
}
}
if($badness != "") {
die("
<HTML><HEAD><TITLE>ERROR</TITLE></HEAD><BODY>
<H1>ROAR! -- ERROR!</H1>
<H4> with $PHP_SELF </H4>
<HR NOSHADE>
<DIV ALIGN=\"CENTER\">$badness</DIV>
<HR NOSHADE>
--Bitch.
</BODY></HTML>
");
}
//////**ERROR CHECKING SEGMENT END
?>
<HTML>
<HEAD>
<TITLE><?PHP echo "${server}: Whats new for $user ($days days)"; ?></TITLE>
<STYLE TYPE="text/css">
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<BR>
<DIV ALIGN="CENTER">
<!-- The Bordered Window -->
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD>
<IMG WIDTH="7" HEIGHT="18" SRC="grey_win_01.jpg" ALT="">
</TD>
<TD WIDTH="500" BACKGROUND="grey_win_02.jpg" ALIGN="center">
<SPAN STYLE="color:#000000;font-weight:normal;font-size:9px">
<?PHP echo "${server}/~${user}/ -- last modified in ${days} days";?>
</SPAN>
</TD>
<TD>
<IMG WIDTH="7" HEIGHT="18" SRC="grey_win_03.jpg" ALT="">
</TD>
</TR>
<TR>
<TD BACKGROUND="grey_win_04.jpg" ALT="">
<IMG WIDTH="7" HEIGHT="14" SRC="grey_win_04.jpg" ALT="">
</TD>
<TD ALIGN="LEFT">
<!-- WINDOW INTERIOR -->
<TABLE width="100%">
<TR>
<TD width="20" VALIGN="BOTTOM">
<HR NOSHADE>
</TD>
<TD width="55%" VALIGN="BOTTOM">
Name
<HR NOSHADE>
</TD>
<TD width="10%" VALIGN="BOTTOM" ALIGN="RIGHT">
Size
<HR NOSHADE>
</TD>
<TD width="30%" VALIGN="BOTTOM" ALIGN="RIGHT">
Last Modified
<HR NOSHADE>
</TD>
</TR>
<!-- The main PHP generated list -->
<?PHP
//////** TOUCHED - Segment BEGIN
$touched_paths_prune = "";
//does the user have an .exclude_touched_paths?
if (file_exists($pub . "/.exclude_touched_paths"))
{
//make a string that would look like:
//> \( -path "/home/fooser/public_html/foo/foo1" -prune \) -or
//> \( -path "/home/fooser/public_html/foo2" -prune \) -or
// concatenated, from the input:
//> foo/foo1
//> foo2
// not concatenated
$touched_paths_prune = `cat ${pub}/.exclude_touched_paths | perl -n -e 'chomp;print "\\\\( -path \"${pub}/";print;print "\" -prune \\\\) -or ";'`;
}
// for every day in days, do a search for files modified then.
$notouch = 0;
//quote for grepping
$qpub = preg_quote($pub, "/");
for($d=1; $d<=$days; $d++) {
if ("" != $results = `find ${pub} ${touched_paths_prune} \( -name "\.*" -type f -prune \) -or \( -mtime $d -type f -perm -o+r -print \)`)
{
//There has been a file touched on today - $d +1
$results=chop($results); //removes trailing blank line
//for each modified file:
foreach (preg_split("/[\r\n]+/", $results) as $fn) {
//substitute "~fooser" for "/home/fooser/public_html"
$fref = preg_replace("/${qpub}/", "~${user}", $fn);
//get last modified date
$fmd = date("M dS Y", filemtime($fn) );
//get size in bytes/1024+1
$fsz = (int)(filesize($fn)/1024)+1;
?>
<TR>
<TD ALIGN="left" VALIGN="top">
<?PHP
echo " <A HREF=\"/${fref}\">
<IMG SRC=\"/icons/generic.gif\" WIDTH=\"20\" HEIGHT=\"22\" BORDER=\"0\" ALIGN=\"MIDDLE\" ALT=\"icon\">
</A>
</TD>
<TD ALIGN=\"left\" VALIGN=\"top\">
<A HREF=\"/${fref}\">
${fref}
</A><BR><BR>
"; ?>
</TD>
<TD ALIGN="right">
<?PHP echo " ${fsz} Kb<BR><BR>\n"; ?>
</TD>
<TD ALIGN="right">
<?PHP echo " ${fmd}<BR><BR>\n"; ?>
</TD>
</TR>
<?PHP
}
echo "<TR><TD><HR NOSHADE></TD><TD><HR NOSHADE></TD><TD><HR NOSHADE></TD><TD><HR NOSHADE></TD></TR>\n";
} else {
$notouch++;
}
}
if ($notouch == $days){
echo "<TR><TD COLSPAN=\"3\" ALIGN=\"CENTER\">There are no modified files in the last ${days} days for ${user}.</TD></TR>\n";
}
//////** TOUCHED - Segment END
?>
<!-- end the PHP generated list -->
</TABLE>
<!-- end WINDOW INTERIOR -->
</TD>
<TD BACKGROUND="grey_win_06.jpg">
<IMG WIDTH="7" HEIGHT="14" SRC="grey_win_06.jpg" ALT="">
</TD>
</TR>
<TR>
<TD>
<IMG WIDTH="7" HEIGHT="7" SRC="grey_win_07.jpg" ALT="">
</TD>
<TD BACKGROUND="grey_win_08.jpg">
<IMG WIDTH="16" HEIGHT="7" SRC="grey_win_08.jpg" ALT="">
</TD>
<TD>
<IMG WIDTH="7" HEIGHT="7" SRC="grey_win_09.jpg" ALT="">
</TD>
</TR>
</TABLE>
<!-- End the Bordered Window -->
</DIV>
<BR><BR>
syntaxerr.org webpage creation <A HREF="user_help.html">help</A>.
</BODY>
</HTML>