#!/usr/bin/perl
###########################################################################
# #
# This script inspired by News ver 1.1b Written by Julian Figueroa #
# 1997 - 1998 #
# http://www.gamegirlz.com/theory #
# #
###########################################################################
# COPYRIGHT NOTICE #
# Copyright 1998-1999 Richard Tirtadji All Rights Reserved. #
# #
# News_updater may be used and modified free of charge by anyone so long #
# as this copyright notice and the comments above remain intact. By #
# using this code you agree to indemnify Richard from any #
# liability that might arise from it's use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try #
# and make money off of the program. #
# #
# Obtain permission before redistributing this software over the Internet #
# or in any other medium. In all cases copyright and header must remain #
# intact. #
###########################################################################
# #
# KKK KKK RRRRRRR #
# KKK KKK RRRRRRRR Programmer : Richard Tirtadji #
# KKK KKK RRR RRR Date : 03/06/99 #
# KKKKK RRR RRR Version : 1.03 #
# KKKKK RRRRRRR Title : newsupdater.cgi #
# KKK KKK RRR RRR #
# KKK KKK RRR RRR #
# KKK KKK RRR RRR #
# #
# Mail:webmaster@kingrichard.hypermart.net #
# http://www.krdesigns.com #
# King Richard Designs Scripts #
###########################################################################
# NOTE: You may need to provide full path to each setup files
# Some server require this.
# $path is the directory path to the location of this file.
###########################################################################
$path = "/home/sites/www.scmillenium.com/users/atw/web/cgi-bin/news";
#>>>>>>>>>>>>>>> NO NEED TO EDIT ANYTHING BELOW THIS LINE <<<<<<<<
require "$path/setup.pl";
require "$path/kr.pl";
$AUTOLINK_FILE = "$datadir/autolink.txt";
$v1="1";
$v2="0";
$v3="3";
$host = $ENV{'HTTP_REFERER'};
$cgiurl = "/cgi-bin/news/newsupdater.cgi";
print "Content-type: text/html\n\n";
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;
if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
else { $INPUT{$name} = $value; }
}
if ($INPUT{'login'}) { &login; }
elsif ($INPUT{'preview'}) { &preview; }
elsif ($INPUT{'news'}) { &referer_check; }
elsif ($INPUT{'editing'}) { &referer_check; }
elsif ($INPUT{'fixed_page'}) { &referer_check; }
elsif ($INPUT{'deleting'}) { &referer_check; }
elsif ($INPUT{'newpass'}) { &newpass; }
else { &printoptions; }
exit;
sub referer_check {
#foreach $referer (@referers) {
# if ($host =~ /^$referer/i) { &start; }
#else { &error("Please use the proper form"); }
&start;
#}
}
sub preview {
&checkpassword;
print <News Updater - King Richard Scripts
News Administrative
This is just a preview. Should you see any error please go back and edit your post. Remember you could also edit it later using the News Manager
\n\n";
}
}
sub AUTO_LINK {
@AUTOLINK_DATA = &FILE_READ(AUTOLINK, $AUTOLINK_FILE);
$AUTOLINK_TEMP = join(/\n/, @AUTOLINK_DATA);
@AUTOLINK_INFO = split(/::/,$AUTOLINK_TEMP);
$COUNT = 0;
$STORY_DATA = join(/\n/, $INPUT{'story'});
while ($COUNT < @AUTOLINK_INFO) {
$PATTERN = $AUTOLINK_INFO[$COUNT + 1];
$MATCH = $AUTOLINK_INFO[$COUNT];
$MATCH =~ s/_//g;
$REPLACE = "$MATCH";
$STORY_DATA =~ s/$AUTOLINK_INFO[$COUNT]/$REPLACE/g;
$COUNT = $COUNT + 2;
}
$INPUT{'story'} = $STORY_DATA;
close(AUTOLINK_FILE);
}
sub checkcomplete {
unless ($INPUT{'subject'}) { &error("You must enter a title before the news can be posted"); }
unless ($INPUT{'story'}) { &error("You forgot to enter a story?"); }
if ($INPUT{'source'}) {
unless ($INPUT{'name_source'}) { &error("You selected a source but forget to enter a site name"); }
unless ($INPUT{'url_source'}=~/\http:/) { &error("You selected a source but forget to enter an url site"); }
}
}
sub printoptions {
open (PASSWORD, "$cgidir/password.txt");
$password = ;
close (PASSWORD);
chop ($password) if ($password =~ /\n$/);
if (!$password) {
&InitializePassword;
}
&Top;
&Mainmenu;
&Bottom;
exit;
}
sub InitializePassword {
&Top;
print "
";
print "
Before you can do anything else, ";
print "you'll need to set your administrative password. ";
print "This will allow you to use the administrative functions, ";
print "";
print "Please enter your desired password below. ";
print "(Enter it twice.)\n";
print "
\n";
print "
\n";
&Bottom;
exit;
}
sub newpass {
unless ($INPUT{'password'} eq $INPUT{'passad2'}) {
&error("Your administrative password was not set, as the two entries were different!");
exit;
}
&Top;
$newpassword = crypt($INPUT{'passad2'}, aa);
open (PASSWORD, ">$cgidir/password.txt") || &error("Can not write to $cgidir/password.txt");
print PASSWORD "$newpassword";
close (PASSWORD);
print" Admin Password has set Login Now! ";
&Bottom;
exit;
}
sub checkpassword {
$log = $INPUT{'password'};
open (PASSWORD, "$cgidir/password.txt");
$password = ;
close (PASSWORD);
chop ($password) if ($password =~ /\n$/);
if ($INPUT{'password'}) {
$new = crypt($INPUT{'password'}, aa);
}
else {
&error("You must enter a password");
}
unless (($password eq $new) || ($new eq $pair)) {
&error ("The password you entered is incorrect!");
}
}
sub Mainmenu {
print <
Enter Password:
Your Version
Latest Version
.
.
EOF
}
sub login {
&checkpassword;
&Top;
&scr_top;
print <
To update news, type in the subject, select your nickname and type in the news and press submit. If you have problem regarding this script, contact $webmaster_name.