#!/usr/bin/perl
use CGI qw(:standard) ;
############################################
## ##
## Schlabo's Scripts ##
## by Andreas Jakl ##
## (e-mail andreas@schlabo.com) ##
## ##
## version: 2.01a ##
## last modified: 17/02/02 ##
## copyright (c) 1999-2002 ##
## ##
## latest version is available from ##
## http://www.schlabo.com/ ##
## ##
############################################
# COPYRIGHT NOTICE:
#
# Copyright 1999-2001 Andreas Jakl. All Rights Reserved.
#
# This program is being distributed as freeware. It may be used and
# modified by anyone, as long as this copyright notice and the header
# above remain intact Selling the code for this program without prior
# written consent is expressly forbidden. Obtain permission before
# redistributing this program over the Internet or in any other medium.
# In all cases copyright and header must remain intact.
#
# This program is distributed "as is" and without warranty of any
# kind, either express or implied. (Some states do not allow the
# limitation or exclusion of liability for incidental or consequential
# damages, so this notice may not apply to you.) In no event shall
# the author of this script, Andreas Jakl, be liable for any damages or
# losses. You use this script on your own risk.
# If your server reports that it can't find or include the config-file
# or if you have problems getting the scripts to run, change the
# following variable to the absolute server-path of the Schlabo's Scripts-
# directory. Normally this is not necessary, but some servers don't look
# in the current directory when a file is included, so you have to specify
# it yourself. To make that easier you can use this variable instead of
# modifying each require-statement. Don't use a trailing slash ("/").
$require_path = substr($ENV{'SCRIPT_FILENAME'},0,rindex($ENV{'SCRIPT_FILENAME'},"/"));
# If you are using Microsoft IIS, set the following to 1. If you are
# using Unix/Apache, set it to 2. Setting it 0 tries to determine
# automatically, and usually works just fine; don't change it unless
# you have problems. If you use IIS yet have 500 error problems,
# try setting the variable to 2, then try 3.
# Thanks to NewsPro ( http://amphibian.gagames.com/newspro ) for this routine!
$IIS = 0;
# You don't have to modify anything below here.
if ($IIS != 2) {
if ($IIS == 0) {
if ($ENV{'SERVER_SOFTWARE'} =~ m!IIS!) {
$IIS = 1
}
}
if (($IIS) && ($0 =~ m!(.*)(\\|\/)!)) {
chdir($1);
}
if ($IIS == 1) {
print "HTTP/1.0 200 OK\n";
}
}
if ($require_path) {
push(@INC, $require_path);
}
require "config.pl";
require "common.pl";
$scriptname="admin";
umask (0111);
&check_referer;
&parse_query;
&get_date;
eval { &get_script_actions; };
if ($@) {
&showerror("An error occured: $@");
}
exit;
sub get_script_actions {
# Query and Form Actions
$dowhat=$QUERY{'action'};
if (($dowhat ne 'login') && ($dowhat ne '') && ($dowhat ne 'logout') && ($dowhat ne 'firsttime_user')) {
&get_password;
}
if ($dowhat eq 'login') { &showlogin; }
elsif ($dowhat eq 'logout') { &logout; }
elsif ($dowhat eq 'showadmin') { &showadmin; }
elsif ($dowhat eq 'conf_general') { &confgeneral; }
elsif ($dowhat eq 'submit_gen') { &submitgen; }
elsif ($dowhat eq 'conf_potd') { &confpotd; }
elsif ($dowhat eq 'submit_potd') { &submitpotd; }
elsif ($dowhat eq 'conf_dl') { &confdl; }
elsif ($dowhat eq 'submit_dl') { &submitdl; }
elsif ($dowhat eq 'conf_sp') { &confsp; }
elsif ($dowhat eq 'submit_sp') { &submitsp; }
elsif ($dowhat eq 'conf_cow') { &confcow; }
elsif ($dowhat eq 'submit_cow') { &submitcow; }
elsif ($dowhat eq 'updates') { &checkupdates; }
elsif ($dowhat eq 'viewiplog') { &viewiplog; }
elsif ($dowhat eq 'firsttime_user') { &firsttime_user; }
elsif ($dowhat eq '') {
if ($siteurl eq 'http://www.yoursite.com/') {
&firstrun;
} else {
&showlogin;
}
} else {
&novalidquery;
}
}
sub showadmin {
&html_header;
print "
Main
\n";
$curtimecode = &calculatetimecode($y,$m,$month_day);
if ($curtimecode > ($g_updatecheck + 30)) {
print qq|
IP-Tracking is not activated, therefore it is not possible to view the logs. Please activate it in the General Configuration first.
\n"; print "Press the Back-button of your browser or click here to get back to the previous page.
";
&html_footer;
return;
}
if (-e "$trackfile") {
open(ipfile,"<$trackfile");
@all_data = The IP-Tracking-file (\"$trackfile\") wasn't found. If you just activated IP-Tracking it might not have been created yet as it records logging in and out. \n";
print "Press the Back-button of your browser or click here to get back to the previous page. ";
&html_footer;
return;
}
print qq|
|;
if (($max_num > $viewlatest) && ($viewlatest ne "") && ($viewlatest ne "0")) {
print qq|
No IP-Tracking-file found
\n";
print "
IP-Tracking
Schlabo's Scripts can track whenever someone uses them. The logs below show the exact date, time and IP of the user who logged in/out. Resetting this log is only possible by deleting $trackfile per FTP (for security reasons), it can't be done from within the scripts.
Date | Time | IP | Host | Action | "; $td_close = " | \n"; if ($viewlatest == 0) { $countto=0; } else { $countto = $max_num-$viewlatest; if ($countto < 0) {$countto=0} } for ($count=($max_num-1);$count>=$countto;$count--) { if (($count % 2)==0) { print "
Logs empty.
\n"; } &html_footer; } sub confgeneral { &html_header; print qq|