rendered paste body$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$buff = ftp_rawlist($conn_id, '/s60/2006/');
if ($buff == NULL) { die( "Unable to retrieve file listings. Please contact the site administrator at visualise@gmail.com." ); }
$i=0;
while ($i < count($buff)) {
$b=substr($buff[$i], 0, 10);
if ($b == 'drwxr-xr-x') {
$pieces=explode(" ", $buff[$i]);
$month=$pieces[count($pieces) - 1];
$x=$i;
}
$i++;
}
$pieces2=explode(" ", $buff[$x - 1]);
$month2=$pieces2[count($pieces2) - 1];
$buff = ftp_rawlist($conn_id, '/s60/2006/' . $month);
$i=0;
while ($i < count($buff)) {
$b=substr($buff[$i], 0, 10);
if ($b == 'drwxr-xr-x') {
$pieces=explode(" ", $buff[$i]);
$day=$pieces[count($pieces) - 1];
$x = $i;
}
$i++;
}
$pieces=explode(" ", $buff[$x - 1]);
$day2=$pieces[count($pieces) - 1];
$pieces=explode(" ", $buff[$x - 2]);
$day3=$pieces[count($pieces) - 1];
$t1=substr($day,2,4).'.'.substr($day,0,2).'.'.substr($month,2,6).'<br>';
$contents1=ftp_nlist($conn_id, "s60/2006/$month/$day");
$substr=substr($day,2,4);
if ($substr == '01') {
$buff = ftp_rawlist($conn_id, '/s60/2006/' . $month2);
$i=0;
while ($i < count($buff)) {
$b=substr($buff[$i], 0, 10);
if ($b == 'drwxr-xr-x') {
$pieces=explode(" ", $buff[$i]);
$day=$pieces[count($pieces) - 1];
$x=$i;
}
$i++;
}
$pieces=explode(" ", $buff[$x - 1]);
$day2=$pieces[count($pieces) - 1];
$t2=substr($day,2,4).'.'.substr($month2,0,2).'.'.substr($month2,2,6).'<br>';
$contents2 = ftp_nlist($conn_id, "s60/2006/$month2/$day");
$t3=substr($day2,2,4).'.'.substr($month2,0,2).'.'.substr($month2,2,6).'<br>';
$contents3 = ftp_nlist($conn_id, "s60/2006/$month2/$day2");
ftp_close($conn_id);
html($t1,$t2,$t3,$contents1,$contents2,$contents3);
}
if ($substr == '02') {
$t2=substr($day2,2,4).'.'.substr($day2,0,2).'.'.substr($month,2,6).'<br>';
$contents2 = ftp_nlist($conn_id, "s60/2006/$month/$day2");
$buff = ftp_rawlist($conn_id, '/s60/2006/' . $month2);
$i=0;
while ($i < count($buff)) {
$b=substr($buff[$i], 0, 10);
if ($b == 'drwxr-xr-x') {
$pieces=explode(" ", $buff[$i]);
$day=$pieces[count($pieces) - 1];
$x=$i;
}
$i++;
}
$t3=substr($day,2,4).'.'.substr($month2,0,2).'.'.substr($month2,2,6).'<br>';
$contents3=ftp_nlist($conn_id, "s60/2006/$month2/$day");
ftp_close($conn_id);
html($t1,$t2,$t3,$contents1,$contents2,$contents3);
}
else {
$t2=substr($day2,2,4).'.'.substr($day2,0,2).'.'.substr($month,2,6).'<br>';
$contents2 = ftp_nlist($conn_id, "s60/2006/$month/$day2");
$t3=substr($day3,2,4).'.'.substr($day3,0,2).'.'.substr($month,2,6).'<br>';
$contents3 = ftp_nlist($conn_id, "s60/2006/$month/$day3");
ftp_close($conn_id);
html($t1,$t2,$t3,$contents1,$contents2,$contents3);
}
function html($t1,$t2,$t3,$contents1,$contents2,$contents3) {
$file=fopen( "index.html", "w" );
$xml=fopen( "rss.xml", "w" );
putenv("TZ=Europe/London");
$date=date('D, d M Y H:i:s');
fwrite($xml, "<?xml version=\"1.0\" ?><rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"><channel>
<title>#AIVAnet Latest</title><link>http://pdaddicts.net/latest/</link><description>#AIVAnet Latest - The Last
3 Days in 1 Place</description>");
fwrite($xml, "<lastBuildDate>$date GMT</lastBuildDate><docs>http://blogs.law.harvard.edu/tech/rss
</docs><language>en</language>");
fwrite($file, '<html><head><title>#AIVAnet Latest - The Last 3 Days in 1 Place</title><style type="text/css">');
fwrite($file, '<!--');
fwrite($file, 'body {');
fwrite($file, 'background-color: #6699FF;');
fwrite($file, 'margin-left: 0px;');
fwrite($file, 'margin-top: 0px;');
fwrite($file, 'margin-right: 0px;');
fwrite($file, 'margin-bottom: 0px;');
fwrite($file, '}');
fwrite($file, '.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}');
fwrite($file, '-->');
fwrite($file, '</style><link href="aivabase.css" rel="stylesheet" type="text/css" /><style type="text/css">');
fwrite($file, '<!--');
fwrite($file, '.style2 {font-size: 14px}');
fwrite($file, 'a:link { color: #000000; text-decoration: none; }');
fwrite($file, 'a:visited { color: #000000; text-decoration: none; }');
fwrite($file, 'a:hover { color: #000000; text-decoration: none; }');
fwrite($file, 'a:active { color: #000000; text-decoration: none; }');
fwrite($file, '-->');
fwrite($file, '</style></head><body>');
fwrite($file, '<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" class="border"><tr>');
fwrite($file, '<td bordercolor="#000000" bgcolor="#6699FF"><div align="center" class="header style1"><a href="irc://irc.efnet.net/AIVAnet">#AIVAnet</a> Latest - The Last 3 Days in 1 Place. </div></td>');
fwrite($file, '</tr><tr><td height="53" valign="middle" bordercolor="#000000" bgcolor="#FFFFFF"><div align="center">');
fwrite($file, '<span class="style1 style2"><br />This is a sample page from the soon to come AIVABASE website.<br />');
fwrite($file, 'This page is refreshed every 15 minutes, so be sure to come back and check for updates!<br /><br />
<a href="rss.xml"><img src="rss.gif" border="0"></a><br /><br /></span></div></td></tr><tr>');
fwrite($file, '<td bordercolor="#000000" bgcolor="#6699FF" class="header"><div align="center"><span class="header style1">');
fwrite($file, $t1);
fwrite($file, '</span></div></td>');
fwrite($file, '</tr><tr><td height="100%" bgcolor="#FFFFFF"><div align="center"><span class="style1"><br /><span class="style2">');
$strtotime=substr($t1,3,2).'/'.substr($t1,0,2).'/'.substr($t1,6,4);
$date=date('D, d M Y', strtotime($strtotime));
$i=0;
$n=count($contents1);
while ($i < $n) {
fwrite($file, $contents1[$i].'<br />');
fwrite($xml, "<item><title>\r\n".htmlspecialchars($contents1[$i])."\r\n</title>\r\n<pubDate>$date</pubDate></item>\r\n");
$i++;
}
fwrite($file, '</span></span><br />');
fwrite($file, '</div></td>');
fwrite($file, '</tr>');
fwrite($file, '<tr>');
fwrite($file, '<td bgcolor="#6699FF"><div align="center" class="header style1">');
fwrite($file, $t2);
fwrite($file, '</div></td>');
fwrite($file, '</tr>');
fwrite($file, '<tr>');
fwrite($file, '<td height="100%" bgcolor="#FFFFFF"><div align="center" class="style1"><span class="style2"><br />');
$strtotime=substr($t2,3,2).'/'.substr($t2,0,2).'/'.substr($t2,6,4);
$date=date('D, d M Y', strtotime($strtotime));
$i=0;
$n=count($contents2);
while ($i < $n) {
fwrite($file, $contents2[$i].'<br />');
fwrite($xml, "<item><title>\r\n".htmlspecialchars($contents2[$i])."\r\n</title>\r\n<pubDate>$date</pubDate></item>\r\n");
$i++;
}
fwrite($file, '</span><br />');
fwrite($file, '</div></td>');
fwrite($file, '</tr>');
fwrite($file, '<tr>');
fwrite($file, '<td bgcolor="#6699FF"><div align="center" class="header style1">');
fwrite($file, $t3);
fwrite($file, '</div></td>');
fwrite($file, '</tr>');
fwrite($file, '<tr>');
fwrite($file, '<td height="100%" bgcolor="#FFFFFF"><div align="center">');
fwrite($file, '<p><span class="style1"><br />');
fwrite($file, '<span class="style2">');
$strtotime=substr($t3,3,2).'/'.substr($t3,0,2).'/'.substr($t3,6,4);
$date=date('D, d M Y', strtotime($strtotime));
$i=0;
$n=count($contents3);
while ($i < $n) {
fwrite($file, $contents3[$i].'<br />');
fwrite($xml, "<item><title>\r\n".htmlspecialchars($contents3[$i])."\r\n</title>\r\n<pubDate>$date</pubDate></item>\r\n");
$i++;
}
fwrite($file, '</span><br />');
fwrite($file, '</span></p>');
fwrite($file, '</div></td>');
fwrite($file, '</tr>');
fwrite($file, '<tr>');
$strtotime=substr($t1,3,2).'/'.substr($t1,0,2).'/'.substr($t1,6,4);
$date=date('r', strtotime($strtotime));
$gmtime=date("H:i");
fwrite($file, '<td height="25" bgcolor="#6699FF" class="header"><div align="center"><span class="style1 style2">Site designed, developed & maintained by Visualise (@ EFnet).<br>Last refreshed: '.$gmtime.' GMT<br>
<!-- Free-Web-Counters.net Code START --><img src="http://www.e-zeeinternet.com/count.php?page=65721&style=small_black&nbdigits=5&reloads=1" border="0" ><!-- Free-Web-Counters.net Code END --></span></div></td>');
fwrite($file, '</tr>');
fwrite($file, '</table>');
fwrite($file, '</body>');
fwrite($file, '</html>');
fwrite($xml, '</channel></rss>');
die( "Update Successful! ($gmtime GMT)" );
}