Scav
04-14-2001, 02:49 PM
CGI/PERL:
open(FILE, "data/newsdata.cgi");
@newsdata = <FILE>;
close(FILE);
($postnum, $trash, $trash, $trash, $trash, $trash, $trash) = split(/|/, $newsdata[0]);
$postnum = "$postnum" + "1";
unshift(@newsdata, "$postnum|$title|$fullname|$email|$time|$date|$news");
open(FILE, ">data/newsdata.cgi");
flock(FILE, 2);
foreach $message (@newsdata) {
chomp $message;
print FILE "$message\n";
}
close(FILE);
the file i am having it open looks like this:
10|122222|Kevin Ulin|6944@home.com|1:50:39 am|04/10/01|2222
9|asdaaa|Kevin Ulin|6944@home.com|1:50:10 am|04/10/01|aaaaa
8|hmmm|Kevin Ulin|6944@home.com|1:47:59 am|04/10/01|adsf ohhhh ysa
7|test|Kevin Ulin|6944@home.com|1:46:20 am|04/10/01|test
6|123|Kevin Ulin|6944@home.com|1:46:03 am|04/10/01|123
5|asdf|Kevin Ulin|6944@home.com|1:42:51 am|04/10/01|asdf
4|asdf|fullname|email|1:41:36 am|04/10/01|asdf
3|a mere test|fullname|email|1:39:30 am|04/10/01|woohoo<br>
2|Just A Test|Kevin Ulin|6944@home.com|5:46 pm|4/8/01|This is a news post using cgi.
1|Second Test|Kevin Ulin|6944@home.com|5:46 pm|4/8/01|This is a news post using cgi.
the problem is the next line it makes is not 11, it is 2, help me!
open(FILE, "data/newsdata.cgi");
@newsdata = <FILE>;
close(FILE);
($postnum, $trash, $trash, $trash, $trash, $trash, $trash) = split(/|/, $newsdata[0]);
$postnum = "$postnum" + "1";
unshift(@newsdata, "$postnum|$title|$fullname|$email|$time|$date|$news");
open(FILE, ">data/newsdata.cgi");
flock(FILE, 2);
foreach $message (@newsdata) {
chomp $message;
print FILE "$message\n";
}
close(FILE);
the file i am having it open looks like this:
10|122222|Kevin Ulin|6944@home.com|1:50:39 am|04/10/01|2222
9|asdaaa|Kevin Ulin|6944@home.com|1:50:10 am|04/10/01|aaaaa
8|hmmm|Kevin Ulin|6944@home.com|1:47:59 am|04/10/01|adsf ohhhh ysa
7|test|Kevin Ulin|6944@home.com|1:46:20 am|04/10/01|test
6|123|Kevin Ulin|6944@home.com|1:46:03 am|04/10/01|123
5|asdf|Kevin Ulin|6944@home.com|1:42:51 am|04/10/01|asdf
4|asdf|fullname|email|1:41:36 am|04/10/01|asdf
3|a mere test|fullname|email|1:39:30 am|04/10/01|woohoo<br>
2|Just A Test|Kevin Ulin|6944@home.com|5:46 pm|4/8/01|This is a news post using cgi.
1|Second Test|Kevin Ulin|6944@home.com|5:46 pm|4/8/01|This is a news post using cgi.
the problem is the next line it makes is not 11, it is 2, help me!