#!/usr/local/bin/perl ################################################################## # Advertisement Banner Rotator V2.0 # # This program is distributed as freeware. We are not # responsible for any damages that the program causes # to your system. It may be used and modified free of # charge, as long as the copyright notice # in the program that give me credit remain intact. # If you find any bugs in this program. It would be thankful # if you can report it to us at cgifactory@cgi-factory.com. # However, that email address above is only for bugs reporting. # We will not respond to the messages that are sent to that # address. If you have any trouble installing this program, # olease feel free to post a message on our CGI Support Forum. # Selling this script is absolutely forbidden and illegal. ################################################################## # # COPYRIGHT NOTICE: # # Copyright 1999-2000 CGI-Factory.com TM # A subsidiary of SiliconSoup.com LLC # # # Web site: http://www.cgi-factory.com # E-Mail: cgifactory@cgi-factory.com # # Advertisement Banner Rotator V2.0 is protected by the copyright # laws and international copyright treaties, as well as other # intellectual property laws and treaties. ################################################################### # Please, delete this script, after the setup prograss is completed! ####################### Nothing more need to be modified blow this line unless you feel like to do it require "cfg.cgi"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\n/ /g; $request{$name} = $value; } print "Content-type: text/html\n\n"; if ($request{'action'} eq "firsttime") { &firsttime; exit; } if ($request{'action'} eq "setup") { &setup; exit; } open (DETECT,"<$datalocation/pass.dat") || &setup; if ($flock eq "y") { flock DETECT, 2; } close (DETECT); print "The setup progress was completed already. Please delete this script (firsttime.pl\n)"; sub setup{ print "This is the first time you run this script\n"; print "Please set your admin password:\n"; print "
Password:
Enter the passward again:
"; exit; } sub firsttime { if ($request{'password1'} eq "" and !$request{'password1'}) { print "Please don't leave the password field blank!"; exit; } if ($request{'password2'} eq "" and !$request{'password2'}) { print "Please don't leave the password field blank!"; exit; } if ($request{'password1'} ne "$request{'password2'}" and $request{'password1'} != $request{'password2'}){ print "You entered two different passwords. Please try again!"; exit; } $request{'password1'}=~ tr/A-Z/a-z/; $password = crypt($request{'password1'}, "MM"); open (PASSWORD, ">$datalocation/pass.dat") || &error("unable to create the password file"); if ($flock eq "y") { flock PASSWORD, 2; } print PASSWORD "$password"; close (PASSWORD); open (COUNT, ">$datalocation/count.txt") || &error("unable to create the data file"); if ($flock eq "y") { flock COUNT, 2; } print COUNT "0"; close (COUNT); open (TCOUNT, ">$datalocation/tcount.txt") || &error("unable to create the data file"); if ($flock eq "y") { flock TCOUNT, 2; } print TCOUNT "0"; close (TCOUNT); print "Setup complete\n"; exit; } sub error{ $errors = $_[0] ; print "An error has occured, the error is $errors
\n"; print "$!\n"; exit; } exit;