SpecOPS
09-02-2001, 02:59 PM
I am just now learning CGI and Perl. I have been struggling with this script for quite sometime, and was wondering if anyone that has more extensive knowledge of CGI or Perl would be kind enough to help me. All I am trying to do is make a simple little news script that will post news for me. I tried it and this is what I have come up with so far.
#!/usr/local/bin/perl
use strict;
my ($title, $body, $admin, $password, $setpass, $newsbase, @time, @days, @months);
$title=param('title');
$body=param('body');
$admin=param('admin');
$password=param('password');
#Set your password here!
$setpass="whatever you want";
@time=localtime;
@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
@months = qw(January February March April May June July August September October November December);
allow();
if ($setpass ne $password) {
print "Wrong Password!!";
} else {
open (NEWS, ">>big/dom/xsubzeronetwork/www/news.txt") || Error('open', 'file');
print NEWS "<table width='50%' align='center' bgcolor='#00002F' border='1'>
<tr>
<td align='left'><font size='4'; font color='yellow'>Posted by $admin at $time[2]:$time[1] on @days[$time[6]], @months[$time[4]] $time[3]</font></td>
</tr>
<tr>
<td align='center'><font size='4'; font color='white'>$title</font></td>
</tr>
<tr>
<td></br></td>
</tr>
<tr>
<td><font size='2'; font color='white'>$body</font></td>
</tr>
</table>";
close (NEWS);
}
sub allow {
print "Content-type: text/html\n\n";
}
sub Error {
print "Content-type: text/html\n\n";
print "The server can't $_[0] the $_[1]: $! \n";
exit;
}
I am also new to SSL and I was wondering how I would post this script into my main news page using SSL. Thanks in advance
#!/usr/local/bin/perl
use strict;
my ($title, $body, $admin, $password, $setpass, $newsbase, @time, @days, @months);
$title=param('title');
$body=param('body');
$admin=param('admin');
$password=param('password');
#Set your password here!
$setpass="whatever you want";
@time=localtime;
@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
@months = qw(January February March April May June July August September October November December);
allow();
if ($setpass ne $password) {
print "Wrong Password!!";
} else {
open (NEWS, ">>big/dom/xsubzeronetwork/www/news.txt") || Error('open', 'file');
print NEWS "<table width='50%' align='center' bgcolor='#00002F' border='1'>
<tr>
<td align='left'><font size='4'; font color='yellow'>Posted by $admin at $time[2]:$time[1] on @days[$time[6]], @months[$time[4]] $time[3]</font></td>
</tr>
<tr>
<td align='center'><font size='4'; font color='white'>$title</font></td>
</tr>
<tr>
<td></br></td>
</tr>
<tr>
<td><font size='2'; font color='white'>$body</font></td>
</tr>
</table>";
close (NEWS);
}
sub allow {
print "Content-type: text/html\n\n";
}
sub Error {
print "Content-type: text/html\n\n";
print "The server can't $_[0] the $_[1]: $! \n";
exit;
}
I am also new to SSL and I was wondering how I would post this script into my main news page using SSL. Thanks in advance