Side.pl
上传用户:qdrechuli
上传日期:2022-08-01
资源大小:917k
文件大小:4k
- #!/usr/bin/perl
- use CGI;
- use GD;
- $h = new CGI;
- $CodeCR = $h->param('cr');
- sub existf
- {
- my $existf = 1;
- open(FEXIST,@_[0]) or $existf = 0;
- close(FEXIST);
- return $existf;
- }
- sub MakeGifItem
- {
- my $im = new GD::Image(150,14);
- my $white = $im->colorAllocate(255,255,255);
- my $orange = $im->colorAllocate(240,240,140);
- $im->transparent($white);
- $im->interlaced('true');
- $im->string(gdMediumBoldFont,0,0,@_[0],$orange);
- open(FGIFI,">".@_[1]);
- print FGIFI $im->gif;
- close(FGIFI);
- return 1;
- }
- sub MakeGifMenu
- {
- my $im = new GD::Image(150,21);
- my $white = $im->colorAllocate(255,255,255);
- my $black = $im->colorAllocate(0,0,0);
- my $orange = $im->colorAllocate(240,240,140);
- $im->filledRectangle(0,0,149,20,$black);
- $im->rectangle(0,0,149,20,$white);
- $im->string(gdLargeFont,5,2,@_[0],$orange);
- open(FGIFM,">".@_[1]);
- print FGIFM $im->gif;
- close(FGIFM);
- return 1;
- }
- sub MakeMenu
- {
- my $oldmenu = "";
- open(FMENU,"/opt/NetAdmin/Param/menu.".$CodeCR);
- while (<FMENU>)
- {
- (my $ligne,my $reste) = split(/n/);
- if ($ligne ne "")
- {
- (my $menu,my $item,my $comment,my $url) = split(/,/,$ligne);
- if ($menu ne $oldmenu)
- {
- if ($oldmenu ne "")
- {
- print '</table>';
- }
- $gifname = "img".$menu.".gif";
- $rc = MakeGifMenu($menu,"/opt/NetAdmin/".$CodeCR."/html/images/".$gifname);
- print '<table width="150" border="0">';
- print ' <tr>';
- print ' <td height="10"></td>';
- print ' </tr>';
- print ' <tr>';
- print ' <td><img src="/'.$CodeCR.'/images/'.$gifname.'" width="150" height="21" alt="'.$menu.'"></td>';
- print ' </tr>';
- print '</table>';
- print '<table width="150" border="0">';
- }
- $gifname = "img".$numitem.".gif";
- $butname = "'but".$numitem."-dot'";
- $rc = MakeGifItem($item,"/opt/NetAdmin/".$CodeCR."/html/images/".$gifname);
- print ' <tr>',"n";
- print ' <td width="10"> <img src="/NetAdmin/images/greendot.gif" width="13" height="14" name='.$butname.'></td>',"n";
- if ($CodeCR eq 'NetAdmin' and $menu ne 'General')
- { print ' <td width="133"><a href="'.$url.'" target="toto" onMouseOver="switchdot('.$butname.',1)" onMouseOut="switchdot('.$butname.',0)"><img src="/'.$CodeCR.'/images/'.$gifname.'" width="150" height="14" border="0" alt="'.$comment.'"></a></td>',"n"; }
- else
- { print ' <td width="133"><a href="'.$url.'" target="main" onMouseOver="switchdot('.$butname.',1)" onMouseOut="switchdot('.$butname.',0)"><img src="/'.$CodeCR.'/images/'.$gifname.'" width="150" height="14" border="0" alt="'.$comment.'"></a></td>',"n"; }
- print ' </tr>',"n";
- $numitem++;
- $oldmenu = $menu;
- }
- }
- close(FMENU);
- print ' <tr>';
- print ' <td colspan=2 height="10"></td>';
- print ' </tr>';
- print '</table>';
- return 1;
- }
- $numitem = 0;
- print "Content-type: text/htmln";
- print "n";
- print "<HTML>n";
- print "<HEAD>n";
- #print '<meta http-equiv="Refresh" content="60;URL=/cgi-bin/side.pl?cr=',$CodeCR,'">',"n";
- print "<TITLE>Net-Tel</TITLE>";
- print "</HEAD>";
- print <<END;
- <BODY bgcolor="#7373A5">
- <SCRIPT LANGUAGE="JavaScript">
- <!--
- if(parseInt(navigator.appVersion.substring(0,1))>=3){
- doton = new Image(13,14);
- doton.src = "/NetAdmin/images/orangedot.gif";
- dotoff = new Image(13,14);
- dotoff.src = "/NetAdmin/images/greendot.gif";
- }
- function switchdot(name,on){
- if(parseInt(navigator.appVersion.substring(0,1))>=3){
- image = eval("" + (on == 1 ? "doton.src" : "dotoff.src"));
- document[name].src=image;
- }
- }
- //-->
- </SCRIPT>
- <DIV ALIGN=CENTER>
- END
- print "<FONT COLOR=red SIZE=+2><U>",$CodeCR,"</U></FONT>";
- print "</DIV>";
- $rc = MakeMenu();
- print "</BODY>";
- print "</HTML>";
- exit(0);