Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
mrtgnav
Package: mrtg-2.13.2.zip [view]
Upload User: shbosideng
Upload Date: 2013-05-04
Package Size: 1555k
Code Size: 2k
Category:
SNMP
Development Platform:
C/C++
- #!/usr/bin/perl
- use strict;
- use URI;
- my $dirc = 'none';
- my $HtmlBase = "/usr/lib/apache/htdocs";
- my ($rq, $rf, $prevDir, $nextDir, $newLocation);
- my ($basedir, $subdir, $file, $TheDir, $host);
- my (@dirs, @pathsegs);
- $rq = URI->new($ENV{"REQUEST_URI"});
- $dirc = $rq->query;
- $rf = URI->new($ENV{"HTTP_REFERER"});
- $host = $rf->host;
- $subdir = $rf->path;
- @pathsegs = $rf->path_segments;
- $file = $pathsegs[-1];
- $subdir = $pathsegs[-2];
- $basedir = join('/', @pathsegs[0..$#pathsegs-2]);
- opendir(DIRHNDL, "$HtmlBase/$basedir");
- while($TheDir = readdir(DIRHNDL)) {
- if($TheDir =~ /^w/ && -d "$HtmlBase/$basedir/$TheDir") {
- push @dirs, $TheDir;
- }
- }
- @dirs = sort @dirs;
- for(my $i = 0; $i <= $#dirs; $i++) {
- if ($dirs[$i] eq $subdir) {
- if($i > 0) { $prevDir = $dirs[$i - 1] }
- else { $prevDir = $subdir }
- if($i < $#dirs) { $nextDir = $dirs[$i + 1] }
- else { $nextDir = $subdir }
- last;
- }
- }
- if($dirc eq 'prev') {
- if(-f "$HtmlBase/$basedir/$prevDir/$file") {
- $newLocation = "http://$host$basedir/$prevDir/$file";
- } else {
- $newLocation = "http://$host$basedir/$subdir/$file";
- }
- } elsif ($dirc eq 'next') {
- if(-f "$HtmlBase/$basedir/$nextDir/$file") {
- $newLocation = "http://$host$basedir/$nextDir/$file";
- } else {
- $newLocation = "http://$host$basedir/$subdir/$file";
- }
- } elsif ($dirc eq 'index') {
- if($file eq 'index.html') {
- $newLocation = "http://$host$basedir/index.html";
- } else {
- $newLocation = "http://$host$basedir/$subdir/index.html";
- }
- } else {
- $newLocation = $ENV{"HTTP_REFERER"};
- }
- print "Location:$newLocationnn";