#!/usr/bin/perl # Welcome to the www.dtp-aus.com VizBook scripts. VERSION 2.2 Sep 2001 # # IMPORTANT INFORMATION THAT MUST BE READ IF YOU WISH TO USE THESE SCRIPTS # ############################################################################## # Scripts VIZBOOK.CGI, VIZADMIN.CGI, TESTBIN.CGI, MAKEDIR.CGI, PICLOAD.CGI, # # and VIZADMDEL.CGI were written (c) by Ron F Woolley, Melbourne Australia. # # Copyright 1999,2000. These scripts CANNOT BE ALTERED for personal site use # # OR commercial site use except as instructed here in, NOR can whole or # # portions of code be copied, AND, # # all of the header notices in the scripts MUST REMAIN intact as is, AND, # # using the scripts without first reading the README file(s), is prohibited. # # IF YOU DO NOT AGREE, destroy all files NOW! # # This code MUST NOT be sold, hired, or given/made available to others. # # Changing output English words to another language is permitted except for # # program name and copyright notices! # # Australian copyright is recognised/supported in over 130 countries... # # per the Berne Convention and other treaties ( including USA! ) # # # # The scripts and associated files remain the property of Ron F Woolley. # # NO PROFIT what so ever is to be gained from users of these scripts for # # the use of these scripts, except that a reasonable minimal charge for # # installation may be allowed if installing, as a site developer, for a # # user on the users site that is not on the developers site. This program # # must NOT be used for multiple VizBook users on one site OR offered as a # # remote service. # # # # Ron Woolley, the author, MUST be notified via the addresses/URLs below # # if any gain is to be made from the installation of these scripts. # # # # You MUST RETAIN the small identifying text line at the base of each page # # IF YOU DISAGREE, you must immediately destroy all files. # ############################################################################## # NOTE: If you use these files, you do so entirely at your own risk, and # # take on full responsibility for the consequences of using the described # # files. You must first agree that Ron Woolley / HostingNet, the ONLY # # permitted suppliers of this or accompanying files are exempt from any # # responsibility for all or any resulting problems, losses or costs caused # # by your using these or any associated files. # # IF YOU DISAGREE, you must immediately destroy all files. # ############################################################################## # These program scripts are free to use, but if you use them, a donation of # # of A$25.00 would be appreciated and help in continuing support for VizBook # # and the creation of other scripts for users of the internet. # # Secure On-Line payments can be made for support donations or installations # ############################################################################## # Support Information is available at: # # http://www.dtp-aus.com/cgiscript/scrpthlp.htm # # Files from: # # http://www.dtp-aus.com/cgiscript/vizbook.shtml # # # # THESE FILES can only be obtained via the above web addresses, and MUST # # NOT BE PASSED ON TO OTHERS in any form by any means what so ever. # # This does not contradict any other statements above. # ############################################################################## # TO KEEP IT FREE, WE NEED your support on link and resource listing sites! # #--- Alter these two paths only (TWICE), if needed! ------------# if (-s "sets/gmtset.pl") {require "sets/gmtset.pl";} else {print "Content-type: text/html\n\n"; print "Missing/Bad Path to GMTime file\n"; exit;} if (-s "sets/vizbkset.pl") {require "sets/vizbkset.pl";} else {print "Content-type: text/html\n\n"; print "Missing/Bad Path to Config file\n"; exit;} #--- Do Not make any programing code changes below this line. --# sub readem { local $insFile = shift; local $back = ""; if (open(FL, "<$insFile")) { while () {$back .= $_;} close(FL); } else {&showErr('Fatal File Read Error');} return $back; } sub check_method { if ( $ENV{'REQUEST_METHOD'} eq 'GET' ) { $query_string = $ENV{'QUERY_STRING'}; } elsif ( $ENV{'REQUEST_METHOD'} eq 'POST' ) { read(STDIN,$query_string,$ENV{'CONTENT_LENGTH'}); } else { &showErr('Request Method'); } } sub check_ref { $crf = 0; if ($ENV{'HTTP_REFERER'}) { foreach $referer (@referers) { if ($ENV{'HTTP_REFERER'} =~ m|\Ahttps?://$referer|i) { $crf = 1; last; } } } if ($crf eq 0) {&showErr('Bad Referrer off-site access denied!
Use only links and forms ON this site');} } sub read_rcrds { open(RF,"<$BinSub_pth$records") || &showErr('Records-File Read Access'); eval" flock(RF,2)"; @vizrcrds = ; eval" flock(RF,8)"; close(RF); } sub read_mods { if ( -s "$modfiles/onhold.db") { open(MF,"<$modfiles/onhold.db") || &showErr('OnHold-File Read Access'); eval "flock(MF,2)"; @holdrcrds = ; eval "flock(MF,8)"; close(RF); } } sub admn_pwrd { if (!( -e "$BinSub_pth$adminword")) {open(FF,">>$adminword") || &showErr('Missing ADMIN Password File'); print FF "Do NOT Edit\n"; close(FF);} open(ADMwrd, "<$BinSub_pth$adminword") || &showErr('ADMIN Password File Access'); eval" flock (ADMwrd, 2)"; @theAword = ; eval" flock (ADMwrd, 8)"; close(ADMwrd); if ($theAword[1] || $FORM{'admnpwd'}) { if (crypt($FORM{'admnpwd'},"sf") ne $theAword[1]) {&showErr('Incorrect ADMIN Password');} } } sub get_pics { opendir(DIR,"$admn_picspath") || &showErr('Error Accessing Pics Directory'); @files = sort(readdir(DIR)); closedir(DIR); for($s1 = @files; $s1 >= 0; $s1--) { if ($files[$s1] !~ /^\d+(.gif|.jpg)/i) { push(@files2,$files[$s1]) if $files[$s1] =~ /(.gif|.jpg)/i && $files[$s1] !~ /^admn.*/i; splice(@files,$s1,1); } } @files2 = sort(@files2); } sub ucase { local($s1) = @_; $s1 =~ tr/[a-z]/[A-Z}/; return $s1; } sub chk_addr { local($chk) = $_[0]; if ($chk =~ /(.*@.*\.[a-zA-Z]{2,6}$)/ && $chk !~ /(^\.)|(\.$)|( )|(\.\.)|(@\.)|(\.@)|(@.*@)/) { return(1); } else { return(0); } } sub date_time { my($s1) = @_; my($mon,$year); ($mon,$year) = (gmtime($s1))[4,5]; $mon++; if ($year < 39) { $year = "20$year" } elsif ($year > 99 && $year < 2000) { $year = 2000 + ( $year - 100 ) } elsif ($year > 38) { $year = "19$year" } return ($mon,$year); } sub date_time_real { my $intime = shift; my $datereal; my($min,$hour,$mday,$mon,$year); ($min,$hour,$mday,$mon,$year) = (gmtime($intime))[1,2,3,4,5]; $mon++; if ($year < 39) { $year = "20$year" } elsif ($year > 99 && $year < 2000) { $year = 2000 + ( $year - 100 ) } elsif ($year > 38) { $year = "19$year" } if ($dtUS eq "1") {$datereal = sprintf("%02d\/%02d\/%04d-%02d:%02d",$mon,$mday,$year,$hour,$min);} elsif ($dtUS eq "2") {$datereal = sprintf("%04d\/%02d\/%02d-%02d:%02d",$year,$mon,$mday,$hour,$min);} else {$datereal = sprintf("%02d\/%02d\/%04d-%02d:%02d",$mday,$mon,$year,$hour,$min);} return $datereal; } sub shw_img { print "Content-type: text/html\n\n"; print qq~Image Preview

 

$image Image Preview
VizBook size100%
\n

 

~; exit; } sub showErr { local $errr = shift; local $hoW = shift; if ($hoW) {$hoW = "Close This Window";} else {$hoW = "Use your Back Arrow";} print "Content-type: text/html\n\n"; print qq~Error Response

 

'VizBook' Error Response
 The program has responded with an error 
 The result is:
$errr

VizBook v2.2 copyright

$hoW to return. Thank you.
~; exit; } sub whatWrd {print "Content-type: text/html\n\n"; print qq~Access Form
 
 ? Access Password ? 
VizBook v2.2
~; exit;} sub noErr { print "Content-type: text/html\n\n"; print qq~Edit Complete
 
'VizBook' Edit Response
The program reports success
 Response:
$_[0]
 Return to and REFRESH the List Defaults 
VizBook v2.2 copyright
~; exit; } &check_method; &check_ref ; @pairs = split(/&/, $query_string); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $name =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/ ~!/g; $name =~ s/~!/ ~!/g; $value =~ s/<([^>]|\n)*>//g if $name ne "comtext" && $name ne "ONld" && $name ne "edstext" && $name ne "mtxt"; $name =~ s///g; $value =~ s///g; $value =~ s/("|')//g if $name ne "comtext" && $name ne "ONld" && $name ne "edstext" && $name ne "mtxt"; $value =~ s/(`|\0|\\[^\\n])//g; $name =~ s/(`|\0|\\)//g; $FORM{$name} = $value; } $REQuire{'viznam'} = $N; $REQuire{'email'} = $E; $noLabel = 0 if $allow_pics == 1; $tbl_wid = "590" if !$tbl_wid; $sze_3 = 2 if !$sze_3 || $sze_3 > 3; $defont = ""; @OBs = ("vizname","email","icq","cmpny","miscbox","dlist","url","city","state","cntry","msg"); %OBSlbl=("vizname"=>"$N","icq"=>"$IC","cmpny"=>"$CM","miscbox"=>"MiscBox","dlist"=>"DropList","url"=>"$U","city"=>"$CY","state"=>"$ST","cntry"=>"$CN","msg"=>"$C"); $OBSlbl{'miscbox'} = $miscbox_txt if $miscbox_txt; $OBSlbl{'dlist'} = $drpdwn_txt if $drpdwn_txt; $OBSlbl{'email'} = "$E"; &whatWrd if $FORM{'theword'} ne $theword; if ($FORM{'frmedit'}) {require $BinSub_pth.$save_def; &admn_pwrd; &set_defaults;} elsif ($FORM{'frmdelrec'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &delrecs;} elsif ($FORM{'frmadpic'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &instpic;} elsif ($FORM{'aped'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &new_pwrd;} elsif ($FORM{'gmed'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &new_gmt;} elsif ($FORM{'fle_ed'} && $FORM{'fEd_get'}) {require $BinSub_pth.$file_ed; &viewfle;} elsif ($FORM{'frmFleEd'} && $FORM{'edstext'}) {require $BinSub_pth.$file_ed; &admn_pwrd; &savefile;} elsif ($FORM{'makemail'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &do_elist;} elsif ($FORM{'rjed'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &rjcted;} elsif ($FORM{'edletta'}) {require $BinSub_pth.$edit_form; &admn_pwrd; &edlet;} elsif ($FORM{'frmrecs'}) {require $BinSub_pth.$edit_form; &photos;} elsif ($FORM{'frmedcom'} || $FORM{'frmedmod'}) {require $BinSub_pth.$edcom; &admn_pwrd; &edcoms;} elsif ($FORM{'frmsedcom'} && $FORM{'frmAct'} && $FORM{'actwhat'} eq "E") {require $BinSub_pth.$edcom; &admn_pwrd; &sedcoms;} elsif ($FORM{'frmsedcom'} && $FORM{'frmAct'}) {require $BinSub_pth.$edcom; &admn_pwrd; &sedact;} elsif ($FORM{'frmsedcom'}) {require $BinSub_pth.$edcom; &admn_pwrd; &sedcoms;} elsif ($FORM{'dbref'} eq "y") {require $BinSub_pth.$edit_form; &admn_pwrd; &dodb;} elsif ($FORM{'picSee'} eq "y" && $FORM{'picslist'} =~ /^\d{6,6}(.jpg|.gif)$/) {&shw_img;} else {require $BinSub_pth.$shw_def; &shw_samp;} exit(0);