HOME













Projects | Graphics | Midi/Wavs | Forums | Links | Staff | Tutorials





Pointrm2k.gif













































#################### # MAIN PROGRAM $| = 1; $Version = "1.06"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); &parse_form; &get_general_configuration; &get_individual_configuration; $command = $ENV{QUERY_STRING}; $referer = $ENV{HTTP_REFERER}; if (($command eq "admin") && ($referer =~ "$NewsScriptUrl")){ &check_passwd("$FORM{'name'}","$FORM{'password'}"); if ($flag == 1){ &admin; } else { $month = ($mon + 1); open(LOG, ">>$datadir/accessLog.txt"); print LOG "ACCESS DENIED : $month\/$mday\/$year at $hour:$min:$sec - tried from $ENV{'REMOTE_ADDR'}\n"; close(LOG); &error("The name and password are wrong. You must login before entering a restricted area."); } } elsif (($command eq "login") && ($referer =~ "$NewsScriptUrl")){ &login; } elsif (($command eq "add") && ($referer =~ "$NewsScriptUrl")){ if ($FORM{'addstory'}) { &addNews; } elsif ($FORM{'previewstory'}){ &previewNews; } } elsif (($command eq "edit") && ($referer =~ "$NewsScriptUrl")){ &editNews; } elsif (($command eq "editNews") && ($referer =~ "$NewsScriptUrl")){ &updateNews; } elsif ((($command eq "delete") || ($command eq "DELETE")) && ($referer =~ "$NewsScriptUrl")){ &deleteNews; } elsif (($command eq "deleteNews") && ($referer =~ "$NewsScriptUrl")){ &delNews; } elsif (($command eq "addAuthor") && ($referer =~ "$NewsScriptUrl")){ &addAuthor; } elsif (($command eq "editAuthor") && ($referer =~ "$NewsScriptUrl")){ &editAuthor; } elsif (($command eq "updateAuthor") && ($referer =~ "$NewsScriptUrl")){ &updateAuthor; } elsif (($command eq "deleteAuthor") && ($referer =~ "$NewsScriptUrl")){ &deleteAuthor; } elsif (($command eq "delAuthor") && ($referer =~ "$NewsScriptUrl")){ &delAuthor; } elsif (($command eq "addAutolink") && ($referer =~ "$NewsScriptUrl")){ &addAutolink; } elsif (($command eq "editAutolink") && ($referer =~ "$NewsScriptUrl")){ &editAutolink; } elsif (($command eq "updateAutolink") && ($referer =~ "$NewsScriptUrl")){ &updateAutolink; } elsif (($command eq "deleteAutolink") && ($referer =~ "$NewsScriptUrl")){ &deleteAutolink; } elsif (($command eq "delAutolink") && ($referer =~ "$NewsScriptUrl")){ &delAutolink; } elsif (($command eq "viewAutolinks") && ($referer =~ "$NewsScriptUrl")){ &viewAutolinks; } elsif (($command eq "createCategory") && ($referer =~ "$NewsScriptUrl")){ &create_category; } elsif (($command eq "setCategoryConf") && ($referer =~ "$NewsScriptUrl")){ &setup_category; } elsif (($command eq "editCategory") && ($referer =~ "$NewsScriptUrl")){ &editCategory; } elsif (($command eq "updateCategory") && ($referer =~ "$NewsScriptUrl")){ &updateCategory; } elsif (($command eq "deleteCategory") && ($referer =~ "$NewsScriptUrl")){ &deleteCategory; } elsif (($command eq "delCategory") && ($referer =~ "$NewsScriptUrl")){ &delCategory; } elsif (($command eq "setconfigure") && ($referer =~ "$NewsScriptUrl")){ &save_general_configuration; } elsif (("$FORM{'select'}" == "0") && ($referer =~ "$NewsScriptUrl")){ &admin; } elsif (("$FORM{'select'}" eq "1B") && ($referer =~ "$NewsScriptUrl")){ if(($cg_use_categories == 1) || ($FORM{'CategoryIdNum'})){ &viewAll; } else { &viewAllMenu; } } elsif (("$FORM{'select'}" eq "2A") && ($referer =~ "$NewsScriptUrl")){ &configure; } elsif (("$FORM{'select'}" eq "3A") && ($referer =~ "$NewsScriptUrl")){ &authorOptions; } elsif (("$FORM{'select'}" eq "4A") && ($referer =~ "$NewsScriptUrl")){ &autolinkOptions; } elsif (("$FORM{'select'}" eq "5A") && ($referer =~ "$NewsScriptUrl")){ &categoryOptions; } elsif (("$FORM{'select'}" eq "8B") && ($referer =~ "$NewsScriptUrl")){ &newsfileupdated; } elsif (("$FORM{'select'}" eq "2U") && ($referer =~ "$NewsScriptUrl")){ &addNewStory; } elsif (("$FORM{'select'}" eq "4U") && ($referer =~ "$NewsScriptUrl")){ &editInfo; } elsif (("$FORM{'select'}" eq "9B") && ($referer =~ "$NewsScriptUrl")){ &logout; } else { &login; } ##################### # FUNCTIONS sub login { &header; print "

\n"; print "\n"; print "\n"; print "
\n"; print "
Login

\n"; print "
\n"; print "

\n"; print "You must login before entering a restricted area\n"; print "

\n"; print "Name:
\n"; print "Password:
\n"; print "

\n"; print "\n"; print "

\n"; &footer; } ############### sub check_passwd { my $name = $_[0]; my $password = $_[1]; if ($name eq "admin"){ if($password eq "$admin_passwd" ) { $flag = 1; } } else { open(FILE,"$datadir/authors.file"); @data = ; close(FILE); foreach $line (@data) { chop($line); ($authora, $emaila, $passworda, $levela, $accessa) = split(/\|/,$line); if ($cg_encryption == 1){ $test_passwd = crypt($password, substr($passworda, 0, 2)); } else { $test_passwd = $password; } if (($name eq "$authora") && ($test_passwd eq "$passworda")){ $flag = 1; } } } } ################## sub admin { if(! -e "$datadir/NP.setup") { &configure; } else{ if ($FORM{'name'} eq "admin"){ &header; &menu("admin","$FORM{'password'}","- Select Option -"); print "

Administration

\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "
Recent Stories
\n"; print "
\n"; print "\n"; print "\n"; open(DIR,"$datadir/1\.news"); @data = ; close(DIR); $count = 0; foreach $line (@data) { $count++; if ($count <= $cg_oldmessages) { chop($line); ($date, $author, $email, $texttime, $subject, $byline, $id, $story) = split(/\|:\|/,$line); print "\n"; print "\n"; print "\n"; print "\n"; } } print "
Date
Story Title
Edit
Delete
Author
$date
$subject
$author

\n"; print "

\n"; &footer; } #################### # normal user else { open(FILE, "$datadir/authors.file"); @data = ; close(FILE); foreach $line (@data) { chop($line); ($name, $email, $password, $level, $access) = split(/\|/, $line); if ($FORM{'name'} eq "$name") { &header; &menu("$name","$FORM{'password'}","- Select Option -"); @access_a = split(/\,/, $access); print "

Author Administration

\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "
Recent Stories
\n"; print "
\n"; print "\n"; print "\n"; open(DIR,"$datadir/$access_a[0]\.news"); @data = ; close(DIR); $count = 1; foreach $line (@data) { if ($count <= $cg_oldmessages) { chop($line); ($date, $author, $email1, $texttime, $subject, $byline, $id, $story) = split(/\|:\|/,$line); if ($FORM{'name'} eq "$author"){ $count++; print "\n"; print "\n"; print "\n"; print "\n"; } } } print "
Date
Story Title
Edit
Delete
Author
$date
$subject
$author

\n"; print "

\n"; } } &footer; } } ######################## sub addNewStory { open(FILE, "$datadir/authors.file"); @data = ; close(FILE); foreach $line (@data) { chop($line); ($name, $email, $password, $level, $access) = split(/\|/, $line); if ($FORM{'name'} eq "$name") { &header; &menu("$name","$FORM{'password'}","Add New Story"); print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "
Add New Story
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; if($cg_use_categories == "2"){ @access_a = split(/\,/, $access); open(DIR,"$datadir/categories.file"); @cat_data = ; close(DIR); print "Category: \n"; print "

\n"; } else { print "\n"; } print "Subject:
\n"; if ($cg_useByline == 2){ print "Byline: \n"; } else { print "\n"; } print "

News Story: