<?php

// define the base image dir
$base_img_dir = "./";

// $QUERY_STRING =
//  f(3c9b5fa6bc0fa)  img_file
//  w(123|15%)        width of output
//  h(123|10%)        height of output
//  x(123)            max width of output
//  y(123)            max height of output
//  t(jpg|png)        type of output
//  q(100)            quality of jpeg

// find tags
preg_match_all("/\+*(([a-z])\(([^\)]+)\))\+*/", $QUERY_STRING,
                $matches, PREG_SET_ORDER);

// empty array and set regular expressions for the check
$tags = array();
$check = array( "f" => "[0-9a-zA-Z]{13}",
                "w" => "[0-9]+%?",
                "h" => "[0-9]+%?",
                "x" => "[0-9]+",
                "y" => "[0-9]+",
                "t" => "jpg|png",
                "q" => "1?[0-9]{1,2}" );

// check tags and save correct values in array
for ($i=0; $i<count($matches); $i++) {
    if (isset($check[$matches[$i][2]])) {
        if (preg_match('/^('.$check[$matches[$i][2]].')$/',
               $matches[$i][3])) {
            $tags[$matches[$i][2]] = $matches[$i][3];
        }
    }
}

function notfound() {
    header("HTTP/1.0 404 Not Found");
    exit;
}

// check that filename is given
if (!isset($tags["f"])) {
    notfound();
}

// check if file exists
if (!file_exists($base_img_dir.$tags["f"])) {
    notfound();
}

// retrieve file info
$imginfo = getimagesize($base_img_dir.$tags["f"]);

// load image
switch ($imginfo[2]) {
    case 2:     // jpg
        $img_in = imagecreatefromjpeg($base_img_dir.$tags["f"]) or notfound();
        if (!isset($tags["t"])) {
            $tags["t"] = "jpg";
        }
        break;
    case 3:     // png
        $img_in = imagecreatefrompng($base_img_dir.$tags["f"]) or notfound();
        if (!isset($tags["t"])) {
            $tags["t"] = "png";
        }
        break;
    default:
        notfound();
}

// check for maximum width and height
if (isset($tags["x"])) {
    if ($tags["x"] < imagesx($img_in)) {
        $tags["w"] = $tags["x"];
    }
}
if (isset($tags["y"])) {
    if ($tags["y"] < imagesy($img_in)) {
        $tags["h"] = $tags["y"];
    }
}

// check for need to resize
if (isset($tags["h"]) or isset($tags["w"])) {
    // convert relative to absolute
    if (isset($tags["w"])) {
        if (strstr($tags["w"], "%")) {
            $tags["w"] = (intval(substr($tags["w"], 0, -1)) / 100) *
                          $imginfo[0];
        }
    }
    if (isset($tags["h"])) {
        if (strstr($tags["h"], "%")) {
            $tags["h"] = (intval(substr($tags["h"], 0, -1)) / 100) *
                          $imginfo[1];
        }
    }

    // resize
    if (isset($tags["w"]) and isset($tags["h"])) {
        $out_w = $tags["w"];
        $out_h = $tags["h"];
    } elseif (isset($tags["w"]) and !isset($tags["h"])) {
        $out_w = $tags["w"];
        $out_h = $imginfo[1] * ($tags["w"] / $imginfo[0]);
    } elseif (!isset($tags["w"]) and isset($tags["h"])) {
        $out_w = $imginfo[0] * ($tags["h"] / $imginfo[1]);
        $out_h = $tags["h"];
    } else {
        $out_w = $tags["w"];
        $out_h = $tags["h"];
    }
   
    // new image in $img_out
    $img_out = imagecreate($out_w, $out_h);
    imagecopyresized($img_out, $img_in, 0, 0, 0, 0, imagesx($img_out),
               imagesy($img_out), imagesx($img_in), imagesy($img_in));
} else {
    // no resize needed
    $img_out = $img_in;
}

// check for a given jpeg-quality, otherwise set to default
if (!isset($tags["q"])) {
    $tags["q"] = 75;
}

// returning the image
switch ($tags["t"]) {
    case "jpg":
        header("Content-type: image/jpeg");
        imagejpeg($img_out, "", $tags["q"]);
        exit;
    case "png":
        header("Content-type: image/png");
        imagepng($img_out);
        exit;
   default:
        notfound();
}

?>

Note: I did not write this script. I just found it on the web. I’m just sharing the script. I used it once on my page.

Thank you.

#!/bin/bash
ftp -n 192.168.1.1 <<!
user myusername mypassword
bin
prompt
mput *`date +%Y-%m-%d`*
quit
!
#!/bin/bash
find /home/backup_files -name "*.gz" -mtime +7 -mtime -365 -print0 |  xargs -0r rm -f
####################################################

##### ZLIB #####
http://www.gzip.org/zlib/

cd zlib-version
./configure --prefix=/usr/local/zlib
make
make install

####################################################

##### LIBXML #####
ftp://xmlsoft.org/

cd libxml-version
./configure --prefix=/usr/local/libxml --with-zlib=/usr/local/zlib
make
make install

####################################################

##### LIBJPG #####
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.version.tar.gz

cd jpeg-version
./configure --enable-shared
make
make install
make install-lib
ranlib /usr/local/lib/libjpeg.a

####################################################

##### LIBPNG #####
wget http://puzzle.dl.sourceforge.net/sourceforge/libpng/libpng-version.tar.gz

cd libpng-version
cp scripts/makefile.std ./
cp makefile.std Makefile
make
make test
make intall

####################################################

##### LIBFREETYPE #####
http://freetype.sourceforge.net/download.html

cd freetype-version
./configure --prefix=/usr/local/freetype
make
make intall

####################################################

##### GD LIBRARY #####
http://www.boutell.com/gd/

cd gd-version
./configure --prefix=/usr/local/gd-2.0 --with-png=/usr/local/lib --with-jpeg=/usr/local/lib --with-freetype=/usr/local/freetype
make
make intall

####################################################

##### OPENSSL #####

cd openssl-version
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make
make test
make install

####################################################

##### APACHE #####
http://httpd.apache.org

./configure --prefix=/usr/local/httpd --enable-modules=all --enable-FEATURE --enable-dbd --enable-mime-magic --enable-headers --enable-usertrack --enable-ssl --enable-http --enable-info --enable-cgi --enable-cgid --enable-rewrite --enable-so --enable-force-cgi-redirect --with-ssl=/usr/local

# old configure
./configure --prefix=/usr/local/httpd --enable-modules=all --enable-ssl --enable-so --enable-track-vars --enable-force-cgi-redirect --with-gettext --enable-module=log_referer --enable-module=log_config --enable-module=log_agent --enable-module=mime --enable-shared=info --enable-module=so --enable-shared=ssl --enable-module=ssl --enable-rule=SHARED_CORE

make
make install

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd

--- SNIP ---
# chkconfig: 2345 55 25
# description: HTTPD
--- END ---

####################################################

##### CREATE SELF-SIGNED SSL CERTIFICATE #####

mkdir /usr/local/httpd/conf/ssl
cd /usr/local/httpd/conf/ssl
openssl genrsa -des3 -out server.key 1034
openssl req -new -key server.key -out server.csr
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

vi /usr/local/httpd/conf/httpd.conf

--- SNIP ---

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

--- END ---

vi /usr/local/httpd/conf/extra/httpd-ssl.conf

--- SNIP ---

SSLCertificateFile "/usr/local/httpd/conf/ssl/server.crt"
SSLCertificateKeyFile "/usr/local/httpd/conf/ssl/server.key"

--- END ---

####################################################

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

##### TOMCAT #####
http://www.opensourcecommunity.ph/apache/jakarta/

tar -zxf jakarta-tomcat-VERSION
cd jakarta-tomcat-VERSION
./configure
make
make install

##### If TOMCAT is already build #####

tar -zxf jakarta-tomcat-VERSION
mv jakarta-tomcat-VERSION /usr/local/tomcat

####################################################

##### TOMCAT CONNECTOR #####
http://www.opensourcecommunity.ph/apache/jakarta/tomcat-connectors/jk

tar -zxf jakarta-tomcat-connectors-jk-VERSION
cd jakarta-tomcat-connectors-jk-VERSION/jk/native
./buildconf.sh
./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install

##### edit httpd.conf &amp; put the line: #####

vi /usr/local/httpd/conf/httpd.conf

--- SNIP --

# Tomcat Module
Include /usr/local/httpd/conf/mod_jk.conf

--- END ---

##### create mod_jk.conf &amp; put the line: #####

# Tomcat Module
vi /usr/local/httpd/conf/mod_jk.conf

--- SNIP --

# Load mod_jk module
# Update this path to match your modules location
LoadModule    jk_module  modules/mod_jk.so

# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /usr/local/httpd/conf/workers.properties

# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile     /usr/local/httpd/logs/mod_jk.shm

# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)

JkLogFile     /usr/local/httpd/logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Send everything for context /examples to worker named worker1 (ajp13)
JkMount  /examples/* worker1

--- END ---

##### create workers.properties (standard) &amp; put the line: #####

vi /usr/local/httpd/conf/workers.properties

--- SNIP --

workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/

worker.list=ajp12, ajp13

worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar

worker.inprocess.cmd_line=start
# IBM JDK1.3
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so

worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

--- END ---

####################################################

##### MOD_PYTHON #####
http://www.opensourcecommunity.ph/apache/httpd/modpython/

./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install

####################################################

##### MOD_PERL #####
http://perl.apache.org/download/index.html

perl Makefile.PL MP_APXS=/usr/local/httpd/bin/apxs
make
make test
make install

##### edit httpd.conf &amp; put the line #####

vi /usr/local/httpd/conf/httpd.conf

--- SNIP ---

# PERL module
LoadModule perl_module        modules/mod_perl.so

--- END ---

####################################################

##### INSTALL MYSQL #####

tar -zxf mysql-version.tar.gz
mv mysql-version /usr/local/mysql
adduser mysql -d /usr/local/mysql/data -s /bin/false
chown -R mysql.mysql /usr/local/mysql/data*

####################################################

##### POSTGRESQL #####
http://postgresql.net

cd postgresqlVERSION
./configure --prefix=/usr/local/pgsql --without-readline
make
make install

adduser postgres -d /var/lib/pgsql -s /bin/false
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data &gt;logfile 2&gt;&amp;1 &amp;
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

####################################################

##### PHP XML RPC EPI #####

http://xmlrpc-epi.sourceforge.net/

tar -zxf xmlrpc-epi-version
cd xmlrpc-epi-version
./configure
make
make install

####################################################

##### LIB EXPAT #####

http://expat.sourceforge.net/

tar -zxf expat-version
cd expat-version
./configure
make
make install

####################################################

ln -s /usr/local/sbin/* /usr/sbin/
ln -s /usr/local/bin/* /usr/bin/
ln -s /usr/local/lib/* /usr/lib/
ln -s /usr/local/libexec/* /usr/libexec/
ln -s /usr/local/libexec/* /usr/bin/
ln -s /usr/local/include/* /usr/include/

####################################################

##### PHP 4 AS CGI #####
http://php.net

##### ORIG #####
####./configure --prefix=/usr/local/php4 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php4/cgi --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring

##### FOR CGI REMOVE APXS2 #####
./configure --prefix=/usr/local/php4 --exec-prefix=/usr/local/php4 --with-config-file-path=/usr/local/etc/php4 --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
make
make install
mkdir -p /usr/local/etc/php4/
cp php.ini-dist /usr/local/etc/php4/php.ini

##### edit httpd.conf &amp; put the line #####

vi /usr/local/httpd/conf/httpd.conf

--- SNIP ---

# comment php4 module if any
#LoadModule php4_module        modules/libphp4.so

# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm

# PHP 4 as CGI
ScriptAlias /php-cgi/ "/usr/local/httpd/php-cgi/"
Action application/x-httpd-php4 "/php-cgi/php4"
AddHandler application/x-httpd-php4 .php4

<directory>
AllowOverride None
Options None
Order allow,deny
Allow from all
</directory>

--- END ---

mkdir /usr/local/httpd/php-cgi
cp /usr/local/php4/bin/php /usr/local/httpd/php-cgi/php4
chown apache.apache /usr/local/httpd/php-cgi/php4
chmod 755 /usr/local/httpd/php-cgi/php4

vi /usr/local/etc/php4/php.ini

##### edit php 4's php.ini &amp; add this line #####

--- SNIP ---

; PHP4 as CGI
cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode

--- END ---

####################################################

##### PHP 5 AS MODULE #####
http://php.net

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
# Old configure
#./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml  --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring
make
make install
mkdir -p /usr/local/etc/php5/
cp php.ini-dist /usr/local/etc/php5/php.ini

vi /usr/local/httpd/conf/httpd.conf

##### edit httpd.conf &amp; put the line: #####

--- SNIP ---

# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm

# PHP5 as module
AddType application/x-httpd-php .php .php5 .php3 .phtml
AddType application/x-httpd-php-source .phps

--- END ---

ln -s /usr/local/php5/bin/* /usr/bin
ln -s /usr/local/php5/lib/* /usr/lib
ln -s /usr/local/php5/include/* /usr/include

####################################################

##### PHP XML RPC #####
http://phpxmlrpc.sourceforge.net/

cd  xmlrpc-version
vi Makefile

--- SNIP ---

PHP=/usr/local/bin/php
PHPINCLUDEDIR=/usr/local/php5/lib

--- END ---

make install

Network Patch Cable – Straight

 

Network Patch Cable - Straight

 


Network Patch Cable – Crossover

 

Network Patch Cable - Crossover

Note: I did not create this image. I just found it on the web. I’m just sharing it.

Thank you.

<html>
<head>
<title>MD5 password generator</title>
</head>
<body>
<h2>MD5 password generator</h2>

<?php
import_request_variables('P');

if($pw)
{
        echo "The encrypted version of <b>$pw</b> is:<br>";
        echo "<br><tt>" . strtoupper(decrypt_md5($pw)) . "</tt>";
}
?>
<p>
<form name="pw" method="post">
Enter a password to encrypt:<br>
<input type="text" name="pw">
<br>
<input type="submit" value="Submit">
</form>
<p>
<a href="md5.php.txt">View the source of this page</a>

</body>
</html>

Note: I did not write this script. I just found it on the web. I’m just sharing the script. I used it once on my page.

Thank you.

*** Use this code anyway you want. Credit to Ash Young, author of the script. ***

<?php
if ($_SESSION[username] == 'unep' && $_SESSION[password] == 'biomass') {

########################################################
# Script Info
# ===========
# File: DirectoryListing.php
# Author: Ash Young (ash@evoluted.net
# Created: 20/12/03
# Modified: 27/09/04
# Website: http://evoluted.net/directorylisting.php
# Requirements: PHP
#
# Description
# ===========
# Displays all files contained within a directory in
# a well formed table, with category-image tags
#
# If you have any functions that you like to see
# implemented in this script then please just send
# an email to ash@evoluted.net
#
# Useage
# ======
#
# To change the colours display when using the script
# scroll down to set up section
#
# To use the script just upload to your server with
# the images and point your browser to the scripts
# filename
#
# SETUP
# =====
#
# Change the following variables to display what colours
# the script outputs
########################################################

DEFINE("IMAGEROOT", "../images2/"); #CHANGE /images/ TO THE PATH OF THE ASSOCIATED IMAGES

$textcolor = "#FFFFFF"; #TEXT COLOUR
$bgcolor = "#eeeeee"; #PAGE BACKGROUND COLOUR

$normalcolor = "#0066FF"; #TABLE ROW BACKGROUND COLOUR
$highlightcolor = "#006699"; #TABLE ROW BACKGROUND COLOUR WHEN HIGHLIGHTED
$headercolor = "#FF9900"; #TABLE HEADER BACKGROUND COLOUR
$bordercolor = "#202750"; #TABLE BORDER COLOUR

?>
<html>
<head>
<title>Directory Listings of <? echo $_SERVER["REQUEST_URI"]; ?> </title>
<style type='text/css'>
<!--
body { color: <? echo $textcolor; ?>; font: tahoma, small verdana,arial,helvetica,sans-serif; background-color: <? echo $bgcolor; ?>; }
table { font-family: tahoma, Verdana, Geneva, sans-serif; font-size: 9pt; border: 1px; border-style: solid; border-color: <? echo $bordercolor; ?>; }
.row { background-color: <? echo $normalcolor; ?>; border: 0px;}
a:link { color: <? echo $textcolor; ?>; text-decoration: none; }
a:visited { color: <? echo $textcolor; ?>; text-decoration: none; }
a:hover, a:active { color: <? echo $textcolor; ?>; text-decoration: none; }
img {border: 0;}
#bottomborder {border: <? echo $bordercolor;?>;border-style: solid;border-top-width: 0px;border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px}
.copy { text-align: center; color: <? echo $textcolor; ?>; font-family: tahoma, Verdana, Geneva, sans-serif; font-size: 9pt; text-decoration: underline; }
//-->
</style>
</head>
<body>
<?php
clearstatcache();
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.php" && $file != "list.php" && $file != "index2.php" && $file != ".htaccess" && $file != ".index.php.swp" && $file != ".list.php.swp" && $file != substr($PHP_SELF, -(strlen($PHP_SELF) - strrpos($PHP_SELF, "/") - 1))) {

if (filetype($file) == "dir") {
//SET THE KEY ENABLING US TO SORT
$n++;
if($_REQUEST['sort']=="date") {
$key = filemtime($file) . ".$n";
}
else {
$key = $n;
}
$dirs[$key] = $file . "/";
}
else {
//SET THE KEY ENABLING US TO SORT
$n++;
if($_REQUEST['sort']=="date") {
$key = filemtime($file) . ".$n";
}
elseif($_REQUEST['sort']=="size") {
$key = filesize($file) . ".$n";
}
else {
$key = $n;
}
$files[$key] = $file;
}
}
}
closedir($handle);
}

#USE THE CORRECT ALGORITHM AND SORT OUR ARRAY
if($_REQUEST['sort']=="date") {
@ksort($dirs, SORT_NUMERIC);
@ksort($files, SORT_NUMERIC);
}
elseif($_REQUEST['sort']=="size") {
@natcasesort($dirs);
@ksort($files, SORT_NUMERIC);
}
else {
@natcasesort($dirs);
@natcasesort($files);
}

#ORDER ACCORDING TO ASCENDING OR DESCENDING AS REQUESTED
if($_REQUEST['order']=="desc" && $_REQUEST['sort']!="size") {$dirs = @array_reverse($dirs);}
if($_REQUEST['order']=="desc") {$files = @array_reverse($files);}
$dirs = @array_values($dirs); $files = @array_values($files);

echo "<table width=\"550\" border=\"0\" cellspacing=\"0\" align=\"center\"><tr bgcolor=\"$headercolor\"><td colspan=\"2\" id=\"bottomborder\">";
if($_REQUEST['sort']!="name") {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=name&order=asc\">";
}
else {
if($_REQUEST['order']=="desc") {#
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=name&order=asc\">";
}
else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=name&order=desc\">";
}
}
echo "File</td><td id=\"bottomborder\" width=\"50\"></a>";
if($_REQUEST['sort']!="size") {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=size&order=asc\">";
}
else {
if($_REQUEST['order']=="desc") {#
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=size&order=asc\">";
}
else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=size&order=desc\">";
}
}
echo "Size</td><td id=\"bottomborder\" width=\"120\" nowrap></a>";
if($_REQUEST['sort']!="date") {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=date&order=asc\">";
}
else {
if($_REQUEST['order']=="desc") {#
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=date&order=asc\">";
}
else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?sort=date&order=desc\">";
}
}
echo "Date Modified</a></td></tr>";

$arsize = sizeof($dirs);
for($i=0;$i<$arsize;$i++) {
echo "\t<tr class=\"row\" onMouseOver=\"this.style.backgroundColor='$highlightcolor'; this.style.cursor='hand';\" onMouseOut=\"this.style.backgroundColor='$normalcolor';\" onClick=\"window.location.href='" . $dirs[$i] . "';\">";
echo "\t\t<td width=\"16\"><img src=\"" . IMAGEROOT . "folder.gif\" width=\"16\" height=\"16\" alt=\"Directory\"></td>";
echo "\t\t<td><a href=\"" . $dirs[$i] . "\">" . $dirs[$i] . "</a></td>";
echo "\t\t<td width=\"50\" align=\"left\">-</td>";
echo "\t\t<td width=\"120\" align=\"left\" nowrap>" . date ("M d Y h:i:s A", filemtime($dirs[$i])) . "</td>";
echo "\t</tr>";
}

$arsize = sizeof($files);
for($i=0;$i<$arsize;$i++) {
switch (substr($files[$i], -3)) {
case "jpg":
$img = "jpg.gif";
break;
case "gif":
$img = "gif.gif";
break;
case "zip":
$img = "zip.gif";
break;
case "png":
$img = "png.gif";
break;
case "avi":
$img = "move.gif";
break;
case "mpg":
$img = "move.gif";
break;
case "pdf":
$img = "acrobat.gif";
break;
case "doc":
$img = "doc.gif";
break;
case "xls":
$img = "xls.gif";
break;
case "ppt":
$img = "ppt.gif";
break;
default:
$img = "what.gif";
break;
}

echo "\t<tr class=\"row\" onMouseOver=\"this.style.backgroundColor='$highlightcolor'; this.style.cursor='hand';\" onMouseOut=\"this.style.backgroundColor='$normalcolor';\" onClick=\"window.location.href='" . $files[$i] . "';\">\r\n";
echo "\t\t<td width=\"16\"><img src=\"" . IMAGEROOT . "$img\" width=\"16\" height=\"16\" alt=\"Directory\"></td>\r\n";
echo "\t\t<td><a href=\"" . $files[$i] . "\" target=\"blank\">" . $files[$i] . "</a></td>\r\n";
echo "\t\t<td width=\"60\" align=\"left\">" . round(filesize($files[$i])/1024) . "KB</td>\r\n";
echo "\t\t<td width=\"160\" align=\"left\" nowrap>" . date ("M d Y h:i:s A", filemtime($files[$i])) . "</td>\r\n";
echo "\t</tr>\r\n";
}
echo "</table>";

} else {
echo "You must be logged in to access this page.";
echo "<br><br>Click <a href=index.php>here</a> to log in.";
unset($_SESSION[username]);
unset($_SESSION[password]);
// session_destroy();
}
?>
</body>
</html>
<?php
echo gmdate('F j, Y', time()). " - ";

print date("h:i",time()-date). " PHT";
?>

« Previous PageNext Page »