#!/usr/bin/perl my $r = Apache->request; print "HTTP/1.1 200 OK Server: Apache/1.3b3 mod_perl/1.08 "; use DBI; use strict 'vars'; require 'ctime.pl'; use slashmod; my ($imagedir)=slashmod::config(); my $dbh; sub main { $dbh=slashmod::dbconnect(); my (@content, @pairs, %FORM, %COOKIES); %FORM=slashmod::getform(); %COOKIES=slashmod::getcookies(); my ($thisuser,$email,$url)=slashmod::getuserinfo($COOKIES{userinfo}); if(defined $FORM{cookie}) { slashmod::setuserinfo($FORM{from}, $FORM{email},$url); } print "Content-Type: text/html\n\n"; print " Slashdot Submission"; slashmod::header("Slashdot Submissions",647); slashmod::titlebar("99%","Slashdot Submissions","c"); if(not defined $FORM{story}) { print "

Got a juicy nugget for the rest of the Slashdot Population? Fill out this form and it'll get whisked away to a secret hiding place where our trained squirrels will frown at it, poke at it, and hopefully post it.

If you have an editorial, an idea for an editorial, a bug with Slashdot, a question about slashdot, or anything besides a simple story, I would prefer it if you mail me. The opposite is true to- please use this form if you have a story. Resist the temptation to email me directly with Slashdot Stories! This form organizes things intelligently and makes my life much easier, please use it!

Your Name

Your Email or Homepage

(Leave either blank if you want to be anonymous)

Subject

Please select the closest topic:

The Scoop (Don't forget to include a URL!)

"; if(length $thisuser < 1) { print "Save Cookie with your name.
"; } print "

"; } else { if(length $FORM{subj} < 2) { print "Please enter a reasonable subject."; } else { print "Perhaps you would like to enter an email address or a URL next time.
" unless length $FORM{email} > 2; print "This story has been submittedly anonymously
" unless length $FORM{from} > 2; print "Thanks for this submission. "; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $mon++; my $subid="$hour$min$sec.$mon$mday$year"; $FORM{story}=~s/'/''/g; $FORM{subj}=~s/'/''/g; $dbh->do("INSERT into submissions (email,name,story,time,subid,subj,tid) VALUES('$FORM{email}','$FORM{from}', '$FORM{story}', NOW(),'$subid','$FORM{subj}','$FORM{tid}')"); } } slashmod::footer(); } sub rmstory { my ($aid, $sid) =@_; $dbh->do("DELETE from stories WHERE ('$aid'=aid OR '$aid'='CmdrTaco') AND '$sid'=sid"); print "Deleted Article"; } sub listtopics { my ($tid,$image, $alttext, $width, $height)=""; my $cursor=$dbh->prepare("SELECT tid,image,alttext,width,height FROM topics ORDER BY tid"); my $x=0; $cursor->execute; print ""; while(($tid,$image,$alttext,$width,$height)=$cursor->fetchrow) { if($x % 5 == 0) { print ""; } print ""; } print "
\"$alttext\"
$tid
"; } sub editstory { my ($author, $sid) = @_; my $cursor; my ($title,$dept,$aid,$tid,$introtext,$bodytext,$time)=""; print"

"; if(defined $sid) { $cursor=$dbh->prepare("SELECT title,aid, dept,tid, introtext, bodytext,time FROM stories WHERE sid='$sid'"); $cursor->execute; ($title,$aid,$dept,$tid,$introtext,$bodytext,$time) =$cursor->fetchrow; print "Article Created on $time"; print " "; print "Delete
"; } else { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $mon++; $sid="$hour$min$sec:$mon$mday$year"; $tid="news"; print " "; } print " title
dept

Intro Copy

Extended Copy

"; } sub liststories { my ($author) = @_[0]; my ($cursor,$sid,$aid,$title)=""; my $x=0; if($author eq "CmdrTaco" or $author eq "Hemos") { $cursor=$dbh->prepare("select sid, title, aid FROM stories ORDER BY time"); } else { $cursor=$dbh->prepare("SELECT sid, title, aid FROM stories WHERE '$author'=aid ORDER BY time"); } $cursor->execute; while(($sid,$title,$aid)=$cursor->fetchrow) { $x++; if($x < 20) { print "$title by $aid
"; } } } sub listarticles { my $cursor = $dbh->prepare( " select qid, question from pollquestions "); $cursor->execute; my ($question, $qid); slashmod::titlebar("99%","Slashdot Polls","c"); while (($qid, $question) = $cursor->fetchrow) { print "
$question"; } $cursor->finish; } main; $dbh->disconnect(); 0;