#!/usr/bin/perl print "Content-type: text/html\n"; require '../cookie.lib'; if(&GetCookies('user')){ $uuser=$Cookies{'user'}; } if(&GetCookies('pass')){ $password=$Cookies{'pass'}; } if ($uuser eq "" or $password eq "") { print "Location: checkuser.cgi\n\n"; } print "\n"; open(GUEST,"./header.htm"); @title=; close(GUEST); print "@title"; use CGI; $cgi=new CGI; $post=$cgi->param("post"); @fields=('cat','title','author','form_data','content','num'); foreach $fields(@fields) { $$fields=$cgi->param("$fields"); $$fields=~ s/\|//g; } $content=~ s/\n/
/g; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); $year=$year+1900; $month=$mon+1; $day=$mday; $month=sprintf("%02d",$month); $day=sprintf("%02d",$day); $hour=sprintf("%02d",$hour); $min=sprintf("%02d",$min); $sec=sprintf("%02d",$sec); $dateinput=$year.$month.$day.$hour.$min.$sec; $y=substr($date,0,4); $m=substr($date,4,2); $d=substr($date,6,2); $h=substr($date,8,2); $m=substr($date,10,2); $s=substr($date,12,2); if($post) { if (!$title||!$cat){ print "
你填写的表单有错误
"; print "

Click the 返回

"; } else { $filename=$form_data; $filename=~ s/^.*(\\|\/)//; if($filename ne "") { open(DATA,">../image/$dateinput.jpg"); read($form_data,$buffer,1024*500); print DATA "$buffer"; close(DATA); } $form_data=$dateinput; open (DATABASE, ">>../data.txt"); foreach $fields (@fields){ push (@row, "$$fields"); } $new_row = join ("\|", @row); print DATABASE "$new_row"."\|\n"; close (DATABASE); print "
新闻信息以输入

"; print "
"; print "点击 这里 查看你发布的新闻信息"; print "
"; } print "

 

"; print "

 

"; print "
"; print "
"; print ""; } else { $num=$year.$month; $select_typ=&selectindex("../typ",$cat); print <<"POST";


 新闻管理>新闻发布

 
类 别:*   标 题:*
作 者:*   图 片:
期刊号:* 格式:200101(2001年1期)
内 容:  

                                     

POST } open(GUEST,"./footer.htm"); @title=; close(GUEST); print "@title"; sub selectindex { local($select_name,$selected)=@_; open(SE,"$select_name.txt"); @sel=; close(SE); undef $result; foreach $info (@sel) { chop($info); if($info eq $selected) { $result.="\n";} else { $result.="\n";} } return $result; }