int control_process() { char* buffer = NULL; // 检查用户是否按下了按钮 if (cgiFormSubmitClicked("led1") == cgiFormSuccess) { // 调用 led 1 控制代码 control_led(0); } else if (cgiFormSubmitClicked("led2") == cgiFormSuccess) { // 调用 led 2 控制代码 control_led(1); } else if (cgiFormSubmitClicked("logout") == cgiFormSuccess) { // 退出登录 session_destroy(); cgiHeaderLocation(cgiScriptName); return 0; } // 输出 ContentType header // 作为 CGI 程序必须输出这个 header,否则会导致 500 错误 fprintf(cgiOut, "Pragma: no-cache\n"); cgiHeaderContentType("text/html"); buffer = read_template(g_control_template); if (buffer == NULL) { fprintf(cgiOut, "Warning: Can't read template file: %s.<br />\n", g_control_template); return -1; } fprintf(cgiOut, "%s", buffer); free(buffer); return 0; }
int cgiMain() { #ifdef DEBUG LoadEnvironment(); #endif /* DEBUG */ /* Load a previously saved CGI scenario if that button has been pressed. */ if (cgiFormSubmitClicked("loadenvironment") == cgiFormSuccess) { LoadEnvironment(); } /* Set any new cookie requested. Must be done *before* outputting the content type. */ CookieSet(); /* Send the content type, letting the browser know this is HTML */ cgiHeaderContentType("text/html"); /* Top of the page */ fprintf(cgiOut, "<HTML><HEAD>\n"); fprintf(cgiOut, "<TITLE>cgic test</TITLE></HEAD>\n"); fprintf(cgiOut, "<BODY><H1>cgic test</H1>\n"); /* If a submit button has already been clicked, act on the submission of the form. */ if ((cgiFormSubmitClicked("testcgic") == cgiFormSuccess) || cgiFormSubmitClicked("saveenvironment") == cgiFormSuccess) { HandleSubmit(); fprintf(cgiOut, "<hr>\n"); } /* Now show the form */ ShowForm(); /* Finish up the page */ fprintf(cgiOut, "</BODY></HTML>\n"); return 0; }
int cgiMain(void) { char *ip; ip = (char *) calloc(32, sizeof(char)); //初始化 NET_DVR_Init(); NET_DVR_SetLogToFile(3,"./sdkLog"); //设置链接时间与重连时间 NET_DVR_SetConnectTime(2000,1); NET_DVR_SetReconnect(10000,true); //注册设备 LONG lUserID; NET_DVR_DEVICEINFO_V30 struDevice; //strcpy(ip,GetIP()); lUserID = NET_DVR_Login_V30("192.168.1.64""",8000,"admin","12345",&struDevice); if(lUserID < 0) { printf("Login in ERROR:%d\n",NET_DVR_GetLastError()); NET_DVR_Cleanup(); return 1; } printf("login success!\n"); free(ip); cgiHeaderContentType("Text/html"); //while(1){ if(cgiFormSubmitClicked("reboot") == cgiFormSuccess) { TestRebootDVR(lUserID); } if(cgiFormSubmitClicked("Alarm") == cgiFormSuccess) { if(Demo_Alarm() == HPR_ERROR) goto EXIT; } if(cgiFormSubmitClicked("record") == cgiFormSuccess) { if(record() == HPR_ERROR) goto EXIT; } //} EXIT: NET_DVR_Logout_V30(lUserID); NET_DVR_Cleanup(); return 0; }
int cgiMain() { CONFIG_T cfg, rcfg; int sock; int err; int checks; #if DEBUG afreshOrient("cgi.txt", "a", stdout); //test #endif /* DEBUG */ if((sock = MyConnect()) < 0) { if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "MyConnect failed") != SUCCESS){ exit(EFAILED); } exit(EFAILED); } /*load the configuration file*/ if((err = LoadConf(sock, DEVICE_NUM, &cfg)) != 0) { /*load the configuration file*/ if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "LoadConf failed") != SUCCESS){ exit(EFAILED); } exit(EFAILED); } /* If a submit button has already been clicked, act on the submission of the form. */ if (cgiFormSubmitClicked("login_loginpage") == cgiFormSuccess) { strcpy(cfg.user.uname, SUPERNAME); if((err = ReceiveSubmit(DEVICE_NUM, &rcfg)) != SUCCESS) { if(cgi_sprint("FAILED", "", BADREQUIST, "ReceiveSubmit failed") != SUCCESS){ exit(EFAILED); } exit(EFAILED); } if((checks = CheckLogin(rcfg.user, cfg.user)) != SUCCESS) { if(cgi_sprint("FAILED", "", UNAUTHENTICATION, "authentication failed") != SUCCESS){ exit(EFAILED); } exit(EFAILED); } else { //AUTHENTICATION if(setenv(CGI_AUTH_IP, CGICLIENTIP, 1) != 0) { if(cgi_sprint("FAILED", "", 100, "authentication save failed") != SUCCESS){ exit(EFAILED); } exit(EFAILED); } if(cgi_sprint("SUCCESS", "../main.html", SUSSHAND, "request success") != SUCCESS){ exit(EFAILED); } } //SendSubmit(DEVICE_NUM, rcfg); } CloseSocket(sock); return SUCCESS; }
int cgiMain() { CONFIG_T newcfg; int sock; #ifdef DEBUG afreshOrient("cgi.txt", "a", stdout); //test #endif /* DEBUG */ if((sock = MyConnect()) < 0) { if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "MyConnect failed") != SUCCESS){ exit(EFAILED); } exit(-1); } /* If a submit button has already been clicked, act on the submission of the form. */ if (cgiFormSubmitClicked("savesetup") == cgiFormSuccess) { /*load the configuration file*/ ReceiveSubmit(DEVICE_NUM, &newcfg); SaveConf(sock, DEVICE_NUM, newcfg); } else if(LoadConf(sock, DEVICE_NUM, &newcfg) != 0) { if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "LoadConf failed") != SUCCESS){ exit(EFAILED); } exit(-1); } /* Now send the data for form */ SendSubmit(DEVICE_NUM, newcfg); CloseSocket(sock); exit(0); }
int cgiMain() { afreshOrient("cgi.txt", "a", stdout); //test /* Send the content type, letting the browser know this is HTML */ cgiHeaderContentType("text/html"); /* If a submit button has already been clicked, act on the submission of the form. */ if (cgiFormSubmitClicked("uploadSubmit") == cgiFormSuccess) { if(UiReturn(UploadFile()) != SUCCESS) exit(EFAILED); } else if (cgiFormSubmitClicked("rebootSubmit") == cgiFormSuccess) { my_reboot(); } exit(SUCCESS); }
static int s_multiRadius_prefix_of_page( STPageInfo *pstPageInfo ) { char del_rule[10] = ""; char nodez[MAX_RADIUS_DOMAIN_LEN] = {0}; int ret = 0; FILE * fp = pstPageInfo->fp; //if file not exist,creat it and write "start" in it char buf_start[]="start\n"; fprintf(fp, "<style type=text/css>"\ "#div1{ width:58px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:56px; height:15px; padding-left:3px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}</style>" ); fprintf(fp, "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"); if( cgiFormSubmitClicked(SUBMIT_NAME) == cgiFormSuccess ) { fprintf( fp, "<script type='text/javascript'>\n" ); fprintf( fp, "window.location.href='wp_multi_radius.cgi?UN=%s';\n", pstPageInfo->encry ); fprintf( fp, "</script>\n" ); } cgiFormStringNoNewlines( "DELRULE", del_rule, 10 ); if( !strcmp(del_rule, "delete") && (pstPageInfo->iUserGroup == 0)) { cgiFormStringNoNewlines( "NODEZ", nodez, sizeof(nodez) ); ret = eag_del_radius(ccgi_connection, parameter.local_id, parameter.instance_id, nodez ); fprintf( fp, "<script type='text/javascript'>\n" ); fprintf( fp, "window.location.href='wp_multi_radius.cgi?UN=%s&plotid=%s';\n", pstPageInfo->encry ,plotid); fprintf( fp, "</script>\n" ); } return 0; }
int cgiMain() { /* Send the content type, letting the browser know this is HTML */ cgiHeaderContentType("text/html"); fprintf(cgiOut, "<HTML><HEAD>\n"); fprintf(cgiOut, "<TITLE>Robot SetName</TITLE></HEAD>\n"); if ((cgiFormSubmitClicked("send") == cgiFormSuccess)) { handlePlainText(); } fprintf(cgiOut, "</BODY></HTML>\n"); return 0; }
int cgiMain() { /* Send the content type, letting the browser know this is HTML */ cgiHeaderContentType("text/html;charset=gb2312"); /* Top of the page */ fprintf(cgiOut, "<HTML><HEAD>\n"); fprintf(cgiOut, "<TITLE>NC600 Web Server</TITLE>\n"); print_css(); print_backgrounf(); fprintf(cgiOut, "</HEAD><BODY>\n"); get_user(name, passwd); if(cgiFormSubmitClicked("host") == cgiFormSuccess) { char o_name[16]="", o_passwd[16]="", n_name[16]="", n_passwd[16]="", nck_passwd[16]=""; getformstrchar("name", o_name, 16); getformstrchar("passwd", o_passwd, 16); getformstrchar("n_name", n_name, 16); getformstrchar("n_passwd", n_passwd, 16); getformstrchar("nck_passwd", nck_passwd, 16); printf("[%s]\t[%s]\t[%s]\t[%s]\t[%s]\n", o_name, o_passwd, n_name, n_passwd, nck_passwd); printf("[%s]\t[%s]\t[%s]\n", name, passwd, (char*)crypt(o_passwd, "NC600")); if((strcmp(name, o_name) == 0) && (strcmp(passwd, (char*)crypt(o_passwd, "NC600")) == 0) && (strcmp(n_passwd, nck_passwd) == 0)) { set_user(n_name, n_passwd); get_user(name, passwd); fprintf(cgiOut, "<script type=\"text/javascript\">\n"); fprintf(cgiOut, "window.alert(\"口令修改成功!\");\n"); fprintf(cgiOut, "</script>\n"); } else { fprintf(cgiOut, "<script type=\"text/javascript\">\n"); fprintf(cgiOut, "window.alert(\"口令修改失败!\");\n"); fprintf(cgiOut, "</script>\n"); } } ShowForm(); fprintf(cgiOut, "</BODY></HTML>\n"); return 0; }
void HandleSubmit() { Name(); Address(); Hungry(); Temperature(); Frogs(); Color(); Flavors(); NonExButtons(); RadioButtons(); File(); Entries(); Cookies(); /* The saveenvironment button, in addition to submitting the form, also saves the resulting CGI scenario to disk for later replay with the 'load saved environment' button. */ if (cgiFormSubmitClicked("saveenvironment") == cgiFormSuccess) { SaveEnvironment(); } }
int ShowACLGrplistPage() { struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lcontrol; /*解析help.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lcontrol=get_chain_head("../htdocs/text/control.txt"); char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *aclGrplist_encry=(char *)malloc(BUF_LEN); char *PNtemp=(char *)malloc(10); char *SNtemp=(char *)malloc(10); char *str=NULL; // FILE *fp1; //char lan[3]; struct group_info *max_groupnum = (struct group_info *)malloc(sizeof(struct group_info)*MAX_GROUP_NUM); int i,j; int retu=0; int cl=1; /*cl标识表格的底色,1为#f9fafe,0为#ffffff*/ char *vIDTemp=(char *)malloc(10); char* i_char=(char *)malloc(10); char menu[21]="menulist"; int pageNum=0; char * pageNumCA=(char *)malloc(10); memset(pageNumCA,0,10); char * pageNumCD=(char *)malloc(10); memset(pageNumCD,0,10); char * DelAclG=(char *)malloc(10); memset(DelAclG,0,10); char * GrpIndex=(char *)malloc(10); memset(GrpIndex,0,10); char * GrpDir=(char *)malloc(10); memset(GrpDir,0,10); char * CheckUsr=(char *)malloc(10); memset(CheckUsr,0,10); for(i=0;i<MAX_GROUP_NUM;i++) { max_groupnum[i].groupIndex=0; max_groupnum[i].ruleNumber=0; max_groupnum[i].groupType=0; for(j=0;j<1024;j++) max_groupnum[i].ruleindex[j]=0; } ccgi_dbus_init(); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } memset(aclGrplist_encry,0,BUF_LEN); /*清空临时变量*/ } memset(PNtemp,0,10); cgiFormStringNoNewlines("PN",PNtemp,10); pageNum=atoi(PNtemp); memset(SNtemp,0,10); cgiFormStringNoNewlines("SN",SNtemp,10); cgiFormStringNoNewlines("config_encry",aclGrplist_encry,BUF_LEN); cgiFormStringNoNewlines("DELACL",DelAclG,10); cgiFormStringNoNewlines("GrpIndex",GrpIndex,10); cgiFormStringNoNewlines("GrpDir",GrpDir,10); cgiFormStringNoNewlines("CheckUsr",CheckUsr,10); if(strcmp(CheckUsr,"")!=0) retu=atoi(CheckUsr); unsigned int dirtemp=0; cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcontrol,"acl_conf")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".configvlan {overflow-x:hidden; overflow:auto; width: 480px; height=340; clip: rect( ); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>"\ "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"\ "<body>"); if(strcmp(DelAclG,"delete")==0) { dirtemp=atoi(GrpDir); delete_acl_group(GrpIndex,dirtemp); } if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { retu=checkuser_group(str); } else { fprintf( cgiOut, "<script type='text/javascript'>\n" ); fprintf( cgiOut, "window.location.href='wp_contrl.cgi?UN=%s';\n", aclGrplist_encry); fprintf( cgiOut, "</script>\n" ); } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>ACL</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_GrpList style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) fprintf(cgiOut,"<td width=62 align=left><a href=wp_aclall.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_aclall.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",aclGrplist_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_aclall.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"acl_list")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addaclrule.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_acl_rule")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"acl_grp_lsit")); /*突出显示*/ fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addaclgroup.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_acl_group")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_aclall.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"acl_list")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"acl_grp_lsit")); /*突出显示*/ fprintf(cgiOut,"</tr>"); } } else if(cgiFormSubmitClicked("submit_GrpList") == cgiFormSuccess) { if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_aclall.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",aclGrplist_encry,search(lpublic,"menu_san"),search(lcontrol,"acl_list")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addaclrule.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",aclGrplist_encry,search(lpublic,"menu_san"),search(lcontrol,"add_acl_rule")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"acl_grp_lsit")); /*突出显示*/ fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addaclgroup.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",aclGrplist_encry,search(lpublic,"menu_san"),search(lcontrol,"add_acl_group")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_aclall.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",aclGrplist_encry,search(lpublic,"menu_san"),search(lcontrol,"acl_list")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"acl_grp_lsit")); /*突出显示*/ fprintf(cgiOut,"</tr>"); } } int rowsCount=0; if(retu==0) rowsCount=12; else rowsCount=14; for(i=0;i<rowsCount;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=640 height=340 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px;padding-left:0px;padding-top:0px\">%s</td>",search(lcontrol,"ACL_grp_info")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td align=left valign=top style=\"padding-top:18px\">"\ "<div class=configvlan><table width=280 border=1 frame=below rules=rows bordercolor=#cccccc cellspacing=0 cellpadding=0>"\ "<tr height=25 bgcolor=#eaeff9 style=font-size:12px align=left>"\ "<th width=70 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"group_index")); fprintf(cgiOut,"<th width=70 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"group_type")); fprintf(cgiOut,"<th width=70 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"group_rule_num")); fprintf(cgiOut,"<th width=13> </th>"); fprintf(cgiOut,"</tr>"); int GroupNum1=0,GroupNum2=0,GroupNum=0; show_group_list(0, max_groupnum,&GroupNum1,0); show_group_list(1, max_groupnum,&GroupNum2,GroupNum1); int xnt=0,head=0,tail=0; GroupNum=GroupNum1+GroupNum2; if(0==strcmp(SNtemp,"PageDown") || 0==strcmp(SNtemp,"")) { if((GroupNum-(pageNum*PageNum)) < 0 ) { pageNum=pageNum-1; ShowAlert(search(lcontrol,"Page_end")); } if(GroupNum-pageNum*PageNum<PageNum) xnt=GroupNum; else xnt=(pageNum+1)*PageNum; head=pageNum*PageNum; tail=xnt; } else if(0==strcmp(SNtemp,"PageUp")) { if(pageNum<0) { pageNum=pageNum+1; ShowAlert(search(lcontrol,"Page_Begin")); } if(GroupNum-pageNum*PageNum<PageNum) xnt=GroupNum; else xnt=(pageNum+1)*PageNum; head=pageNum*PageNum; tail=xnt; } for(i=head;i<tail;i++) { memset(menu,0,21); strcpy(menu,"menulist"); sprintf(i_char,"%d",i+1); strcat(menu,i_char); if(max_groupnum[i].groupType==0) { fprintf(cgiOut,"<tr height=25 bgcolor=%s>",setclour(cl)); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",max_groupnum[i].groupIndex); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>","ingress"); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",max_groupnum[i].ruleNumber); } else if(max_groupnum[i].groupType==1) { fprintf(cgiOut,"<tr height=25 bgcolor=%s>",setclour(cl)); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",max_groupnum[i].groupIndex); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>","egress"); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",max_groupnum[i].ruleNumber); } if(retu==0) { fprintf(cgiOut,"<td align=left>"); fprintf(cgiOut,"<div style=\"position:relative; z-index:%d\" onmouseover=\"popMenu('%s');\" onmouseout=\"popMenu('%s');\">",(GroupNum-i),menu,menu); fprintf(cgiOut,"<img src=/images/detail.gif>"\ "<div id=%s style=\"display:none; position:absolute; top:5px; left:0;\">",menu); fprintf(cgiOut,"<div id=div1>"); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_con_aclgrp.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic,"configure")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_aclgrplist.cgi?UN=%s&DELACL=%s&GrpIndex=%u&GrpDir=%u target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",encry,"delete",max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lcontrol,"confirm_delete"),search(lcontrol,"del_group")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_acl_port_info.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic, "portinfo")); } else if(cgiFormSubmitClicked("submit_GrpList") == cgiFormSuccess) { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_con_aclgrp.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",aclGrplist_encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic,"configure")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_aclgrplist.cgi?UN=%s&DELACL=%s&GrpIndex=%u&GrpDir=%u target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",aclGrplist_encry,"delete",max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lcontrol,"confirm_delete"),search(lcontrol,"del_group")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_acl_port_info.cgi?UN=%s&INDEX=%u&TYPE=%u target=mainFrame>%s</a></div>",aclGrplist_encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic,"portinfo")); } fprintf(cgiOut,"</div>"\ "</div>"\ "</div>"); fprintf(cgiOut,"</td>"); } else { fprintf(cgiOut,"<td align=left>"); fprintf(cgiOut,"<div style=\"position:relative; z-index:%d\" onmouseover=\"popMenu('%s');\" onmouseout=\"popMenu('%s');\">",(GroupNum-i),menu,menu); fprintf(cgiOut,"<img src=/images/detail.gif>"\ "<div id=%s style=\"display:none; position:absolute; top:5px; left:0;\">",menu); fprintf(cgiOut,"<div id=div1>"); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_con_aclgrp.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",encry,grpInfo[i].groupIndex,grpInfo[i].groupType,search(lpublic,"configure")); //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_aclgrplist.cgi?UN=%s&DELACL=%s&GrpIndex=%u&GrpDir=%u target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",encry,"delete",grpInfo[i].groupIndex,grpInfo[i].groupType,search(lcontrol,"confirm_delete"),search(lcontrol,"del_group")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_acl_port_info.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic, "portinfo")); } else if(cgiFormSubmitClicked("submit_GrpList") == cgiFormSuccess) { //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_con_aclgrp.cgi?UN=%s&INDEX=%d&TYPE=%u target=mainFrame>%s</a></div>",aclGrplist_encry,grpInfo[i].groupIndex,grpInfo[i].groupType,search(lpublic,"configure")); //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_aclgrplist.cgi?UN=%s&DELACL=%s&GrpIndex=%u&GrpDir=%u target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",aclGrplist_encry,"delete",grpInfo[i].groupIndex,grpInfo[i].groupType,search(lcontrol,"confirm_delete"),search(lcontrol,"del_group")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_acl_port_info.cgi?UN=%s&INDEX=%u&TYPE=%u target=mainFrame>%s</a></div>",aclGrplist_encry,max_groupnum[i].groupIndex,max_groupnum[i].groupType,search(lpublic,"portinfo")); } fprintf(cgiOut,"</div>"\ "</div>"\ "</div>"); fprintf(cgiOut,"</td>"); } fprintf(cgiOut,"</tr>"); cl=!cl; } fprintf(cgiOut,"</table></div></td>"\ "</tr>"\ "<tr>"\ "<td>"\ "<table width=430 style=padding-top:2px>"\ "<tr>"); sprintf(pageNumCA,"%d",pageNum+1); sprintf(pageNumCD,"%d",pageNum-1); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_aclgrplist.cgi?UN=%s&PN=%s&SN=%s>%s</td>",encry,pageNumCA,"PageDown",search(lcontrol,"page_down")); fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_aclgrplist.cgi?UN=%s&PN=%s&SN=%s>%s</td>",encry,pageNumCD,"PageUp",search(lcontrol,"page_up")); } else if(cgiFormSubmitClicked("submit_GrpList") == cgiFormSuccess) { fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_aclgrplist.cgi?UN=%s&PN=%s&SN=%s>%s</td>",aclGrplist_encry,pageNumCA,"PageDown",search(lcontrol,"page_down")); fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_aclgrplist.cgi?UN=%s&PN=%s&SN=%s>%s</td>",aclGrplist_encry,pageNumCD,"PageUp",search(lcontrol,"page_up")); } fprintf(cgiOut,"</tr></table></td>"\ "</tr>"\ "<tr>"); if(cgiFormSubmitClicked("submit_GrpList") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=config_encry value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } else if(cgiFormSubmitClicked("submit_GrpList") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=config_encry value=%s></td>",aclGrplist_encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(i_char); free(PNtemp); free(CheckUsr); free(SNtemp); free(vIDTemp); free(pageNumCA); free(pageNumCD); free(DelAclG); free(GrpIndex); free(GrpDir); free(encry); release(lpublic); release(lcontrol); return 0; }
int ShowSystemInformationPage(struct list *lpublic, struct list *lsystem, struct list *lcontrol) { int i, ret,status; int retu; char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char save_encry[BUF_LEN]; char *str; struct sys_ver ptrsysver;/*产品系统信息*/ ptrsysver.product_name=(char *)malloc(50); ptrsysver.base_mac=(char *)malloc(50); ptrsysver.serial_no=(char *)malloc(50); ptrsysver.swname=(char *)malloc(50); char * procductId=readproductID(); struct sys_img sysimg; sysimg.boot_img=(char *)malloc(50); if((cgiFormSubmitClicked("save_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("del_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("reboot") != cgiFormSuccess)) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); //用户非法 return 0; } memset(save_encry,0,BUF_LEN); //清空临时变量 } else { cgiFormStringNoNewlines("encry_save",save_encry,BUF_LEN); str=dcryption(save_encry); } cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lsystem,"sys_function")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("save_config") == cgiFormSuccess) { ret=1; #if 0 ; #else // int status_m =system("srvsave.sh"); status = system("save_config.sh > /dev/null"); ret = WEXITSTATUS(status); //int ret = WEXITSTATUS(status_m); //fprintf(cgiOut,"service save result = %d",status_m); #endif if(ret==0) { ShowAlert(search(lpublic,"oper_succ")); } else { ShowAlert(search(lpublic,"oper_fail")); } } if(cgiFormSubmitClicked("del_config") == cgiFormSuccess) { ret = 1; int status_d =system("sudo earse.sh > /dev/null"); if(status_d==0) { ShowAlert(search(lpublic,"oper_succ")); } else { ShowAlert(search(lpublic,"oper_fail")); } } if(cgiFormSubmitClicked("reboot") == cgiFormSuccess) { status = system("ac_reset_fast_all.sh > /dev/null"); // ret = WEXITSTATUS(status); // if(ret==0) // { ShowAlert(search(lpublic,"oper_succ")); // } // else // { // ShowAlert(search(lpublic,"oper_fail")); // } } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),search(lsystem,"sys_function")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); if((cgiFormSubmitClicked("save_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("del_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("reboot") != cgiFormSuccess)) { fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"); fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_ok")); fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); } else { fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"); { fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",save_encry,search(lpublic,"img_ok")); fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",save_encry,search(lpublic,"img_cancel")); } fprintf(cgiOut,"</tr>"\ "</table>"); } fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); retu=checkuser_group(str); if((cgiFormSubmitClicked("save_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("del_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("reboot") != cgiFormSuccess)) { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lsystem,"sys_infor")); /*突出显示*/ fprintf(cgiOut,"</tr>"); if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_sysconfig.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"sys_config")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_impconf.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"import_config")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_export.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"export_config")); fprintf(cgiOut,"</tr>"); //新增条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_version_upgrade.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"version_up")); fprintf(cgiOut,"</tr>"); //boot upgrade fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_boot_upgrade.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"boot_item")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_log_info.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"log_info")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_login_limit.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"l_user")); fprintf(cgiOut,"</tr>"); } //新增时间条目 fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_showtime.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"systime")); fprintf(cgiOut,"</tr>"); if(retu==0) { //新增条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_ntp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"ntp_s")); fprintf(cgiOut,"</tr>"); //新增pppoe条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_pppoe_server.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),"PPPOE"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_pppoe_snp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),"PPPOE SNP"); fprintf(cgiOut,"</tr>"); } //新增时间条目 fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_webservice.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"web_service")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\">%s</td>",search(lsystem,"sys_infor")); /*突出显示*/ fprintf(cgiOut,"</tr>"); if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_impconf.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lsystem,"import_config")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_export.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lsystem,"export_config")); fprintf(cgiOut,"</tr>"); //新增条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_version_upgrade.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lpublic,"version_up")); fprintf(cgiOut,"</tr>"); //boot upgrade fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_boot_upgrade.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lsystem,"boot_item")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_log_info.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lpublic,"log_info")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_login_limit.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lpublic,"l_user")); fprintf(cgiOut,"</tr>"); } //新增时间条目 fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_showtime.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lsystem,"systime")); fprintf(cgiOut,"</tr>"); if(retu==0) { //新增条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_ntp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),search(lpublic,"ntp_s")); fprintf(cgiOut,"</tr>"); //新增pppoe条目 fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_pppoe_server.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),"PPPOE"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_pppoe_snp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",save_encry,search(lpublic,"menu_san"),"PPPOE SNP"); fprintf(cgiOut,"</tr>"); } //新增时间条目 fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_webservice.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"web_service")); fprintf(cgiOut,"</tr>"); } for(i=0; i<8; i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px\">"\ "<table style=\"padding-left:50px; padding-bottom:10px\" width=594 border=0 cellspacing=0 cellpadding=0>"\ "<tr style=\"padding-left:380px; padding-bottom:10px\">"\ "<td><table width=150 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"); if(retu==0) { fprintf(cgiOut,"<td><input type=submit width=60 name=save_config value=%s /></td>"\ "<td><input type=submit name=del_config value=%s /></td>"\ "<td><input type=submit name=reboot value=%s onclick=\"return confirm('%s')\" /></td>",search(lsystem,"save_config"),search(lsystem,"reset"),search(lsystem,"reboot"),search(lcontrol,"confirm_reboot")); } else { fprintf(cgiOut,"<td><input type=submit width=60 name=save_config value=%s disabled></td>"\ "<td><input type=submit name=del_config value=%s disabled></td>"\ "<td><input type=submit name=reboot value=%s onclick=\"return confirm('%s')\" disabled></td>",search(lsystem,"save_config"),search(lsystem,"reset"),search(lsystem,"reboot"),search(lcontrol,"confirm_reboot")); } fprintf(cgiOut,"</table></td>"\ "</tr>"\ "<tr>"\ "<td id=thead1 style=\"padding-left:200px; padding-bottom:0px\"><font size=4px>%s</font></td>",search(lsystem,"product_info")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td><table frame=below rules=rows width=500 border=1 cellspacing=0 cellpadding=0>"); ccgi_dbus_init(); /*初始化dbus*/ if(show_sys_ver(&ptrsysver)==0) /*获取系统信息*/ { fprintf(cgiOut,"<tr>"\ "<td id=td1 width=240>Software Name</td>"\ "<td id=td2 width=260>%s</td>",ptrsysver.sw_name); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td id=td1>Product Name</td>"\ "<td id=td2>%s</td>",ptrsysver.sw_product_name); #if 0 fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td id=td1>Version</td>"\ "<td id=td2>V%d.%d.%d(Build%03d)</td>",SW_MAJOR_VER(ptrsysver.sw_version),SW_MINOR_VER(ptrsysver.sw_version),SW_COMPATIBLE_VER(ptrsysver.sw_version),SW_BUILD_VER(ptrsysver.sw_version)); #endif { fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td id=td1>Version</td>"\ "<td id=td2>%s</td>",ptrsysver.sw_version_str); } fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td id=td1>MAC Address</td>"\ "<td id=td2>%s</td>",ptrsysver.sw_mac); fprintf(cgiOut,"</tr>"); #if 0 fprintf(cgiOut,"<tr>"\ "<td id=td1>Serial Number</td>"\ "<td id=td2>%s</td>",ptrsysver.sw_serial_num); fprintf(cgiOut,"</tr>"); ret=show_system_bootimg(&sysimg); //ShowAlert(sysimg.boot_img); //fprintf(cgiOut,"ret is: %d",ret); fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td id=td1>Boot Version</td>"\ "<td id=td2>%s</td>",sysimg.boot_img); fprintf(cgiOut,"</tr>"); #endif FILE *fp = NULL; char acDeviceSn[256] = {0}; memset(acDeviceSn,0,256); fp=fopen("/devinfo/sn","r"); if(fp != NULL) { fgets(acDeviceSn,256,fp); if(strcmp(acDeviceSn,"") == 0) { memset(acDeviceSn,0,256); strncpy(acDeviceSn,"01010106C14009900001",sizeof(acDeviceSn)-1); } fclose(fp); } else { memset(acDeviceSn,0,256); strncpy(acDeviceSn,"01010106C14009900001",sizeof(acDeviceSn)-1); } fprintf(cgiOut,"<tr>"\ "<td id=td1>SN</td>"\ "<td id=td2>%s</td>",acDeviceSn); fprintf(cgiOut,"</tr>"\ "<tr>"); if((cgiFormSubmitClicked("save_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("del_config") != cgiFormSuccess)&&(cgiFormSubmitClicked("reboot") != cgiFormSuccess)) { fprintf(cgiOut,"<td colspan=3><input type=hidden name=encry_save value=%s></td>",encry); } else { fprintf(cgiOut,"<td colspan=3><input type=hidden name=encry_save value=%s></td>",save_encry); } fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"%s",search(lpublic,"contact_adm")); } //else //{ //fprintf(cgiOut,"%s",search(lpublic,"contact_adm")); //} fprintf(cgiOut,"</table></td>"\ "</tr>"\ "<tr>"\ "<td><table frame=below rules=rows width=500 border=1 cellspacing=0 cellpadding=0>"); #if 0 if(show_hardware_configuration()!=0) { fprintf(cgiOut,"%s",search(lpublic,"contact_adm")); } #endif fprintf(cgiOut,"</table>"\ "</td>"\ "</tr>"); fprintf(cgiOut,"<tr>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">%s</td>",search(lpublic,"description")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25 style=padding-top:2px>"\ "<td style=font-size:14px;color:#FF0000>%s </td>"\ "</tr>"\ "<tr height=25>"\ "<td style=font-size:14px;color:#FF0000> %s</td>"\ "</tr>",search(lcontrol,"save_des"),search(lcontrol,"reboot_des")); fprintf(cgiOut,"</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); free(sysimg.boot_img); free(procductId); free(ptrsysver.product_name); free(ptrsysver.base_mac); free(ptrsysver.serial_no); free(ptrsysver.swname); return 0; }
int ShowImportPage() { char *encry=(char *)malloc(BUF_LEN); char *address = (char *)malloc(128); char usrname[30]; char passwd[30]; int ret=-1; char imp_encry[BUF_LEN]; if(cgiFormSubmitClicked("upload_file") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); if(strcmp(encry,"123456")!=0) { ShowErrorPage("用户非法"); return 0; } memset(imp_encry,0,BUF_LEN); } cgiFormStringNoNewlines("encry_import",imp_encry,BUF_LEN); memset(address,0,128); memset(usrname,0,30); memset(passwd,0,30); cgiFormStringNoNewlines("address",address,128); cgiFormStringNoNewlines("usrname",usrname,30); cgiFormStringNoNewlines("passwd",passwd,30); char cmd[128]; memset(cmd,0,sizeof(cmd)); //sprintf(cmd,"wget -N -P /mnt %s > /dev/null",address); sprintf(cmd," wget -N -P /mnt --user=%s --password=%s %s > /dev/null",usrname,passwd,address); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>","版本升级"); fprintf(cgiOut,"<body>"); if(cgiFormSubmitClicked("upload_file") == cgiFormSuccess) { ret=webup(address,cmd,usrname,passwd); if(ret==0) ShowAlert("上传成功"); else ShowAlert("上传失败"); } fprintf(cgiOut,"<form method=post encType=multipart/form-data>"); fprintf(cgiOut,"<table>"\ "<tr>"); fprintf(cgiOut,"<td>"\ "<table width=480 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td align=left>"\ "%s</td><td><input type=text name=address value=\"\">","版本文件"); fprintf(cgiOut,"<td><input type=submit name=upload_file value=\"%s\"></td>","上传"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr>\n"); fprintf(cgiOut,"<td>用户名:\n"); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<input type=text name=usrname value=\"\">"); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"</tr>\n"); fprintf(cgiOut,"<tr>\n"); fprintf(cgiOut,"<td>密码:\n"); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<input type=text name=passwd value=\"\">"); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"</tr>\n"); if(cgiFormSubmitClicked("upload_file") != cgiFormSuccess) { fprintf(cgiOut,"<tr><td colspan=3><input type=hidden name=encry_import value=%s></td></tr>",encry); } else if(cgiFormSubmitClicked("upload_file") == cgiFormSuccess) { fprintf(cgiOut,"<tr><td colspan=3><input type=hidden name=encry_import value=%s></td></tr>",imp_encry); } fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</form>"\ "</body>"\ "</html>"); free(encry); free(address); return 0; }
static int s_usr_mng_prefix_of_page( STPageInfo *pstPageInfo ) { FILE *fp = pstPageInfo->fp; fprintf(fp, "<style type=text/css>"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ "</style>"); fprintf(fp, "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"); struct list * portal_lcon = pstPageInfo->pstPortalContainer->lcon; struct list * portal_lauth = pstPageInfo->lauth; char all_data_num[10]; memset( all_data_num, 0, 10 ); char downflag[20]; memset( downflag, 0, 20 ); char c_userip[20]; memset( c_userip, 0, 20 ); int i_userip = 0; char *endptr; //memset( &search_user, 0, sizeof(STOnlineUserInfo) ); //memset(total_num,0,10); ////////全局初始化//////////// memset(PNtemp,0,10); FirstPage = 1;//首页为第一页 LastPage = 0; pageNum = 1; //初始进第一页 totalNum = 0; search_switch = 0; search_point = 0; cgiFormStringNoNewlines( "TOTAL", all_data_num, 10 ); //fprintf( stderr, "all_data_num=%s\n" ,all_data_num ); if( strcmp(all_data_num,"") != 0) { totalNum=atoi(all_data_num); } cgiFormStringNoNewlines( "PN", PNtemp, 10 ); if( strcmp(PNtemp,"") != 0) { pageNum=atoi(PNtemp); } //fprintf( stderr, "pageNum=%d--totalNumPage=%d\n" ,pageNum, totalNum ); //////////强制下线/////////////////////// cgiFormStringNoNewlines( "DOWNRULE", downflag, 20 ); if( !strcmp(downflag, "USERDOWN") ) { cgiFormStringNoNewlines( "USERIP", c_userip, 20 ); i_userip = strtoul(c_userip, &endptr, 0); fprintf( stderr, "i_userip=%d", i_userip ); pstPageInfo->pstReq = createRequirePkg( REQ_LOGOUT_BY_INFO, &i_userip, NULL ); if( NULL == pstPageInfo->pstReq ) { fprintf( stderr, "create failed !!"); return 0; } int down_ret = doRequire( pstPageInfo->pstReq, ntohl(inet_addr("127.0.0.1")), 2001, 5, &(pstPageInfo->pstRsp) ); if( NULL == pstPageInfo->pstRsp ) { fprintf( stderr, "get respones failed!\n" ); } if( pstPageInfo->pstRsp->data.ack.LOGOUT_FLAG == 1 ) { ShowAlert(search(portal_lcon, "Operation_Success")); } } if( cgiFormSubmitClicked("submit_user_manage") == cgiFormSuccess ) { fprintf( fp, "<script type='text/javascript'>"); fprintf( fp, "window.location.href = 'wp_authentication.cgi?UN=%s';\n", pstPageInfo->encry); fprintf( fp, "</script>"); } idx_begin = 0; idx_end = 0; int page_ret = 0; page_ret = USER_WEB_Pagination_get_range( totalNum, &pageNum, DATA_NUM_EVERYPAGE, &idx_begin, &idx_end ); //fprintf( stderr, "idx_begin=%d--idx_end=%d--page_ret=%d--totalNum=%d\n" ,idx_begin,idx_end, page_ret,totalNum ); if( -4 == page_ret ) { pageNum++; ShowAlert(search(portal_lcon, "Page_Begin")); } if( -3 == page_ret ) { pageNum--; ShowAlert(search(portal_lcon, "Page_end")); } pstPageInfo->pstReq = createRequirePkg( REQ_GET_USR_BY_INDEX_RANG, &idx_begin, &idx_end ); if( NULL == pstPageInfo->pstReq ) { fprintf( stderr, "create failed !!"); return 0; } fprintf(stderr,"idx_begin=%d--idx_end=%d",idx_begin,idx_end); fprintf( stderr, "inet_addr(\"127.0.0.1\") = %d\n", ntohl(inet_addr("127.0.0.1")) ); int do_ret = doRequire( pstPageInfo->pstReq, ntohl(inet_addr("127.0.0.1")), 2001, 5, &(pstPageInfo->pstRsp) ); //fprintf( stderr, "do_ret=%d\n",do_ret ); if( do_ret == -1 ) { idx_begin = 0; idx_end = 0; return 0; } //计算出最后一页的页数 totalNum = pstPageInfo->pstRsp->all_user_num; if( (totalNum%DATA_NUM_EVERYPAGE) == 0 || totalNum == 0 ) LastPage = (totalNum/DATA_NUM_EVERYPAGE); //计算出最大页数 else LastPage = (totalNum/DATA_NUM_EVERYPAGE)+1; //计算出最大页数 #if 1 fprintf( stderr, "all_user_num=%d",pstPageInfo->pstRsp->all_user_num); fprintf( stderr, "len=%d",pstPageInfo->pstRsp->len); fprintf( stderr, "user_num_in_pkg=%d",pstPageInfo->pstRsp->data.ack.user_num_in_pkg); fprintf( stderr, "users[0].index=%d",pstPageInfo->pstRsp->data.ack.users[0].index); fprintf( stderr, "users[0].mac=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",pstPageInfo->pstRsp->data.ack.users[0].usermac[0],pstPageInfo->pstRsp->data.ack.users[0].usermac[1],pstPageInfo->pstRsp->data.ack.users[0].usermac[2],pstPageInfo->pstRsp->data.ack.users[0].usermac[3],pstPageInfo->pstRsp->data.ack.users[0].usermac[4],pstPageInfo->pstRsp->data.ack.users[0].usermac[5]); fprintf( stderr, "users[0].username=%s",pstPageInfo->pstRsp->data.ack.users[0].username); fprintf( stderr, "users[0].ipaddr=%x",pstPageInfo->pstRsp->data.ack.users[0].ipaddr); fprintf( stderr, "users[0].input_octets=%lld",pstPageInfo->pstRsp->data.ack.users[0].input_octets); fprintf( stderr, "users[0].output_octets=%lld",pstPageInfo->pstRsp->data.ack.users[0].output_octets); #endif if( NULL == pstPageInfo->pstRsp ) { fprintf( stderr, "get respones failed!\n" ); } #if 1 if(pstPageInfo->pstRsp->data.ack.user_num_in_pkg == 0 && pageNum > 1 ) { ShowAlert(search(portal_lcon, "Page_end")); pageNum -- ; } if( pstPageInfo->pstRsp->data.ack.user_num_in_pkg < DATA_NUM_EVERYPAGE ) { idx_end = idx_begin + pstPageInfo->pstRsp->data.ack.user_num_in_pkg - 1; } //fprintf(stderr,"LA idx_end=%d",idx_end); #endif memset( search_content, 0, 30 ); if( cgiFormSubmitClicked("search_but") == cgiFormSuccess ) { int check_ret = 0; typeChoice = 0; cgiFormSelectSingle("search_type", search_type, 4, &typeChoice, 0); cgiFormStringNoNewlines("search_content", search_content, 30); //fprintf(stderr,"typeChoice=%d--search_content=%s",typeChoice,search_content); if( !strcmp(search_content, "") ) { ShowAlert( search(portal_lauth, "search_not_null") ); fprintf(stderr, "check_ret = %d",check_ret); return 0; } if( typeChoice == 2 ) { check_ret = Input_IP_address_Check(search_content); } else if( typeChoice == 3 ) { check_ret = Input_MAC_address_Check(search_content); } else if( typeChoice == 1 ) { check_ret = Input_User_Name_Check(search_content); } else if( typeChoice == 0 ) { check_ret = Input_User_Index_Check(search_content); } else { ShowAlert("Not pass search type!\n"); } if( check_ret != 0 ) { ShowAlert( search(portal_lauth, "input_char_error") ); fprintf(stderr, "check_ret = %d",check_ret); return 0; } memset(search_content, 0, 30); cgiFormStringNoNewlines("search_content", search_content, 30); ////////start search/////////////////////// fprintf(stderr, "start enter searching---search_content =%s !\n",search_content); search_user_info( typeChoice, totalNum, search_content, &search_point , pstPageInfo); //fprintf(stderr, "search_point = %d---search_switch=%d",search_point,search_switch); } if( cgiFormSubmitClicked("ret_but") == cgiFormSuccess ) { cgiFormStringNoNewlines("Pnum", PNtemp , 10); if( strcmp(PNtemp,"") != 0) { pageNum=atoi(PNtemp); } USER_WEB_Pagination_get_range( totalNum, &pageNum, DATA_NUM_EVERYPAGE, &idx_begin, &idx_end ); //////////////数据修正/////////////////// if(pstPageInfo->pstRsp->data.ack.user_num_in_pkg == 0 && pageNum > 1 ) { ShowAlert(search(portal_lcon, "Page_end")); pageNum -- ; } if( pstPageInfo->pstRsp->data.ack.user_num_in_pkg < DATA_NUM_EVERYPAGE ) { idx_end = idx_begin + pstPageInfo->pstRsp->data.ack.user_num_in_pkg ; } } return 0; }
void ShowPrtFunCfgPage(char *m,char *n,char *t,char *s,struct list *lpublic,struct list *lcon) { char *slot_port=(char *)malloc(10); int i,modeChoice,num,ret; char * url_temp =(char *)malloc(1024); memset(url_temp,0,1024); struct eth_port_s pr; struct slot sr; ETH_SLOT_LIST head,*p; ETH_PORT_LIST *pp; pr.attr_bitmap=0; pr.mtu=0; pr.port_type=0; sr.module_status=0; sr.modname=(char *)malloc(20); //为结构体成员申请空间,假设该字段的最大长度为20 sr.sn=(char *)malloc(20); //为结构体成员申请空间,假设该字段的最大长度为20 sr.hw_ver=0; sr.ext_slot_num=0; cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcon,"prt_manage")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("PrtFunCfg_apply") == cgiFormSuccess) { PortFunConfig(s,t,lpublic,lcon); } fprintf(cgiOut,"<form>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),search(lcon,"prt_manage")); fprintf(cgiOut,"<td width=692 align=right valign=bottom background=/images/di22.jpg>"); { fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=PrtFunCfg_apply style=background-image:url(/images/%s) value=""></td>"\ "<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",search(lpublic,"img_ok"),m,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); } fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_prtsur.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td>",m,search(lpublic,"menu_san"),search(lcon,"prt_sur")); fprintf(cgiOut,"</tr>" "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_prtarp.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>ARP<font><font id=%s> %s<font></a></td></tr>",m,search(lpublic,"menu_san"),search(lpublic,"survey")); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_static_arp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td></tr>",m,search(lpublic,"menu_san"),search(lcon,"prt_static_arp")); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_prtcfg.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td>",m,search(lpublic,"menu_san"),search(lcon,"prt_cfg")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s<font></td>",search(lpublic,"menu_san"),search(lcon,"func_cfg")); /*突出显示*/ fprintf(cgiOut,"</tr>"); //add by sjw 2008-10-9 17:14:37 for subinterface fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_subintf.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td></tr>",m,search(lpublic,"menu_san"),search(lcon,"title_subintf")); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_interface_bindip.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td></tr>",m,search(lpublic,"menu_san"),search(lpublic,"config_interface")); //////INTF //////// fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_all_interface.cgi?UN=%s target=mainFrame class=top><font id=%s>%s<font></a></td></tr>",m,search(lpublic,"menu_san"),search(lcon,"interface")); fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px\">"\ "<table width=390 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=30>"\ "<td width=100px>%s:</td>",search(lcon,"port_no")); fprintf(cgiOut,"<td colspan=3><select name=port_num style=width:50px>"); ccgi_dbus_init(); ret=show_ethport_list(&head,&num); p=head.next; if(p!=NULL) { while(p!=NULL) { pp=p->port.next; while(pp!=NULL) { memset(slot_port,0,10); sprintf(slot_port,"%d-%d",p->slot_no,pp->port_no); if(strcmp(slot_port,s)==0) fprintf(cgiOut,"<option value=%s selected=selected>%s",slot_port,slot_port); else fprintf(cgiOut,"<option value=%s>%s",slot_port,slot_port); pp=pp->next; } p=p->next; } } fprintf(cgiOut,"</select></td>"); //端口号的下拉框显示 /*---------------------------------------------------------------*/ fprintf(cgiOut,"</tr>"\ "<tr height=30>"\ "<td >%s:</td>",search(lpublic,"mode")); fprintf(cgiOut,"<td width=140 colspan=2><select name=port_mode style=width:95px onchange=\"javascript:this.form.submit();\">"); for(i=0;i<3;i++) if(strcmp(port_mode[i],t)==0) /*显示上次选中的port mode*/ fprintf(cgiOut,"<option value=%s selected=selected>%s",port_mode[i],port_mode[i]); else fprintf(cgiOut,"<option value=%s>%s",port_mode[i],port_mode[i]); fprintf(cgiOut,"</select></td>"); fprintf(cgiOut,"<td width=200><font color=red>%s</font></td>", search( lcon,"prt_mod_default")); fprintf(cgiOut,"</tr>"); cgiFormSelectSingle("port_mode", port_mode, 3, &modeChoice, 0); #if 0 if(modeChoice!=0) { fprintf(cgiOut,"<tr height=30>"\ "<td>IP:</td>"\ "<td>" ); fprintf( cgiOut, "<div style=\"border-width:1;border-color:#a5acb2;border-style:solid;width:140;font-size:9pt\">" ); fprintf( cgiOut, "<input type=text name='port_ip1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_ip2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_ip3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_ip4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>",search(lpublic,"ip_error")); fprintf(cgiOut,"</div>"\ "</td>"\ "<td>/</td>" ); fprintf( cgiOut, "<td><div style=\"border-width:1;border-color:#a5acb2;border-style:solid;width:140;font-size:9pt\">" ); fprintf( cgiOut, "<input type=text name='port_mask1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_mask2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_mask3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name='port_mask4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>",search(lpublic,"ip_error")); fprintf( cgiOut, "</div></td>"\ "</tr>"); } #endif if(modeChoice==1) { sprintf( url_temp, "wp_interface_bindip.cgi?UN=%s&PORT=%s&MODE=%s",m,s,"route"); fprintf( cgiOut, "<script type='text/javascript'>\n" ); fprintf( cgiOut, "window.location.href='%s';\n", url_temp ); fprintf( cgiOut, "</script>\n" ); } else if(modeChoice==2) { sprintf( url_temp, "wp_interface_bindip.cgi?UN=%s&PORT=%s&MODE=%s",m,s,"promiscuous"); fprintf( cgiOut, "<script type='text/javascript'>\n" ); fprintf( cgiOut, "window.location.href='%s';\n", url_temp ); fprintf( cgiOut, "</script>\n" ); } fprintf(cgiOut,"<tr>"\ "<td colspan=4><input type=hidden name=encry_PrtFunCfg value=%s></td>",m); fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(slot_port); free(sr.modname); free(sr.sn); free(url_temp); if((ret==0)&&(num>0)) { Free_ethslot_head(&head); } }
int ShowPortalFtpPage(char *m,struct list *lpublic,struct list *lLicense,struct list *lsystem) { int i; cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>Portal</title>"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".usrlis {overflow-x:hidden; overflow:auto; width: 750px; height: 150px; clip: rect( ); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>\n"\ "<body>"); if(cgiFormSubmitClicked("wtp_down") == cgiFormSuccess) { down_portal_file(lpublic,lLicense,lsystem); } fprintf(cgiOut,"<form method=post encType=multipart/form-data>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),"Portal Ftps"); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=155 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=wtp_down style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); fprintf(cgiOut,"<td width=62 align=center><a href=wp_user_portal.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",m,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_user_portal.cgi?UN=%s&portal_id=0' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "captive_Portal") ); //白名单 fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_white_list.cgi?UN=%s&portal_id=0' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "portal_white_list") ); //eag fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_eag_conf.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "eag_title") ); //user manage fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_user_manage.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "user_mng") ); //nas fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_nasid_byvlan.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "nasid_management") ); //multi portal fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_multi_portal.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "multi_portal_management") ); //黑名单 fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_black_list.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m,search(lpublic,"menu_san"), search( lLicense, "portal_black_list") ); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s> %s</font></td>",search(lpublic,"menu_san"),search( lLicense, "portal_ftp")); /*突出显示*/ fprintf(cgiOut,"</tr>"); //multi raidus fprintf( cgiOut, "<tr height=25><td align=left id=tdleft><a href='wp_multi_radius.cgi?UN=%s' target=mainFrame class=top><font id=%s>%s</font></td></tr> \n",m, search(lpublic,"menu_san"),search( lLicense, "multi_radius_management") ); for(i=0;i<3;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px\">"\ "<table width=750 border=0 cellspacing=0 cellpadding=0>"); ///////////////////////// fprintf(cgiOut,"<tr height=30>"\ "<td align=left width=70>%s:</td>",search(lpublic,"web_source")); fprintf(cgiOut,"<td width=330><input type=text name=url size=50 ></td>"); fprintf(cgiOut,"<td></td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30>"\ "<td align=left width=70>%s:</td>",search(lLicense,"file_remote")); fprintf(cgiOut,"<td colspan=2><input type=text name=sourpath size=30></td>"\ "</tr>"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td align=left width=70>%s:</td>",search(lLicense,"file_loc")); fprintf(cgiOut,"<td colspan=2><input type=text name=despath size=30></td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr>"\ "<td align=left width=70>%s:</td>",search(lsystem,"user_na")); fprintf(cgiOut,"<td colspan=2><input type=text name=usr size=30></td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30>"\ "<td align=left width=70>%s:</td>",search(lsystem,"password")); fprintf(cgiOut,"<td colspan=2><input type=password name=pawd size=33.8></td>"\ "</tr>"); fprintf(cgiOut,"<tr>\n"); fprintf(cgiOut,"<td colspan=3>\n"); fprintf(cgiOut,"<div class=usrlis><table width=600 border=0 cellspacing=0 cellpadding=0>\n"); FILE *pp; char buff[128]; memset(buff,0,128); char *temf=(char *)malloc(128); memset(temf,0,128); sprintf(temf,"ls -l %s|grep ^d|grep -v -i cvs|awk '{print $9}'",TEMPFILEZ); pp=popen(temf,"r"); if(pp==NULL) fprintf(cgiOut,"error open the pipe"); else { fgets( buff, sizeof(buff), pp ); do { fprintf(cgiOut,"<tr><td>"); fprintf(cgiOut,"<br>"); fprintf(cgiOut,"%s",buff); fprintf(cgiOut,"</td>"); if(strlen(buff)!=0) { fprintf(cgiOut,"<td><a href=wp_pftp_deal.cgi?UN=%s&TYPE=1&FILE=%s>%s</a></td>\n",m,buff,search(lpublic,"log_scan")); fprintf(cgiOut,"<td><a href=wp_pftp_deal.cgi?UN=%s&TYPE=2&FILE=%s>%s</a></td>\n",m,buff,search(lpublic,"delete")); } fprintf(cgiOut,"</tr>"); fgets( buff, sizeof(buff), pp ); }while( !feof(pp) ); } pclose(pp); free(temf); fprintf(cgiOut,"</table></div>\n"); fprintf(cgiOut,"</td></tr>\n"); ///////////////// fprintf(cgiOut,"<tr>"\ "<td colspan=2><input type=hidden name=encry_newwtp value=%s></td>",m); fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); return 0; }
int ShowLogconfPage(struct list *lcontrol,struct list *lpublic) { char *encry=(char *)malloc(BUF_LEN); char *str; // FILE *pp; // char buff[128]; //读取popen中的块大小 char file_name[128]; //读取文件 memset(file_name,0,128); char version_encry[BUF_LEN]; char addn[N]; ST_IP_CONTENT ip; memset(&ip,0,sizeof(ip)); /*下拉框内容1*/ char * select=(char*)malloc(256); memset(select,0,256); struct substringz s_head,*sq; int subnum=0,retflag=-1; ST_LOG_KEY logkey; memset(&logkey,0,sizeof(logkey)); int i = 0; cgiFormStringNoNewlines("Nb", file_name, 128); if(cgiFormSubmitClicked("version") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } strcpy(addn,str); memset(version_encry,0,BUF_LEN); /*清空临时变量*/ } else { cgiFormStringNoNewlines("encry_version", version_encry, BUF_LEN); str=dcryption(version_encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } strcpy(addn,str); memset(version_encry,0,BUF_LEN); /*清空临时变量*/ } cgiFormStringNoNewlines("encry_version",version_encry,BUF_LEN); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "<style type=text/css>"\ ".usrlis {overflow-x:hidden;overflow:auto; width: 350px; height: 100px; clip: rect( ); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>"\ "<script language=javascript src=/ip.js>"\ "</script>"\ "<script type=\"text/javascript\">"\ "function log_ip()"\ "{"\ "var bind_list = new Array();"\ "var ip1 = document.all.gate_ip1.value;"\ "var ip2 = document.all.gate_ip2.value;"\ "var ip3 = document.all.gate_ip3.value;"\ "var ip4 = document.all.gate_ip4.value;"\ "var pocol = document.all.tcp.value;"\ "var port = document.all.portid.value;"\ "var ip=ip1+\".\"+ip2+\".\"+ip3+\".\"+ip4;"\ "if(ip1==\"\"||ip2==\"\"||ip3==\"\"||ip4==\"\") {"\ "alert(\"%s\");"\ "return;"\ "}"\ "var value = pocol + \"(\" + '\"' +ip + '\"' + \" port(\" + port + \"))\" ;"\ "var number=document.all.select.options.length;"\ "if(number > 7)"\ "{"\ "alert(\"%s\");"\ "return ;"\ "}"\ "else{"\ "var lenz=document.all.select.options.length;"\ "if(lenz==0)"\ "{"\ "document.all.select.options.add("\ "new Option(value,value,false,false)"\ ");"\ "}"\ "else{"\ "var tflag=0;"\ "for(var i=0; i<document.all.select.options.length; i++)"\ "{"\ "if( value == document.all.select.options[i].value)"\ "{"\ "alert(\"%s\");"\ "tflag = 1;"\ "document.all.gate_ip1.value=\"\";"\ "document.all.gate_ip2.value=\"\";"\ "document.all.gate_ip3.value=\"\";"\ "document.all.gate_ip4.value=\"\";"\ "return;"\ "}"\ "}"\ "if(tflag==0)"\ "{"\ "document.all.select.options.add("\ "new Option(value,value,false,false)"\ ");"\ "document.all.gate_ip1.value=\"\";"\ "document.all.gate_ip2.value=\"\";"\ "document.all.gate_ip3.value=\"\";"\ "document.all.gate_ip4.value=\"\";"\ "}"\ "}"\ "}"\ "document.all.gate_ip1.value=\"\";"\ "document.all.gate_ip2.value=\"\";"\ "document.all.gate_ip3.value=\"\";"\ "document.all.gate_ip4.value=\"\";"\ "}",search(lcontrol,"ip_null"),search(lpublic,"log_max"),search(lpublic,"log_design")); fprintf(cgiOut,"function rm_ip()"\ "{"\ "for(var i=0; i<document.all.select.options.length; i++){"\ "if(document.all.select.options[i].selected==true){"\ "var optionIndex ;"\ "optionIndex = i;"\ "if(optionIndex!=null){"\ "document.all.select.remove(optionIndex);"\ "}"\ "}"\ "}"\ "}"); fprintf(cgiOut,"function mysubmit()"\ "{"\ "var bind_ip=new Array();"\ "var len=document.all.select.options.length;"\ "if(len==0)"\ "{"\ "document.all.ip_s1.value=\"\";"\ "}"\ "else{"\ "for(var i=0; i<len; i++)"\ "{"\ "if(i==0)"\ "{"\ "document.all.ip_s1.value = document.all.select.options[i].value ;"\ "}"\ "else{"\ "document.all.ip_s1.value = document.all.ip_s1.value + \";\" + document.all.select.options[i].value ;"\ "}"\ "}"\ "document.all.ip_s1.value = document.all.ip_s1.value + \";\" "\ "}"\ "}"); fprintf(cgiOut,"</script>"\ "<body>"); if(cgiFormSubmitClicked("version") == cgiFormSuccess) { modify_systemip(lpublic); } fprintf(cgiOut,"<form method=post onsubmit=\"return mysubmit()\">"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"); //111111111111111111111 fprintf(cgiOut,"<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),search(lpublic,"log_info")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); // 鉴权 fprintf(cgiOut,"<input type=hidden name=UN value=%s />",encry); fprintf(cgiOut,"<input type=hidden name=Nb value=%s />",file_name); //取到传送的值 fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"); //22222222222222222222 fprintf(cgiOut,"<tr>"); if(checkuser_group(addn)==0) /*管理员*/ { fprintf(cgiOut,"<td width=62 align=center><input id=but type=submit name=version style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); } if(cgiFormSubmitClicked("version") != cgiFormSuccess) fprintf(cgiOut,"<td width=62 align=left><a href=wp_log_info.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_log_info.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",version_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); //22222222222222222222222222 fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"); fprintf(cgiOut,"<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"); //333333333333333333333 fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"); //44444444444444444444 fprintf(cgiOut,"<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"); fprintf(cgiOut,"<tr>"); //次内 fprintf(cgiOut,"<td><table width=120 border=0 cellspacing=0 cellpadding=0>"); //555555555555555 fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if(cgiFormSubmitClicked("version") != cgiFormSuccess) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_log_mod.cgi?UN=%s&Nb=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,file_name,search(lpublic,"menu_san"),search(lpublic,"log_modrule")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_log_mod.cgi?UN=%s&Nb=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",version_encry,file_name,search(lpublic,"menu_san"),search(lpublic,"log_modrule")); fprintf(cgiOut,"</tr>"); } fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lpublic,"log_addip")); /*突出显示*/ fprintf(cgiOut,"</tr>"); for(i=0;i<7;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"); fprintf(cgiOut,"<table width=600 border=0 cellspacing=0 cellpadding=0>"); //js add and delete syslog info fprintf(cgiOut,"<tr >"\ "<td>"); fprintf(cgiOut,"<select name=select multiple=\"multiple\" size=\"6\" style=\"width:250px\">"); /////deal with memset(&logkey,0,sizeof(logkey)); find_log_node(XML_FPATH, NODE_DES, NODE_ATT, L_IP, NODE_CONTENT,&logkey); string_linksep_list(&s_head, &subnum,logkey.key,";"); sq=s_head.next; while(sq != NULL) { fprintf(cgiOut,"<option value='%s'>%s</option>",sq->substr,sq->substr); sq=sq->next; } if((retflag==0 )&& (subnum > 0)) Free_substringz_all(&s_head); /////////end fprintf(cgiOut,"</select></td>"); fprintf(cgiOut,"<td colspan=2>\n"); fprintf(cgiOut,"<table>\n"); fprintf(cgiOut,"<tr>\n"); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<input type=button name=bind_add id=bind_add onclick=log_ip() style=\"width:50px\" value=\"%s\"><font color=red>(0-8)</font>",search(lcontrol, "dhcp_add")); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=10><td colspan=2></td></tr>\n"); fprintf(cgiOut,"<tr>\n"); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<input type=button name=ranges_rm id=ranges_rm onclick=rm_ip() style=\"width:50px\" value=\"%s\">",search(lcontrol, "dhcp_rm")); fprintf(cgiOut,"</td></tr>\n"); fprintf(cgiOut,"</table>\n"); fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"</tr>\n"); /*分割线*/ fprintf(cgiOut, "<tr><td colspan=3><hr width=100%% size=1 color=#fff align=center noshade />"\ "</td></tr>" ); fprintf(cgiOut,"<tr height=7><td colspan=3></td></tr>"); fprintf(cgiOut,"<tr ><td bgcolor=#FFFFFF width=250>"); fprintf(cgiOut, "<label class=\"col1\" for=\"Package.DestinationAddress.Single\">%s</label></td><td colspan=2> \n", search(lpublic,"log_port") ); fprintf(cgiOut, "<select style=width:140px name=tcp>\n" ); fprintf(cgiOut,"<option value=udp>UDP</option>"); fprintf(cgiOut,"<option value=tcp>TCP</option>"); fprintf(cgiOut, "</select>\n" ); fprintf(cgiOut,"</td></tr>"); fprintf(cgiOut,"<tr height=7><td></td></tr>"); fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td width=250>%s</td>",search(lpublic,"log_ip")); fprintf(cgiOut,"<td colspan=4 width=140>"\ "<div style=\"border-width:1;border-color:#a5acb2;border-style:solid;width:140;font-size:9pt\">"); fprintf(cgiOut,"<input type=text name=gate_ip1 value=\"\" maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name=gate_ip2 value=\"\" maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name=gate_ip3 value=\"\" maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.",search(lpublic,"ip_error")); fprintf(cgiOut,"<input type=text name=gate_ip4 value=\"\" maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>",search(lpublic,"ip_error")); fprintf(cgiOut,"</div></td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=7><td></td></tr>"); fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td width=250>%s:(1--65535 || 514)</td>",search(lpublic,"log_desport")); fprintf(cgiOut,"<td><input type=text name=portid style=width:140px value=514></td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr>"); if(cgiFormSubmitClicked("version") != cgiFormSuccess) { fprintf(cgiOut,"<td colspan=2><input type=hidden name=encry_version value=%s></td>",encry); } else if(cgiFormSubmitClicked("version") == cgiFormSuccess) { fprintf(cgiOut,"<td colspan=2><input type=hidden name=encry_version value=%s></td>",version_encry); } fprintf(cgiOut,"<td><input type=hidden name=ip_s1 value=\"%s\"></td>",select); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=15 background=/images/di999.jpg> </td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"</table></td>"); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"); fprintf(cgiOut,"</div>"\ "</form>"\ "</body>"); fprintf(cgiOut,"</html>"); free(encry); free(select); return 0; }
int ShowAddBlacklistPage(struct list *lpublic,struct list *lcon) { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *str; char fdb_encry[BUF_LEN]; char vlanid[N],portno[N],trunk[N],showtype[N]; int i,ret; ETH_SLOT_LIST head,*p; ETH_PORT_LIST *pp; int result,p_num; char paramalert[128]; memset(paramalert,0,128); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("submit_del") != cgiFormSuccess)) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } //memset(fdb_encry,0,BUF_LEN); /*清空临时变量*/ } memset(fdb_encry,0,BUF_LEN); /*清空临时变量*/ cgiFormStringNoNewlines("fdb_encry",fdb_encry,BUF_LEN); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcon,"fdb_man")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("submit_del") == cgiFormSuccess) //删除黑名单fdb { memset(vlanid,0,N); memset(portno,0,N); memset(trunk,0,N); memset(showtype,0,N); cgiFormStringNoNewlines("showtype",showtype,N); if(strcmp(showtype,"1")==0) { memset(vlanid,0,N); cgiFormStringNoNewlines("vlanid",vlanid,N); if(strcmp(vlanid,"")!=0) { ret=-1; ccgi_dbus_init(); ret=delete_fdb_by_vid(vlanid); switch(ret) { case -5: ShowAlert(search(lcon,"vlan_out_range")); break; case -1: ShowAlert(search(lpublic,"oper_fail")); break; case NPD_FDB_ERR_VLAN_NONEXIST: ShowAlert(search(lcon,"vlan_not_exist")); break; case 0 : ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } else { memset(paramalert,0,128); sprintf(paramalert,"Vlan id %s",search(lpublic,"param_null")); ShowAlert(paramalert); } } if(strcmp(showtype,"2")==0) { memset(trunk,0,N); cgiFormStringNoNewlines("trunkid",trunk,N); if(strcmp(trunk,"")!=0) { ret=-1; ccgi_dbus_init(); ret=delete_fdb_by_trunk(trunk); switch(ret) { case -1: ShowAlert(search(lpublic,"oper_fail")); break; case 0 : ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } else { memset(paramalert,0,128); sprintf(paramalert,"Trunk id %s",search(lpublic,"param_null")); ShowAlert(paramalert); } } if(strcmp(showtype,"3")==0) { memset(portno,0,N); ccgi_dbus_init(); cgiFormStringNoNewlines("portno",portno,N); ret=-1; ret=delete_fdb_by_port(portno); switch(ret) { case -1: ShowAlert(search(lpublic,"oper_fail")); break; case 0 : ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>FDB</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_fdb style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("submit_del") != cgiFormSuccess)) fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",fdb_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("submit_del") != cgiFormSuccess)) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_show_fdb.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"show_fdb")); /*突出显示*/ fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_agingtime.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_age")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_static_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> FDB</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_sta")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_blacklist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_bla")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_fdb_limit.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_limit")); fprintf(cgiOut,"</tr>"); //add new web page for delete fdb fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s FDB</font></td>",search(lpublic,"menu_san"),search(lcon,"del")); fprintf(cgiOut,"</tr>"); } else //if(cgiFormSubmitClicked("submit_fdb") == cgiFormSuccess) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_show_fdb.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"show_fdb")); /*突出显示*/ fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_agingtime.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_age")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_static_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> FDB</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_sta")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_blacklist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_bla")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_fdb_limit.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_limit")); fprintf(cgiOut,"</tr>"); //add new web page for delete fdb fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s FDB</font></td>",search(lpublic,"menu_san"),search(lcon,"del")); fprintf(cgiOut,"</tr>"); } for(i=0;i<4;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=700 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td align=left valign=top style=\"padding-top:18px\">"); fprintf(cgiOut,"<table border=0 cellspacing=0 cellpadding=0>"); //add blacklist fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td><input type=\"radio\" name=\"showtype\" value=\"1\" checked>%s:</td>",search(lcon,"vID")); fprintf(cgiOut,"<td width=140><input type=text name=vlanid size=21 maxLength=4></td>"\ "<td><font color=red>(1--4094)</font></td>"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td><input type=\"radio\" name=\"showtype\" value=\"2\">%s:</td>","Trunk ID"); fprintf(cgiOut,"<td width=140><input type=text name=trunkid size=21 maxLength=3></td>"\ "<td><font color=red>%s</font></td>","(1--127)"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td><input type=\"radio\" name=\"showtype\" value=\"3\" >%s:</td>",search(lcon,"_port")); fprintf(cgiOut,"<td width=70><select name=portno style=width:138px>"); ccgi_dbus_init(); ///////////////不用此函数,统统修改为 show_eth_port_list之类的 result=show_ethport_list(&head,&p_num); p=head.next; if(p!=NULL) { while(p!=NULL) { pp=p->port.next; while(pp!=NULL) { if(p->slot_no!=0) { fprintf(cgiOut,"<option value=%d/%d>%d/%d</option>",p->slot_no,pp->port_no,p->slot_no,pp->port_no); } pp=pp->next; } p=p->next; } } /////////////// fprintf(cgiOut,"</select></td>"\ "<td></td>"); fprintf(cgiOut,"</table>"); fprintf(cgiOut,"<table border=0 cellspacing=0 cellpadding=0 style=\"padding-top:18px\">"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td width=60><input type=submit style= height:22px;width=60 border=0 name=submit_del value=\"%s\"></td>",search(lcon,"del")); fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</td>"\ "</tr>"\ "<tr>"); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("submit_del") != cgiFormSuccess)) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",encry); } else //if(cgiFormSubmitClicked("submit_fdb") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",fdb_encry); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); if((result==0)&&(p_num>0)) { Free_ethslot_head(&head); } return 0; }
int ShowIGMPPage(struct list *lpublic,struct list *lcon) { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *str=NULL; char igmp_encry[BUF_LEN]; int i; int retu=0; char * CheckUsr=(char *)malloc(10); memset(CheckUsr,0,10); if(cgiFormSubmitClicked("submit_igmp") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } //memset(igmp_encry,0,BUF_LEN); /*清空临时变量*/ } memset(igmp_encry,0,BUF_LEN); /*清空临时变量*/ cgiFormStringNoNewlines("igmp_encry",igmp_encry,BUF_LEN); cgiFormStringNoNewlines("CheckUsr",CheckUsr,10); if(strcmp(CheckUsr,"")!=0) retu=atoi(CheckUsr); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>","IGMP SNOOPING"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("submit_igmp") != cgiFormSuccess) { retu=checkuser_group(str); } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>IGMP SNOOPING</font></td>"); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_igmp style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_igmp") != cgiFormSuccess) fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",igmp_encry ,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if(cgiFormSubmitClicked("submit_igmp") != cgiFormSuccess) { if(retu==0) /*管理员*/ { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font><font id=yingwen_san> IGMP</font></td>",search(lpublic,"menu_san"),search(lcon,"show")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_igmp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> IGMP</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"config")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font><font id=yingwen_san> IGMP</font></td>",search(lpublic,"menu_san"),search(lcon,"show")); fprintf(cgiOut,"</tr>"); } } else if(cgiFormSubmitClicked("submit_igmp") == cgiFormSuccess) { if(retu==0) /*管理员*/ { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font><font id=yingwen_san> IGMP</font></td>",search(lpublic,"menu_san"),search(lcon,"show")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_igmp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> IGMP</font></a></td>",igmp_encry,search(lpublic,"menu_san"),search(lcon,"config")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font><font id=yingwen_san> IGMP</font></td>",search(lpublic,"menu_san"),search(lcon,"show")); fprintf(cgiOut,"</tr>"); } } for(i=0;i<8;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=700 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=35>"); fprintf(cgiOut,"<td align=left id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px;padding-left:0px;padding-top:0px\">%s</td>",search(lcon,"igmp_infor")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td align=left valign=top style=\"padding-top:18px\">"); fprintf(cgiOut,"<table width=500 border=0 cellspacing=0 cellpadding=0>"); ccgi_dbus_init(); fprintf(cgiOut,"<tr height=25>"\ "<td>%s</td>"\ "</tr>",search(lcon,"igmp_time")); int ret = -1; ret = show_igmp_snp_time_interval(); if(ret == -2) { fprintf(cgiOut,"<tr><td><font color=red>%s</font></td></tr>",search(lcon,"igmp_no_sta")); } else if(ret == -1) { fprintf(cgiOut,"<tr><td><font color=red>%s</font></td></tr>",search(lcon,"show_err")); } /* fprintf(cgiOut,"<tr height=25>"\ "<td>%s</td>"\ "</tr>",search(lcon,"igmp_group_count")); if(show_igmp_snp_group_count()!=0) { fprintf(cgiOut,"<tr><td><font color=red>%s</font></td></tr>",search(lcon,"show_err")); } */ int vlan_count=0; ret = iShow_igmp_vlan_count(&vlan_count); if(ret == 1) { fprintf(cgiOut,"<tr><td><font color=red>%s</font></td></tr>",search(lcon,"igmp_no_sta")); } else if(ret == 0) { fprintf(cgiOut,"<tr>"\ "<td id=td1>%s</td>",search(lcon,"igmp_vlan_count")); fprintf(cgiOut,"<td id=td2>%d</td>"\ "</tr>",vlan_count); } else { fprintf(cgiOut,"<tr><td><font color=red>%s</font></td></tr>",search(lcon,"show_err")); } fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</td>"\ "</tr>"\ "<tr>"); if(cgiFormSubmitClicked("submit_igmp") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=igmp_encry value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } else if(cgiFormSubmitClicked("submit_igmp") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=igmp_encry value=%s></td>",igmp_encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); free(CheckUsr); return 0; }
int dhcp_relayShowDhcrelayPage(struct list *lcontrol,struct list *lpublic) { char *encry=(char *)malloc(BUF_LEN); char *str; char dhcp_encry[BUF_LEN]; char addn[N]; int i = 0; int cl=1; char vip[32] = {0}; int ret = -1; unsigned int node_num = 0; unsigned int option = 0; char getupname[20] = {0}; char getdname[20] = {0}; char getip[32] = {0}; struct dhcp_relay_show_st rhead,*rq; memset(&rhead,0,sizeof(struct dhcp_relay_show_st)); if(cgiFormSubmitClicked("dhcp_relay") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } strcpy(addn,str); memset(dhcp_encry,0,BUF_LEN); /*清空临时变量*/ } else { cgiFormStringNoNewlines("encry_dhcp", dhcp_encry, BUF_LEN); str=dcryption(dhcp_encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } strcpy(addn,str); memset(dhcp_encry,0,BUF_LEN); /*清空临时变量*/ } instance_parameter *paraHead2 = NULL; instance_parameter *p_q = NULL; list_instance_parameter(¶Head2, SNMPD_SLOT_CONNECT); char allslotid[10] = {0}; int allslot_id = 0; cgiFormStringNoNewlines("allslotid",allslotid,sizeof(allslotid)); allslot_id = atoi(allslotid); if(0 == allslot_id) { for(p_q=paraHead2;(NULL != p_q);p_q=p_q->next) { allslot_id = p_q->parameter.slot_id; break; } } cgiFormStringNoNewlines("encry_dhcp",dhcp_encry,BUF_LEN); cgiFormStringNoNewlines("UPNAME",getupname,20); cgiFormStringNoNewlines("DNAME",getdname,20); cgiFormStringNoNewlines("IP",getip,32); int get_ip = 0; int result2 = -1; if ((strcmp(getupname,"") != 0) && (strcmp(getdname,"") != 0) && (strcmp(getip,"") != 0)) { get_ip = strtoul(getip,0,10); result2 = ccgi_set_interface_ip_relay(getupname, getdname, get_ip, 0,allslot_id); } if(cgiFormSubmitClicked("dhcp_relay") == cgiFormSuccess) { dhcp_relay_status(lcontrol,lpublic,addn); dhcp_relay_config(addn,lpublic); } cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>\n"\ "<style type=text/css>\n"\ ".a3{width:30;border:0; text-align:center}"\ "</style>\n"\ "<style type=text/css>\n"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".dhcplis {overflow-x:hidden; overflow:auto; width: 750px; height: 300px; clip: rect( ); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>\n"\ "</head>\n"\ "<script src=/ip.js>\n"\ "</script>\n"\ "<body>"); fprintf(cgiOut,"<form method=post>"); fprintf(cgiOut,"<div align=center>\n"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>\n"\ "<tr>\n"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>\n"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>\n"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),"DHCP"); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>\n"\ "<tr>"); if(checkuser_group(addn)==0) /*管理员*/ { fprintf(cgiOut,"<td width=62 align=center><input id=but type=submit name=dhcp_relay style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); } else { if(cgiFormSubmitClicked("dhcp_relay") != cgiFormSuccess) { fprintf(cgiOut,"<td width=62 align=left><a href=wp_dhcpview.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_ok")); } else { fprintf(cgiOut,"<td width=62 align=left><a href=wp_dhcpview.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",dhcp_encry,search(lpublic,"img_ok")); } } if(cgiFormSubmitClicked("dhcp_relay") != cgiFormSuccess) { fprintf(cgiOut,"<td width=62 align=left><a href=wp_dhcpsumary.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); } else { fprintf(cgiOut,"<td width=62 align=left><a href=wp_dhcpsumary.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",dhcp_encry,search(lpublic,"img_cancel")); } fprintf(cgiOut,"</tr>\n" "</table>"); fprintf(cgiOut,"</td>\n"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>\n"\ "</tr>\n"\ "<tr>\n"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>\n"\ "<tr>\n"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>\n"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>\n"\ "<tr height=4 valign=bottom>\n"\ "<td width=120> </td>\n"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>\n"\ "</tr>\n"\ "<tr>\n"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>\n"\ "<tr height=25>\n"\ "<td id=tdleft> </td>\n"\ "</tr>"); if(cgiFormSubmitClicked("dhcp_relay") != cgiFormSuccess) { fprintf(cgiOut,"<tr height=26>\n"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s<font></a></td>",search(lpublic,"menu_san"),search(lcontrol,"dhcp_relay")); /*突出显示*/ fprintf(cgiOut,"</tr>"); } else if(cgiFormSubmitClicked("dhcp_relay") == cgiFormSuccess) { fprintf(cgiOut,"<tr height=26>\n"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s<font></a></td>",search(lpublic,"menu_san"),search(lcontrol,"dhcp_relay")); /*突出显示*/ fprintf(cgiOut,"</tr>"); } for(i=0;i<19;i++) { fprintf(cgiOut,"<tr height=25>\n"\ "<td id=tdleft> </td>\n"\ "</tr>"); } fprintf(cgiOut,"</table>\n"\ "</td>\n"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">\n"); fprintf(cgiOut,"<table width=500 border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td>%s </td>","Slot ID:"); fprintf(cgiOut,"<td><select name=allslot onchange=slotid_change(this)>"); for(p_q=paraHead2;(NULL != p_q);p_q=p_q->next) { if(p_q->parameter.slot_id == allslot_id) { fprintf(cgiOut,"<option value=\"%d\" selected>%d</option>",p_q->parameter.slot_id,p_q->parameter.slot_id); } else { fprintf(cgiOut,"<option value=\"%d\">%d</option>",p_q->parameter.slot_id,p_q->parameter.slot_id); } } fprintf(cgiOut,"</select></td>"); fprintf(cgiOut,"</tr>"); fprintf( cgiOut,"<script type=text/javascript>\n"); fprintf( cgiOut,"function slotid_change( obj )\n"\ "{\n"\ "var slotid = obj.options[obj.selectedIndex].value;\n"\ "var url = 'wp_dhcrelay.cgi?UN=%s&allslotid='+slotid;\n"\ "window.location.href = url;\n"\ "}\n", encry); fprintf( cgiOut,"</script>\n" ); free_instance_parameter_list(¶Head2); fprintf(cgiOut,"<input type=hidden name=allslotid value=\"%d\">",allslot_id); ret = ccgi_show_dhcp_relay(&rhead,&node_num,&option,allslot_id); fprintf(cgiOut,"<tr style='padding-top:10px'>\n"\ "<td align=left>%s:</td>",search(lcontrol,"dhcrelay_stat")); fprintf(cgiOut,"<td align=left width=400>\n"\ "<select name=State>"); if (option == 1) { fprintf(cgiOut,"<option value=\"start\" selected=\"selected\">start</option>\n"\ "<option value=\"stop\" >stop</option>"); } else { fprintf(cgiOut,"<option value=\"start\">start</option>\n"\ "<option value=\"stop\" selected=\"selected\">stop</option>"); } fprintf(cgiOut,"</select>\n"\ "</td>\n"\ "</tr>"); fprintf(cgiOut,"<tr><td colspan=2> </td></tr>"); struct flow_data_list * alldata = NULL; struct flow_data_list * temp = NULL; struct flow_data_list * tempz = NULL; intflib_getdata(&alldata); temp = alldata; tempz = alldata; //local interface fprintf(cgiOut,"<tr height=30>\n"\ "<td align=left>%s:</td>", search(lpublic,"dhcp_clientname")); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<select name=localvname style='width:100px;height:auto'>\n"); for(temp; temp; temp = temp->next) { if(strncmp(temp->ltdata.ifname,"radio",5)==0 || strncmp(temp->ltdata.ifname,"pimreg",6)==0 || strncmp(temp->ltdata.ifname,"sit0",4)==0 || strncmp(temp->ltdata.ifname,"lo",2)==0) { continue; } fprintf(cgiOut,"<option value='%s'>%s</option>",temp->ltdata.ifname,temp->ltdata.ifname); } fprintf(cgiOut,"</select></td></tr>"); //remote interface fprintf(cgiOut,"<tr height=30>\n"\ "<td align=left>%s:</td>", search(lpublic,"dhcp_servername")); fprintf(cgiOut,"<td>\n"); fprintf(cgiOut,"<select name=remotevname style='width:100px;height:auto'>\n"); for(tempz; tempz; tempz = tempz->next) { if(strncmp(tempz->ltdata.ifname,"radio",5)==0 || strncmp(tempz->ltdata.ifname,"pimreg",6)==0 || strncmp(tempz->ltdata.ifname,"sit0",4)==0 || strncmp(tempz->ltdata.ifname,"lo",2)==0) { continue; } fprintf(cgiOut,"<option value='%s'>%s</option>",tempz->ltdata.ifname,tempz->ltdata.ifname); } fprintf(cgiOut,"</select></td></tr>"); intflib_memfree(&alldata); //remote server ip fprintf(cgiOut,"<tr height=30>\n"\ "<td align=left>%s:</td>", search(lcontrol, "dhcrelay_addr")); fprintf(cgiOut,"<td>\n"\ "<div style=\"border-width:1;border-color:#a5acb2;border-style:solid;width:140;font-size:9pt\">\n"\ "<input type=text name=serv_ip1 value=\"\" id=serv_ip1 maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.</input>",search(lpublic,"ip_error")); fprintf(cgiOut, "<input type=text name=serv_ip2 value=\"\" id=serv_ip2 maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.</input>",search(lpublic,"ip_error")); fprintf(cgiOut, "<input type=text name=serv_ip3 value=\"\" id=serv_ip3 maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()>.</input>",search(lpublic,"ip_error")); fprintf(cgiOut, "<input type=text name=serv_ip4 value=\"\" id=serv_ip4 maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c()></input>", search(lpublic,"ip_error")); fprintf(cgiOut, "</div></td></tr>\n"); fprintf(cgiOut,"<tr><td colspan=2></td></tr>\n"); fprintf(cgiOut,"<tr><td colspan=2 id=sec style=\"border-bottom:2px solid #53868b\">%s</td></tr>\n",search(lcontrol,"intf_list")); fprintf(cgiOut,"<tr>\n"\ "<td colspan=2 style=\"padding-top:20px\">\n"\ "<div class=dhcplis>\n"\ "<table width=750 border=1 frame=below rules=rows cellspacing=0 bordercolor=#cccccc cellpadding=0>"); fprintf(cgiOut,"<tr>\n"\ "<th width=200 align=center style=font-size:14px>%s</th>",search(lpublic,"dhcp_servername")); fprintf(cgiOut,"<th width=200 align=center style=font-size:14px>%s</th>",search(lpublic,"dhcp_clientname")); fprintf(cgiOut,"<th width=200 align=center style=font-size:14px>%s</th>",search(lcontrol,"ip_addr")); fprintf(cgiOut,"<th width=150 align=center style=font-size:14px></th>"); fprintf(cgiOut,"</tr>"); if ((ret == 1)&&(node_num>0)) { rq = rhead.next; while (rq != NULL) { memset(vip,0,32); INET_NTOA_T(rq->ipaddr, vip); fprintf(cgiOut,"<tr bgcolor=%s>",setclour(cl)); fprintf(cgiOut,"<td style=font-size:14px align=center>%s</td>",rq->downifname); fprintf(cgiOut,"<td style=font-size:14px align=center>%s</td>",rq->upifname); fprintf(cgiOut,"<td style=font-size:14px align=center>%s</td>",vip); if (strcmp(encry,"") == 0) { strcpy(encry,dhcp_encry); } fprintf(cgiOut,"<td style=font-size:14px align=center>\n"\ "<a id=link href=wp_dhcrelay.cgi?UN=%s&UPNAME=%s&DNAME=%s&IP=%d target=mainFrame>%s</a></td>",encry,rq->upifname,rq->downifname,rq->ipaddr,search(lpublic,"delete")); fprintf(cgiOut,"</tr>"); rq = rq->next; cl=!cl; } } if (( ret == 1)&&(node_num>0)) { Free_dhcprelay_info(&rhead); } fprintf(cgiOut,"</table></div></td></tr>"); fprintf(cgiOut,"<tr>"); if(cgiFormSubmitClicked("dhcp_relay") != cgiFormSuccess) { fprintf(cgiOut,"<td colspan=2><input type=hidden name=encry_dhcp value=%s></td>",encry); } else if(cgiFormSubmitClicked("dhcp_relay") == cgiFormSuccess) { fprintf(cgiOut,"<td colspan=2><input type=hidden name=encry_dhcp value=%s></td>",dhcp_encry); } fprintf(cgiOut,"</tr>\n"\ "<tr>\n"\ "<td colspan=2 > </td>\n"\ "</tr>\n"\ "<tr>"); fprintf(cgiOut,"</tr></table>"); fprintf(cgiOut,"</td>\n"\ "</tr>\n"\ "<tr height=4 valign=top>\n"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>\n"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>\n"\ "</tr>\n"\ "</table>\n"\ "</td>\n"\ "<td width=15 background=/images/di999.jpg> </td>\n"\ "</tr>\n"\ "</table></td>\n"\ "</tr>\n"\ "<tr>\n"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>\n"\ "<td align=left valign=top background=/images/di777.jpg> </td>\n"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>\n"\ "</tr>\n"\ "</table>\n"\ "</div>\n"\ "</form>\n"\ "</body>\n"\ "</html>"); free(encry); return 0; }
int ShowEbrconPage(char *m,char *n,char * instance_id,char *pn,instance_parameter *ins_para,struct list *lpublic,struct list *lwlan) { FILE *fp = NULL; int i = 0,status = -1; char BindInter[20] = { 0 }; char *endptr = NULL; char *retu = NULL; int ebrID = 0; int result = 0; DCLI_EBR_API_GROUP *ebrinfo = NULL; EBR_IF_LIST *head = NULL; ebrID= strtoul(n,&endptr,10); /*char转成int,10代表十进制*/ cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>Wtp</title>"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "</head>"); if(cgiFormSubmitClicked("ebrcon_apply") == cgiFormSuccess) { if(ins_para) { config_ebr(ins_para,ebrID,lpublic,lwlan); } } fprintf(cgiOut,"<body>"\ "<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>EBR</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=155 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=ebrcon_apply style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); fprintf(cgiOut,"<td width=62 align=center><a href=wp_ebrlis.cgi?UN=%s&PN=%s&INSTANCE_ID=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",m,pn,instance_id,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font><font id=yingwen_san> EBR</font></td>",search(lpublic,"menu_san"),search(lpublic,"config")); /*突出显示*/ fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_ebrnew.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> EBR</font></a></td>",m,search(lpublic,"menu_san"),search(lpublic,"create")); fprintf(cgiOut,"</tr>"); for(i=0;i<10;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px\">"\ "<table width=620 border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr>"\ "<td id=ins_style>%s:%s</td>",search(lpublic,"instance"),instance_id); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr>"\ "<td>"); status = system("ebr_bind_inter.sh"); fprintf(cgiOut,"<table width=620 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=30 align=left>"\ "<td id=thead5 align=left>%s EBR %d</td>",search(lpublic,"configure"),ebrID); fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr><td align=center style=\"padding-left:20px\">"); fprintf(cgiOut,"<table width=620 border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr height=30>"\ "<td>EBR %s:</td>",search(lwlan,"state")); fprintf(cgiOut,"<td align=left><select name=ebr_use id=ebr_use style=width:100px>"\ "<option value=>"\ "<option value=disable>disable"\ "<option value=enable>enable"\ "</select></td>"\ "<td align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"ebr_able")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30 valign=top>"); fprintf(cgiOut,"<td width=150>%s:</td>",search(lwlan,"bind_interface")); fprintf(cgiOut,"<td width=100 align=left>"); if(status==0) { fprintf(cgiOut,"<select name=bind_interface id=bind_interface multiple=multiple size=4 style=width:100px>"); if((fp=fopen("/var/run/apache2/ebr_bind_inter.tmp","r"))==NULL) /*以只读方式打开资源文件*/ { ShowAlert(search(lpublic,"error_open")); } else { memset(BindInter,0,sizeof(BindInter)); retu=fgets(BindInter,20,fp); while(retu!=NULL) { if(0 == strncmp(retu,"ve",2)) { char *temp_ve = NULL; char temp_ve1[20]; temp_ve = strchr(retu,'@'); if(temp_ve) { memset(temp_ve1,0,sizeof(temp_ve1)); strncpy(temp_ve1,retu,temp_ve-retu); memset(retu,0,20); strcpy(retu,temp_ve1); } } fprintf(cgiOut,"<option value=%s>%s",retu,retu); memset(BindInter,0,sizeof(BindInter)); retu=fgets(BindInter,20,fp); } fclose(fp); } fprintf(cgiOut,"</select>"); } else { fprintf(cgiOut,"%s",search(lpublic,"exec_shell_fail")); } fprintf(cgiOut,"</td>"); fprintf(cgiOut,"<td width=370 align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"ebr_bind")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30 valign=top style=\"padding-top:5px\">"); fprintf(cgiOut,"<td>%s:</td>",search(lwlan,"set_uplink_interface")); fprintf(cgiOut,"<td align=left>"); fprintf(cgiOut,"<select name=set_uplink_interface id=set_uplink_interface multiple=multiple size=4 style=width:100px>"); if(ins_para) { result=show_ethereal_bridge_one(ins_para->parameter,ins_para->connection,n,&ebrinfo); } if(result == 1) { if((ebrinfo)&&(ebrinfo->EBR[0])&&(ebrinfo->EBR[0]->iflist)) { for(head = ebrinfo->EBR[0]->iflist; (NULL != head); head = head->ifnext) { if(head->ifname) { fprintf(cgiOut,"<option value=%s>%s",head->ifname,head->ifname); } } } } fprintf(cgiOut,"</select>"); fprintf(cgiOut,"</td>"); fprintf(cgiOut,"<td align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"set_ebr_uplink_if")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30>"\ "<td>EBR %s:</td>",search(lwlan,"isolate_state")); fprintf(cgiOut,"<td align=left><select name=iso_use id=iso_use style=width:100px>"\ "<option value=>"\ "<option value=enable>enable"\ "<option value=disable>disable"\ "</select></td>"\ "<td align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"isolate_able")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30>"\ "<td>EBR %s:</td>",search(lwlan,"mult_state")); fprintf(cgiOut,"<td align=left><select name=mult_use id=mult_use style=width:100px>"\ "<option value=>"\ "<option value=enable>enable"\ "<option value=disable>disable"\ "</select></td>"\ "<td align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"mult_able")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=30>"\ "<td>%s:</td>",search(lwlan,"spswitch")); fprintf(cgiOut,"<td align=left><select name=sameport_switch id=sameport_switch style=width:100px>"\ "<option value=>"\ "<option value=enable>enable"\ "<option value=disable>disable"\ "</select></td>"\ "<td align=left style=\"padding-left:30px\"><font color=red>(%s)</font></td>",search(lwlan,"spswitch_able")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td><input type=hidden name=encry_conebr value=%s></td>",m); fprintf(cgiOut,"<td><input type=hidden name=ebr_id value=%s></td>",n); fprintf(cgiOut,"<td><input type=hidden name=page_no value=%s></td>",pn); fprintf(cgiOut,"<td><input type=hidden name=instance_id value=%s></td>",instance_id); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td></tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); if(result==1) { Free_ethereal_bridge_one_head(ebrinfo); } return 0; }
int ShowQosMapPage() { struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lcontrol; /*解析help.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lcontrol=get_chain_head("../htdocs/text/control.txt"); char *encry=(char *)malloc(BUF_LEN); char *str=NULL; //FILE *fp; //char lan[3]; char qosmap_encry[BUF_LEN]; //char addn[N]; int i; int retu=0,retz; int cl=1; int qos_num=0,map_num=0,up_num=0,dscp_num=0,dscpself_num=0; char menu[21]="menulist"; char* i_char=(char *)malloc(10); char * delrule=(char *)malloc(10); memset(delrule,0,10); char * Index=(char *)malloc(10); memset(Index,0,10); char *mode=(char *)malloc(AMOUNT); memset(mode,0,AMOUNT); char * CheckUsr=(char *)malloc(10); memset(CheckUsr,0,10); struct qos_info receive_qos[MAX_QOS_PROFILE]; struct mapping_info receive_map; receive_map.mapping_des= (char*)malloc(50); for(i=0;i<MAX_QOS_PROFILE;i++) { receive_qos[i].profileindex=0; receive_qos[i].dp=0; receive_qos[i].up=0; receive_qos[i].tc=0; receive_qos[i].dscp=0; } ccgi_dbus_init(); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } //strcpy(addn,str); memset(qosmap_encry,0,BUF_LEN); /*清空临时变量*/ } cgiFormStringNoNewlines("encry_routelist",qosmap_encry,BUF_LEN); cgiFormStringNoNewlines("DELRULE",delrule,BUF_LEN); cgiFormStringNoNewlines("INDEX",Index,BUF_LEN); cgiFormStringNoNewlines("CheckUsr",CheckUsr,10); if(strcmp(CheckUsr,"")!=0) retu=atoi(CheckUsr); if(strcmp(delrule,"delete")==0) { retz=delete_qos_profile(Index,lcontrol); switch(retz) { case 0: ShowAlert(search(lpublic,"oper_succ")); break; case -1: ShowAlert(search(lpublic,"oper_fail")); break; case -2: ShowAlert(search(lcontrol,"illegal_input")); break; case -3: ShowAlert(search(lcontrol,"qos_profile_not_exist")); break; case -4: ShowAlert(search(lcontrol,"qos_profile_in_use")); break; case -5: ShowAlert(search(lpublic,"oper_fail")); break; default: break; } } cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcontrol,"qos_manage")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".ShowRoute {overflow-x:hidden; overflow:auto; width: 580px; height: 386px; clip: rect( ); padding-top: 2px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>"\ "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { retu=checkuser_group(str); } if(cgiFormSubmitClicked("submit_qosmap") == cgiFormSuccess) { fprintf( cgiOut, "<script type='text/javascript'>\n" ); fprintf( cgiOut, "window.location.href='wp_contrl.cgi?UN=%s';\n", qosmap_encry); fprintf( cgiOut, "</script>\n" ); } show_qos_mode(mode); fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>QOS</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_qosmap style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { fprintf(cgiOut,"<td width=62 align=left><a href=wp_qosModule.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); } else fprintf(cgiOut,"<td width=62 align=left><a href=wp_qosModule.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",qosmap_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=yingwen_san>QOS </font><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"list")); /*突出显示*/ fprintf(cgiOut,"</tr>"); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addqos.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san>QOS Profile</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addmap.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_map")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_qosmapinfo.cgi?UN=%s target=mainFrame class=top><font id=%s>QOS %s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"map_detail")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_policymaplist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"policy_map")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_createpolicy.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_policy")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_qosmapinfo.cgi?UN=%s target=mainFrame class=top><font id=%s>QOS %s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"map_detail")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_policymaplist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"policy_map")); fprintf(cgiOut,"</tr>"); } } else if(cgiFormSubmitClicked("submit_qosmap") == cgiFormSuccess) { if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addqos.cgi?UN=%s target=mainFrame class=top style=color:#000000><font id=%s>%s</font><font id=yingwen_san>QOS Profile</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"add")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addmap.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"add_map")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_qosmapinfo.cgi?UN=%s target=mainFrame class=top><font id=%s>QOS %s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"map_detail")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_policymaplist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"policy_map")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_createpolicy.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"add_policy")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_qosmapinfo.cgi?UN=%s target=mainFrame class=top><font id=%s>QOS %s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"map_detail")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_policymaplist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",qosmap_encry,search(lpublic,"menu_san"),search(lcontrol,"policy_map")); fprintf(cgiOut,"</tr>"); } } int rowsCount=0; if(retu==0) rowsCount=13; else rowsCount=16; for(i=0;i<rowsCount;i++) { fprintf(cgiOut,"<tr height=25>\n"\ "<td id=tdleft> </td>\n"\ "</tr>\n"); } fprintf(cgiOut,"</table>\n"\ "</td>\n"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">\n"\ "<table width=640 height=310 border=0 cellspacing=0 cellpadding=0>\n"\ "<tr>\n"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">\n"\ "<table width=%s>\n","100%"); fprintf(cgiOut,"<tr>\n"\ "<td id=sec1 style=\"font-size:14px\">%s</td>\n",search(lcontrol,"QOS_info")); fprintf(cgiOut,"<td id=sec1 style=\"font-size:14px\" align='right'><font color=red><b>%s</b></font></td>\n",search(lcontrol,mode)); fprintf(cgiOut,"</tr>\n"\ "</table>\n"\ "</td>\n"); fprintf(cgiOut,"</tr>\n"\ "<tr>\n"\ "<td align=left valign=top style=padding-top:18px>\n"\ "<div class=ShowRoute><table width=503 border=1 frame=below rules=rows bordercolor=#cccccc cellspacing=0 cellpadding=0>\n"); fprintf(cgiOut,"<tr height=30 bgcolor=#eaeff9 style=font-size:14px id=td1 align='left'>\n"\ "<th width=70 style=font-size:12px>%s</th>\n","INDEX"); fprintf(cgiOut,"<th width=70 style=font-size:12px>%s</th>\n","DP"); fprintf(cgiOut,"<th width=70 style=font-size:12px>%s</th>\n","UP"); fprintf(cgiOut,"<th width=70 style=font-size:12px>%s</th>\n","TC"); fprintf(cgiOut,"<th width=70 style=font-size:12px>%s</th>\n","DSCP"); //fprintf(cgiOut,"<th width=70 style=font-size:12px>%s</th>\n",search(lcontrol,"mapping_num")); fprintf(cgiOut,"<th width=13 style=font-size:12px> </th>\n"); fprintf(cgiOut,"</tr>\n"); for(i=0;i<MAX_QOS_PROFILE;i++) { receive_qos[i].profileindex=0; receive_qos[i].dp=0; receive_qos[i].up=0; receive_qos[i].tc=0; receive_qos[i].dscp=0; } show_qos_profile(receive_qos,&qos_num,lcontrol); for(i=0;i<qos_num;i++) { memset(menu,0,21); strcpy(menu,"menulist"); sprintf(i_char,"%d",i+1); strcat(menu,i_char); map_num=0; receive_map=show_remap_table_byindex(&map_num,&up_num,&dscp_num,&dscpself_num,lcontrol); if(receive_qos[i].profileindex>0 && receive_qos[i].profileindex<128) { fprintf(cgiOut,"<tr height=25 bgcolor=%s>\n",setclour(cl)); fprintf(cgiOut,"<td style=font-size:12px>%u</td>\n",receive_qos[i].profileindex); if(receive_qos[i].dp==0) fprintf(cgiOut,"<td style=font-size:12px>Green</td>\n"); else if(receive_qos[i].dp==2) fprintf(cgiOut,"<td style=font-size:12px>Red</td>\n"); fprintf(cgiOut,"<td style=font-size:12px>%u</td>\n",receive_qos[i].up); fprintf(cgiOut,"<td style=font-size:12px>%u</td>\n",receive_qos[i].tc); fprintf(cgiOut,"<td style=font-size:12px>%u</td>\n",receive_qos[i].dscp); //fprintf(cgiOut,"<td style=font-size:12px align=center>%d</td>\n",map_num); fprintf(cgiOut,"<td align=left>\n"); if(retu==0) { fprintf(cgiOut,"<div style=\"position:relative; z-index:%d\" onmouseover=\"popMenu('%s');\" onmouseout=\"popMenu('%s');\">\n",(qos_num-i),menu,menu); fprintf(cgiOut,"<img src=/images/detail.gif>\n"\ "<div id=%s style=\"display:none; position:absolute; top:5px; left:0;\">\n",menu); fprintf(cgiOut,"<div id=div1>\n"); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_qosmapinfo.cgi?UN=%s&INDEX=%u target=mainFrame>%s</a></div>\n",encry,receive_qos[i].profileindex,search(lcontrol,"map_detail")); //f(retu==0) fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_qosmap.cgi?UN=%s&INDEX=%u&DELRULE=%s target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>\n",encry,receive_qos[i].profileindex,"delete",search(lcontrol,"confirm_delete"),search(lcontrol,"delete")); } else { //fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_qosmapinfo.cgi?UN=%s&INDEX=%u target=mainFrame>%s</a></div>\n",qosmap_encry,receive_qos[i].profileindex,search(lcontrol,"map_detail")); //if(retu==0) fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_qosmap.cgi?UN=%s&INDEX=%u&DELRULE=%s target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>\n",qosmap_encry,receive_qos[i].profileindex,"delete",search(lcontrol,"confirm_delete"),search(lcontrol,"delete")); } fprintf(cgiOut,"</div>\n"); fprintf(cgiOut,"</div>\n"\ "</div>\n"); } fprintf(cgiOut,"</td>\n"); fprintf(cgiOut,"</tr>\n"); cl=!cl; } } fprintf(cgiOut,"</table></div>\n"\ "</td>\n"\ "</tr>\n"\ "<tr>"); if(cgiFormSubmitClicked("submit_qosmap") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=encry_routelist value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } else if(cgiFormSubmitClicked("submit_qosmap") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=encry_routelist value=%s></td>",qosmap_encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); free(CheckUsr); free(i_char); free(delrule); free(receive_map.mapping_des); release(lpublic); release(lcontrol); free(mode); return 0; }
int ShowPortPage(struct list *lpublic,struct list *lcon) { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *str=NULL; ////////////// ETH_SLOT_LIST head,*p; ETH_PORT_LIST *pp; int port_num; ////////////// char stp_encry[BUF_LEN]; int retu=0; int i, ret = -1; char * CheckUsr=(char *)malloc(10); memset(CheckUsr,0,10); if(cgiFormSubmitClicked("submit_stp") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } memset(stp_encry,0,BUF_LEN); /*清空临时变量*/ } cgiFormStringNoNewlines("stp_encry",stp_encry,BUF_LEN); cgiFormStringNoNewlines("CheckUsr",CheckUsr,BUF_LEN); if(strcmp(CheckUsr,"")!=0) retu=atoi(CheckUsr); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcon,"stp_man")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("submit_stp") != cgiFormSuccess) { retu=checkuser_group(str); } fprintf(cgiOut,"<form method=post >"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>RSTP</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_stp style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_stp") != cgiFormSuccess) fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",stp_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if(cgiFormSubmitClicked("submit_stp") != cgiFormSuccess) { if(retu==0) /*管理员*/ { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_stp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"br_info")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_stp_bridge.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"br_conf")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"port_info"));//突出显示 fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_stp_port.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"port_conf")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_stp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"br_info")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"port_info"));//突出显示 fprintf(cgiOut,"</tr>"); } } else if(cgiFormSubmitClicked("submit_stp") == cgiFormSuccess) { if(retu==0) /*管理员*/ { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_stp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",stp_encry,search(lpublic,"menu_san"),search(lcon,"br_info")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_stp_bridge.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",stp_encry,search(lpublic,"menu_san"),search(lcon,"br_conf")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"port_info"));//突出显示 fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_stp_port.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",stp_encry,search(lpublic,"menu_san"),search(lcon,"port_conf")); fprintf(cgiOut,"</tr>"); } else { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_stp.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",stp_encry,search(lpublic,"menu_san"),search(lcon,"br_info")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"port_info"));//突出显示 fprintf(cgiOut,"</tr>"); } } //////////////根据端口数目来调节框的长度 int show_ret=-1; int line=0,l_num=0; show_ret=show_ethport_list(&head,&port_num); p=head.next; if(p!=NULL) { while(p!=NULL) { line +=p->port_num; pp=p->port.next; p=p->next; } } if(show_ret==0) l_num=line; else l_num=24; for(i=0;i<l_num;i++) //******************** { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } if((show_ret==0)&&(port_num>0)) { Free_ethslot_head(&head); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=center valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:0px; padding-top:10px\">"\ "<table width=720 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=35>"); fprintf(cgiOut,"<td align=center id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px;padding-left:0px;padding-top:0px\">%s</td>",search(lpublic,"port_des")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td align=left valign=top style=\"padding-top:0px\">"); fprintf(cgiOut,"<div class=configvlan><table width=720 border=1 frame=below rules=rows bordercolor=#cccccc cellspacing=0 cellpadding=0>"\ "<tr height=25 bgcolor=#eaeff9 style=font-size:14px align=left>"\ "<th style=font-size:12px>%s</th>",search(lcon,"slot_port_no")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"prior")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"path_cost")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"port_rl")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"port_stat")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"link_status")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"link_type")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"edge_port")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"desi_br_id")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"desi_br_cost")); fprintf(cgiOut,"<th style=font-size:12px>%s</th>",search(lcon,"desi_port")); fprintf(cgiOut,"</tr>"); int br_stat=0; int stp_mode; if(ccgi_get_brg_g_state(&stp_mode)==1) { if(stp_mode==0) { unsigned char slot = 0,port = 0; unsigned port_index = 0; unsigned int tmpval[2] = {0}; PORT_MEMBER_BMP portbmp; memset(&portbmp,0,sizeof(PORT_MEMBER_BMP)); port_info port_information; char buf[10] = {0}; int cl=1; if((ret = ccgi_get_all_ports_index(&portbmp)) <0) { ShowAlert(search(lcon,"execute_fail")); } ccgi_get_broad_product_id(&productid); for (i = 0; i < 64; i++) { if(PRODUCT_ID_AX7K == productid) { slot = i/8 + 1; port = i%8; } else if((PRODUCT_ID_AX5K == productid) || (PRODUCT_ID_AX5K_I == productid) || (PRODUCT_ID_AU4K == productid) || (PRODUCT_ID_AU3K == productid) || (PRODUCT_ID_AU3K_BCM == productid) || (PRODUCT_ID_AU3K_BCAT == productid) || (PRODUCT_ID_AU2K_TCAT == productid)) { slot = 1; port = i; } tmpval[i/32] = (1<<(i%32)); if(portbmp.portMbr[i/32]& tmpval[i/32]) { if(ccgi_get_one_port_index(slot,port,&port_index) < 0) { continue; } if((ret = ccgi_get_one_port_info(port_index,productid,&port_information))!=0) { if(STP_DISABLE == ret) { br_stat = -1; break; } else { ShowAlert(search(lcon,"execute_fail")); break; } } else { fprintf(cgiOut,"<tr height=25 bgcolor=%s>",setclour(cl)); fprintf(cgiOut,"<td style=font-size:12px align=left>%d/%d</td>",slot,port); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",port_information.port_prio); fprintf(cgiOut,"<td style=font-size:12px align=left>%d</td>",port_information.port_cost); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",stp_port_role[port_information.port_role]); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",stp_port_state[port_information.port_state]); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",port_information.port_lk ? "Y" : "N"); if(0 == port_information.port_p2p) fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>","N"); else if(1 == port_information.port_p2p) fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>","Y"); else if(2 == port_information.port_p2p) fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>","A"); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",port_information.port_edge ? "Y" : "N"); memset(buf,0,sizeof(buf)); sprintf(buf,"%d",port_information.br_prio); if(port_information.port_state) { fprintf(cgiOut,"<td style=font-size:12px align=left>%s:%02x%02x%02x%02x%02x%02x</td>",port_information.port_state ? buf : "",port_information.mac[0]\ ,port_information.mac[1],port_information.mac[2],port_information.mac[3],port_information.mac[4],port_information.mac[5]); } else { fprintf(cgiOut,"<td style=font-size:12px align=left></td>"); } memset(buf,0,sizeof(buf)); sprintf(buf," %d",port_information.br_cost); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",port_information.port_state ? buf : ""); memset(buf,0,sizeof(buf)); sprintf(buf,"%#0x",port_information.br_dPort); fprintf(cgiOut,"<td style=font-size:12px align=left>%s</td>",port_information.port_state ? buf : ""); cl=!cl; } } } } else { br_stat = -2;//mstp running } } else { br_stat = -1; } fprintf(cgiOut,"</table></div>"); if(br_stat == -1) fprintf(cgiOut,"<div><tr height = 30><td><font color=red>%s</font></td></tr></div>",search(lcon,"no_start_br")); if(br_stat == -2) fprintf(cgiOut,"<div><tr height = 30><td><font color=red>%s</font></td></tr></div>",search(lcon,"mstp_run")); fprintf(cgiOut,"</td>"\ "</tr>"\ "<tr>"); if(cgiFormSubmitClicked("submit_stp") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=stp_encry value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } else if(cgiFormSubmitClicked("submit_stp") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=stp_encry value=%s></td>",stp_encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%d></td>",retu); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); free(CheckUsr); return 0; }
int ShowQueryPage() { struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lcontrol; /*解析help.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lcontrol=get_chain_head("../htdocs/text/control.txt"); char *encry=(char *)malloc(BUF_LEN); char *str; //FILE *fp; //char lan[3]; char policer_encry[BUF_LEN]; char addn[N]; char * mode=(char *)malloc(AMOUNT); memset(mode,0,AMOUNT); int i=0; int cl=1; int retu=0; int select_flag=0; //char menu[21]="menulist"; char* i_char=(char *)malloc(10); char * group=(char * )malloc(10); memset(group,0,10); char * QueryID=(char * )malloc(10); memset(QueryID,0,10); char * wrr_weight=(char * )malloc(10); memset(wrr_weight,0,10); int qos_num=0; char * queue_mode=(char * )malloc(10); memset(queue_mode,0,10); char * radiobutton=(char *)malloc(10); memset(radiobutton,0,10); cgiFormString("radiobutton", radiobutton, 10); struct qos_info receive_qos[MAX_QOS_PROFILE]; struct query_info query_info[8]; int flag[8]; for(i=0;i<8;i++) { flag[i]=0; } for(i=0;i<MAX_QOS_PROFILE;i++) { receive_qos[i].profileindex=0; receive_qos[i].dp=0; receive_qos[i].up=0; receive_qos[i].tc=10; receive_qos[i].dscp=0; } ccgi_dbus_init(); memset(encry,0,BUF_LEN); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } strcpy(addn,str); memset(policer_encry,0,BUF_LEN); /*清空临时变量*/ } else { cgiFormStringNoNewlines("encry_configqueue",encry,BUF_LEN); cgiFormStringNoNewlines("group",group,10); cgiFormStringNoNewlines("QueryID",QueryID,10); cgiFormStringNoNewlines("wrr_weight",wrr_weight,10); cgiFormStringNoNewlines("queue_mode",queue_mode,10); cgiFormStringNoNewlines("CheckUsr",addn,10); } cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcontrol,"route_manage")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ "#div1{ width:62px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:60px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".ShowPolicy {overflow-x:hidden; overflow:auto; width: 580px; height: 236px; clip: rect( ); padding-top: 2px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>"\ "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"\ "<body>"); retu=checkuser_group(addn); if(cgiFormSubmitClicked("submit_config_query") == cgiFormSuccess) { int ret=0; if(strcmp(queue_mode,"sp")==0) { set_queue_scheduler(queue_mode); } else if(strcmp(queue_mode,"wrr")==0) { if(strcmp(wrr_weight,"")!=0) { set_queue_scheduler(queue_mode); if(strcmp(QueryID,"")!=0) { ret=set_wrr_queue(group,QueryID,wrr_weight,1); if(ret==0) { ShowAlert(search(lcontrol,"config_queue_succ")); } else { ShowAlert(search(lcontrol,"counterconfigfail")); } } else { ShowAlert(search(lcontrol,"pls_create_profile")); } } else { ShowAlert(search(lcontrol,"weight_not_null")); } } else if(strcmp(queue_mode,"sp+wrr")==0) { char * temp=(char * )malloc(10); memset(temp,0,10); strcpy(temp,"hybrid"); if(strcmp(radiobutton,"val")==0) { if(strcmp(wrr_weight,"")!=0) { set_queue_scheduler(temp); if(strcmp(QueryID,"")!=0) { ret=set_wrr_queue(group,QueryID,wrr_weight,2); if(ret==0) { ShowAlert(search(lcontrol,"config_queue_succ")); } else { ShowAlert(search(lcontrol,"counterconfigfail")); } } else { ShowAlert(search(lcontrol,"pls_create_profile")); } } else { ShowAlert(search(lcontrol,"weight_not_null")); } } else if(strcmp(radiobutton,"sp")==0) { set_queue_scheduler(temp); if(strcmp(QueryID,"")!=0) { ret=set_wrr_queue(group,QueryID,"sp",2); if(ret==0) { ShowAlert(search(lcontrol,"config_queue_succ")); } else { ShowAlert(search(lcontrol,"counterconfigfail")); } } else { ShowAlert(search(lcontrol,"pls_create_profile")); } } else { ShowAlert(search(lcontrol,"select_sp_weight")); } free(temp); } } show_qos_mode(mode); fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>QOS</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_config_query style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_config_query") != cgiFormSuccess) { fprintf(cgiOut,"<td width=62 align=left><a href=wp_qosModule.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); } else fprintf(cgiOut,"<td width=62 align=left><a href=wp_qosModule.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"config_queue_list")); /*突出显示*/ fprintf(cgiOut,"</tr>"); int rowsCount=0; if(retu==0) rowsCount=16; else rowsCount=12; for(i=0;i<rowsCount+2;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=640 height=310 border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr height='35'>\n"\ "<td style=\"font-size:14px\"><font color='red'><b>%s</b></font></td>"\ "</tr>\n",search(lcontrol,mode)); if(retu==0) { fprintf(cgiOut,"<tr>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">%s</td>",search(lcontrol,"config_query_mode")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td><table frame=below rules=rows width=440 height=70 border=1>"); show_qos_profile(receive_qos,&qos_num,lcontrol); for(i=0;i<qos_num;i++) { if(receive_qos[i].tc!=10) { flag[receive_qos[i].tc]=1; select_flag++; } } fprintf(cgiOut,"<tr height=25 align=left style=padding-top:8px>"); fprintf(cgiOut,"<td id=td1 width=110>%s:</td>",search(lcontrol,"queue_mode")); fprintf(cgiOut,"<td align=left style=padding-left:10px colspan=7><select name=queue_mode onchange=\"javascript:this.form.submit();\">"); for(i=0;i<((get_product_id()==PRODUCT_ID_AU3K_BCM)?2:3);i++) if(strcmp(Queue_Scheduler[i],queue_mode)==0) /*显示上次选中的*/ fprintf(cgiOut,"<option value=%s selected=selected>%s",Queue_Scheduler[i],Queue_Scheduler[i]); else fprintf(cgiOut,"<option value=%s>%s",Queue_Scheduler[i],Queue_Scheduler[i]); fprintf(cgiOut,"</select>"); fprintf(cgiOut,"</td>"); int Queue_Schedulerchoice=0; cgiFormSelectSingle("queue_mode", Queue_Scheduler, 3, &Queue_Schedulerchoice, 0); fprintf(cgiOut,"</tr>"); if(Queue_Schedulerchoice==2 || Queue_Schedulerchoice==1) { fprintf(cgiOut,"<tr height=25 align=left style=padding-top:8px>"); fprintf(cgiOut,"<td align=left style=padding-left:10px colspan=3>"); if(get_product_id()!=PRODUCT_ID_AU3K_BCM) { fprintf(cgiOut,"<select name=group>"); fprintf(cgiOut,"<option value=%s>%s","group1","group1"); fprintf(cgiOut,"<option value=%s>%s","group2","group2"); fprintf(cgiOut,"</select>"); } else { fprintf(cgiOut,"<input type=hidden name=group value=group1><b>group1</b>"); } fprintf(cgiOut,"</td>"); fprintf(cgiOut,"<td id=td1>%s:</td>",search(lcontrol,"queue_TC")); fprintf(cgiOut,"<td align=left style=padding-left:10px colspan=3>\n"); if(select_flag!=0) { fprintf(cgiOut,"<select name=QueryID>"); for(i=0;i<8;i++) { if(flag[i]==1) { fprintf(cgiOut,"<option value=%d>%d",i,i); } } fprintf(cgiOut,"</select>"); } else { fprintf(cgiOut,"<font color='red'>%s</font>",search(lcontrol,"not_create_qos_profile")); } fprintf(cgiOut,"</td>"); //***************************************************changed here********************************************************** if(Queue_Schedulerchoice==1) { fprintf(cgiOut,"<td id=td1>%s:</td>",search(lcontrol,"weight")); fprintf(cgiOut,"<td><input type=text name=wrr_weight size=8></td>"); } else if(Queue_Schedulerchoice==2) { fprintf(cgiOut,"<td id=td1><input type=radio name=radiobutton value='val' checked />%s:</td>",search(lcontrol,"weight")); fprintf(cgiOut,"<td><input type=text name=wrr_weight size=8></td>"); fprintf(cgiOut,"<td id=td1><input type=radio name=radiobutton value='sp' />sp</td>"); } //********************************************************************************************************************************************************** fprintf(cgiOut,"</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "</tr>"); } fprintf(cgiOut,"<tr style=padding-top:18px>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">%s</td>",search(lcontrol,"config_queue_list")); fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td align=left valign=top style=padding-top:18px>"\ "<div class=ShowPolicy><table width=320 border=1 frame=below rules=rows bordercolor=#cccccc cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr height=30 bgcolor=#eaeff9 style=font-size:14px id=td1 align=left>"\ "<th width=90><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"queue_TC")); fprintf(cgiOut,"<th width=120><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Scheduling_Group")); fprintf(cgiOut,"<th width=70><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"weight")); fprintf(cgiOut,"</tr>"); for(i=0;i<8;i++) { flag[i]=0; query_info[i].QID=0; query_info[i].Scheduling_group=(char * )malloc(10); memset(query_info[i].Scheduling_group,0,10); query_info[i].weight=0; } show_queue(query_info); for(i=0;i<8;i++) { /*memset(menu,0,21); strcpy(menu,"menulist"); sprintf(i_char,"%d",i+1); strcat(menu,i_char);*/ fprintf(cgiOut,"<tr height=25 bgcolor=%s align=left>",setclour(cl)); fprintf(cgiOut,"<td>%u</td>",query_info[i].QID); fprintf(cgiOut,"<td>%s</td>",query_info[i].Scheduling_group); fprintf(cgiOut,"<td>%u</td>",query_info[i].weight); fprintf(cgiOut,"</tr>"); cl=!cl; } fprintf(cgiOut,"</table></div>"\ "</td>"\ "</tr>"\ "<tr>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">%s</td>",search(lpublic,"description")); fprintf(cgiOut,"</tr>"\ "<tr height=25 style=padding-top:2px>"\ "<td style=font-size:14px;color:#FF0000>%s</td>",search(lcontrol,"queue_TC_des")); fprintf(cgiOut,"</tr>"\ /*"<tr>"\ "<td>"\ "<table width=430 style=padding-top:2px>"\ "<tr>"); sprintf(pageNumCA,"%d",pageNum+1); sprintf(pageNumCD,"%d",pageNum-1); if(cgiFormSubmitClicked("submit_config_query") != cgiFormSuccess) { fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_srouter.cgi?UN=%s&PN=%s&SN=%s>%s</td>",encry,pageNumCA,"PageDown",search(lcontrol,"page_down")); fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_srouter.cgi?UN=%s&PN=%s&SN=%s>%s</td>",encry,pageNumCD,"PageUp",search(lcontrol,"page_up")); } else if(cgiFormSubmitClicked("submit_config_query") == cgiFormSuccess) { fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_srouter.cgi?UN=%s&PN=%s&SN=%s>%s</td>",policer_encry,pageNumCA,"PageDown",search(lcontrol,"page_down")); fprintf(cgiOut,"<td align=center style=padding-top:2px><a href=wp_srouter.cgi?UN=%s&PN=%s&SN=%s>%s</td>",policer_encry,pageNumCD,"PageUp",search(lcontrol,"page_up")); } fprintf(cgiOut,"</tr></table></td>"\ "</tr>"\*/ "<tr>"); if(cgiFormSubmitClicked("submit_config_query") != cgiFormSuccess) { fprintf(cgiOut,"<td colspan=6><input type=hidden name=encry_configqueue value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%s></td>",addn); } else if(cgiFormSubmitClicked("submit_config_query") == cgiFormSuccess) { fprintf(cgiOut,"<td colspan=6><input type=hidden name=encry_configqueue value=%s></td>",encry); fprintf(cgiOut,"<td><input type=hidden name=CheckUsr value=%s></td>",addn); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); free(i_char); for(i=0;i<8;i++) { free(query_info[i].Scheduling_group); } free(group); free(QueryID); free(wrr_weight); free(queue_mode); release(lpublic); release(lcontrol); free(mode); return 0; }
int ShowModifyPrivilegePage(struct list *lpublic, struct list *lsystem) { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *str; char mod_encry[BUF_LEN]; char * usrName=(char *)malloc(33); memset(usrName,0,33); if(cgiFormSubmitClicked("submit_modifyadmin") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); cgiFormStringNoNewlines("USERNAME", usrName, 33); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } } char * procductId=readproductID(); cgiFormStringNoNewlines("encry_modadm",mod_encry,BUF_LEN); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lsystem,"user_manage")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); if(cgiFormSubmitClicked("submit_modifyadmin") == cgiFormSuccess) { modifyprivilege_hand(lpublic,lsystem); } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),search(lsystem,"user_manage")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_modifyadmin style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_modifyadmin") != cgiFormSuccess) { fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); } else { fprintf(cgiOut,"<td width=62 align=left><a href=wp_sysmagic.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",mod_encry,search(lpublic,"img_cancel")); } fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if(cgiFormSubmitClicked("submit_modifyadmin") != cgiFormSuccess) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_usrlis.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"user_list")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addusr.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"add_user")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_modpass.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"modify_password")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lsystem,"modify_privilege")); /*突出显示*/ fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_modsyslog.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lsystem,"modify_loglevel")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_view_user.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lpublic,"login_info")); fprintf(cgiOut,"</tr>"); } else if(cgiFormSubmitClicked("submit_modifyadmin") == cgiFormSuccess) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_usrlis.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",mod_encry,search(lpublic,"menu_san"),search(lsystem,"user_list")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addusr.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",mod_encry,search(lpublic,"menu_san"),search(lsystem,"add_user")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_modpass.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",mod_encry,search(lpublic,"menu_san"),search(lsystem,"modify_password")); fprintf(cgiOut,"</tr>"\ "<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lsystem,"modify_privilege")); /*突出显示*/ fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_modsyslog.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",mod_encry,search(lpublic,"menu_san"),search(lsystem,"modify_loglevel")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_view_user.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",mod_encry,search(lpublic,"menu_san"),search(lpublic,"login_info")); fprintf(cgiOut,"</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px\">"\ "<table width=280 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=30>"\ "<td id=tdprompt>%s:</td>",search(lsystem,"user_na")); if(strcmp(usrName,"")==0) fprintf(cgiOut,"<td><input type=text name=a_name size=20></td>"); else fprintf(cgiOut,"<td><input type=text name=a_name size=20 value=%s enable></td>",usrName); fprintf(cgiOut,"</tr>"\ "<tr height=30>"\ "<td id=tdprompt>%s:</td>",search(lsystem,"pri")); fprintf(cgiOut,"<td><select name=privilege style=width:130px>" "<option value=enable>administrator"\ "<option value=view>user"\ "</select></td>"\ "</tr>"\ "<tr>"); if(cgiFormSubmitClicked("submit_modifyadmin") != cgiFormSuccess) { fprintf(cgiOut,"<td colspan=3><input type=hidden name=encry_modadm value=%s></td>",encry); } else if(cgiFormSubmitClicked("submit_modifyadmin") == cgiFormSuccess) { fprintf(cgiOut,"<td colspan=3><input type=hidden name=encry_modadm value=%s></td>",mod_encry); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(usrName); free(procductId); free(encry); return 0; }
int ShowLogconfPage(struct list *lcontrol,struct list *lpublic) { char *encry=(char *)malloc(BUF_LEN); char *str; char deb[128]; memset(deb,0,128); char file_name[128]; //读取文件 memset(file_name,0,128); char zstring[128]; //父串 memset(zstring,0,128); char subs[128]; //子串 memset(subs,0,128); char log_encry[BUF_LEN]; int ret ; /*命令及命令执行结果*/ int op_ret; int j = 0; int i=-1; int ir=0; int flag=1; /*标志这状态*/ char showtype[N]; memset(showtype,0,N); char dstring[128]; /*插入的规则行内容*/ memset(dstring,0,128); char dstring1[128]; /*插入的规则行内容*/ memset(dstring1,0,128); char dstring2[128]; /*插入的规则行内容*/ memset(dstring2,0,128); char dstring3[128]; /*插入的规则行内容*/ memset(dstring3,0,128); char tcpname[N]; /*下拉框内容*/ memset(tcpname,0,N); ST_SYS_ALL sysall; /*总的结构体内容*/ memset(&sysall,0,sizeof(sysall)); ST_LOG_KEY logkey; memset(&logkey,0,sizeof(logkey)); char *fpath; fpath=XML_FPATH; /*要修改的内容*/ char content[128]; memset(content,0,128); cgiFormStringNoNewlines("Nb", file_name, 128); if(cgiFormSubmitClicked("version") != cgiFormSuccess) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } memset(log_encry,0,BUF_LEN); /*清空临时变量*/ } else { cgiFormStringNoNewlines("encry_version", log_encry, BUF_LEN); str=dcryption(log_encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ } memset(log_encry,0,BUF_LEN); /*清空临时变量*/ } cgiFormStringNoNewlines("encry_version",log_encry,BUF_LEN); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script language=javascript src=/ip.js>"\ "</script>"\ "<script type='text/javascript'>"\ "function changestate(){"\ "var fl = document.getElementsByName('showtype')[0];"\ "var tcd = document.getElementsByName('showtype')[1];"\ "var user = document.getElementsByName('showtype')[2];"\ "}"\ "</script>"\ "<body>"); /*----------------------------begin-----------------------------------------------*/ /* $1 : 传过来的目的规则名 $2 : syslog 文件 $3 : 临时文件名 $4 : 添加的新规则名 */ /* 重启服务*/ if(cgiFormSubmitClicked("reboot") == cgiFormSuccess) { int ret; ret=restart_syslog(); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } /*恢复默认,删除旧有文件并重新生成新文件,先删除xml文件,读取信息是从xml来的*/ if(cgiFormSubmitClicked("default") == cgiFormSuccess) { sprintf(deb,"sudo rm %s",XML_FPATH); ret=system(deb); memset(deb,0,128); sprintf(deb,"sudo rm %s",CONF_FPATH); op_ret=system(deb); restart_syslog(); if(ret==0 && op_ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } /*保存更改 此页面主要是修改log 信息的,其他配置另有页面*/ if(cgiFormSubmitClicked("submit_mod") == cgiFormSuccess) { cgiFormStringNoNewlines("showtype", showtype, N); int result; char **responses; result = cgiFormStringMultiple("showtype", &responses); //多选框的操作 if((strcmp(showtype,"1")!=0)&&(strcmp(showtype,"3")!=0)&&(strcmp(showtype,"2")!=0)) { ShowAlert(search(lpublic,"log_no_opt")); } else{ i = 0; while(responses[i]) { i++; } /*只选 1,3 的双选情况 修改的是log的 content 信息,这样相对conf比较稳定,要找到value的关键字 */ if(i==2 && (strcmp(responses[0],"1")==0)&&(strcmp(responses[1],"3")==0)) { char temp[60]; memset(temp,0,60); ir=find_log_node(fpath,NODE_DES,NODE_ATT,file_name,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); memset(&logkey,0,sizeof(logkey)); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_ALL,NODE_VALUE,&logkey); sprintf(temp,"%s;",logkey.key); strcat(dstring1,temp); //fprintf(cgiOut,"zone: %s",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT,file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } //只选 1,2 的双选情况 if(i==2 && (strcmp(responses[0],"1")==0)&&(strcmp(responses[1],"2")==0)) { char temp[60]; memset(temp,0,60); ir=find_log_node(fpath,NODE_DES,NODE_ATT,file_name,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); //fprintf(cgiOut,"fen: %s<br>",dstring1); memset(&logkey,0,sizeof(logkey)); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_IP,NODE_VALUE,&logkey); sprintf(temp,"%s;",logkey.key); strcat(dstring1,temp); //fprintf(cgiOut,"zone: %s<br>",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT, file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } //只选 2,3 的双选情况 if(i==2 && (strcmp(responses[0],"2")==0)&&(strcmp(responses[1],"3")==0)) { char temp[60]; memset(temp,0,60); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_IP,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); //fprintf(cgiOut,"fen: %s<br>",dstring1); memset(&logkey,0,sizeof(logkey)); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_ALL,NODE_VALUE,&logkey); sprintf(temp,"%s;",logkey.key); strcat(dstring1,temp); //fprintf(cgiOut,"zone: %s<br>",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT, file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } //三个框都选的情况 if(i==3 && (strcmp(responses[0],"1")==0)&&(strcmp(responses[1],"2")==0)&&(strcmp(responses[2],"3")==0)) { char temp[60]; memset(temp,0,60); ir=find_log_node(fpath,NODE_DES,NODE_ATT,file_name,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); // fprintf(cgiOut,"fen: %s<br>",dstring1); memset(&logkey,0,sizeof(logkey)); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_IP,NODE_VALUE,&logkey); sprintf(temp,"%s;",logkey.key); strcat(dstring1,temp); memset(&logkey,0,sizeof(logkey)); memset(temp,0,60); ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_ALL,NODE_VALUE,&logkey); sprintf(temp,"%s;",logkey.key); strcat(dstring1,temp); //fprintf(cgiOut,"zone: %s",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT,file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } /*单选一 */ if(i==1 && (strcmp(responses[0],"1")==0)) { memset(dstring1,0,128); ir=find_log_node(fpath,NODE_DES,NODE_ATT,file_name,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); // fprintf(cgiOut,"fen: %s<br>",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT, file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); // fprintf(cgiOut,"test: %d<br>",sysall.des_num); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } //单选二 if(i==1 && (strcmp(responses[0],"2")==0)) { ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_IP,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); // fprintf(cgiOut,"fen: %s<br>",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT, file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } //单选三 if(i==1 && (strcmp(responses[0],"3")==0)) { ir=find_log_node(fpath,NODE_DES,NODE_ATT,L_ALL,NODE_VALUE,&logkey); sprintf(dstring1,"%s;",logkey.key); // fprintf(cgiOut,"fen: %s<br>",dstring1); mod_log_node(fpath, NODE_LOG, NODE_ATT, file_name, CH_DEST,dstring1); read_filter(fpath, NODE_LOG, &sysall); ret=write_config(&sysall,CONF_FPATH); // fprintf(cgiOut,"<br>ir: %d",ret); if(ret==0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); } } cgiStringArrayFree(responses); } /*----------------------------- end ----------------------------------------------*/ fprintf(cgiOut,"<form method=post encType=multipart/form-data>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"); //111111111111111111111 fprintf(cgiOut,"<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom id=%s background=/images/di22.jpg>%s</td>",search(lpublic,"title_style"),search(lpublic,"log_info")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); // 鉴权 fprintf(cgiOut,"<input type=hidden name=UN value=%s />",encry); fprintf(cgiOut,"<input type=hidden name=Nb value=%s />",file_name); //取到传送的值 fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_mod style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if(cgiFormSubmitClicked("submit_mod") != cgiFormSuccess) fprintf(cgiOut,"<td width=62 align=left><a href=wp_log_info.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_log_info.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",log_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"); fprintf(cgiOut,"<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"); //333333333333333333333 fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"); //44444444444444444444 fprintf(cgiOut,"<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"); fprintf(cgiOut,"<tr>"); //次内 fprintf(cgiOut,"<td><table width=120 border=0 cellspacing=0 cellpadding=0>"); //555555555555555 fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lpublic,"log_modrule")); /*突出显示*/ fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_log_add.cgi?UN=%s&Nb=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,file_name,search(lpublic,"menu_san"),search(lpublic,"log_addip")); fprintf(cgiOut,"</tr>"); for(j=0;j<13;j++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"); //555555555555555555555 fprintf(cgiOut,"</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"); fprintf(cgiOut,"<table width=460 border=0 cellspacing=0 cellpadding=0>"); //66666666666666666 fprintf(cgiOut,"<tr>"); //内 fprintf(cgiOut,"<td colspan=2 style=\"padding-top:20px\">"); fprintf(cgiOut,"<table width=460 border=0 bordercolor=#cccccc cellspacing=0 cellpadding=0>"); //777777777777777777777 memset(showtype,0,N); cgiFormStringNoNewlines("showtype", showtype, N); fprintf(cgiOut,"<tr><td>"); fprintf(cgiOut,"<input type=submit name=reboot value=\"%s\">",search(lpublic,"log_reboot")); fprintf(cgiOut,"<input type=submit name=default value=\"%s\"></td>",search(lpublic,"log_def")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=12><td></td></tr>"); fprintf(cgiOut,"<tr><td>"); fprintf(cgiOut, "<div class=\"col1\"> \n" ); fprintf(cgiOut, "<label class=\"col1\"> \n" ); fprintf(cgiOut, "<h4>%s</h4> \n", search(lpublic,"log_dest") ); fprintf(cgiOut, "</label> \n" ); fprintf(cgiOut, "</div> \n" ); fprintf(cgiOut,"</td></tr>"); fprintf(cgiOut, "<tr><td><hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td>"\ "</tr>" ); fprintf(cgiOut,"<tr height=12><td></td></tr>"); fprintf(cgiOut,"<tr ><td>"); find_log_node(fpath,NODE_LOG,NODE_ATT,file_name,CH_DEST,&logkey); //log的dest属性 strcpy(zstring,logkey.key); find_log_node(fpath,NODE_DES,NODE_ATT,file_name,NODE_VALUE,&logkey); strcpy(subs,logkey.key); flag=if_subs(zstring,subs); if(flag==2) fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"1\" onclick=\"changestate()\" checked ></td><td>\n" ); else fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"1\" onclick=\"changestate()\" ></td><td>\n" ); fprintf(cgiOut, "<label class=\"col1\" for=\"Package.DestinationAddress.Single\">%s</label></td><td> \n", search(lpublic,"log_file")); fprintf(cgiOut,"</td></tr>"); fprintf(cgiOut,"<tr height=12><td></td></tr>"); //分割线 fprintf(cgiOut, "<tr><td><hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td>"\ "</tr>" ); fprintf(cgiOut,"<tr height=12><td></td></tr>"); fprintf(cgiOut,"<tr ><td>"); find_log_node(fpath,NODE_DES,NODE_ATT,L_IP,NODE_VALUE,&logkey); strcpy(subs,logkey.key); flag=if_subs(zstring,subs); if(flag==2) fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"2\" onclick=\"changestate()\" checked ></td><td>\n" ); else fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"2\" onclick=\"changestate()\" ></td><td>\n" ); fprintf(cgiOut, "<label class=\"col1\" for=\"Package.DestinationAddress.Single\">%s</label></td><td> \n", search(lpublic,"log_port")); fprintf(cgiOut,"</td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=7><td></td></tr>"); fprintf(cgiOut,"<tr><td></td>"); fprintf(cgiOut,"<td><a href=wp_log_add.cgi?UN=%s&Nb=%s><font color=blue size=2>%s</font></a></td></tr>",encry,file_name,search(lpublic,"log_addip")); //分割线 fprintf(cgiOut, "<tr><td><hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td>"\ "</tr>" ); fprintf(cgiOut,"<tr height=12><td></td></tr>"); fprintf(cgiOut,"<tr ><td bgcolor=#FFFFFF>"); find_log_node(fpath,NODE_DES,NODE_ATT,L_ALL,NODE_VALUE,&logkey); strcpy(subs,logkey.key); flag=if_subs(zstring,subs); if(flag==2) fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"3\" onclick=\"changestate()\" checked></td><td>\n" ); else fprintf(cgiOut, "<input type=\"checkbox\" name=\"showtype\" value=\"3\" onclick=\"changestate()\" ></td><td>\n" ); fprintf(cgiOut, "<label class=\"col1\" for=\"Package.DestinationAddress.Single\">%s</label></td> \n", search(lpublic,"log_user") ); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=12><td></td></tr>"); //分割线 fprintf(cgiOut, "<tr><td><hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td><td>"\ "<hr width=100%% size=1 color=#fff align=center noshade /></td>"\ "</tr>" ); fprintf(cgiOut,"<tr height=12><td></td></tr>"); if(cgiFormSubmitClicked("submit_mod") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",encry); } else if(cgiFormSubmitClicked("submit_mod") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",log_encry); } fprintf(cgiOut,"</table>"); //7777777777777777777 fprintf(cgiOut,"</td></tr>"); fprintf(cgiOut,"<tr>"); if(cgiFormSubmitClicked("version") != cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=encry_version value=%s></td>",encry); } else if(cgiFormSubmitClicked("version") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=encry_version value=%s></td>",log_encry); } fprintf(cgiOut,"</tr>"\ "</table>"); //6666666666666666666 fprintf(cgiOut,"</td>"); fprintf(cgiOut,"</tr>"); //内 fprintf(cgiOut,"<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"); //444444444444444444444 fprintf(cgiOut,"</td>"\ "<td width=15 background=/images/di999.jpg> </td>"); fprintf(cgiOut,"</tr>"); //次内 fprintf(cgiOut,"</table></td>"); //33333333333333333333 fprintf(cgiOut,"</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"); //1111111111111111111 fprintf(cgiOut,"</div>"\ "</form>"\ "</body>"); fprintf(cgiOut,"</html>"); free(encry); return 0; }
static int s_addMulitRadius_prefix_of_page( STPageInfo *pstPageInfo ) { FILE * pp = pstPageInfo->fp; struct list * radius_public = pstPageInfo->lpublic; struct list * radius_auth = pstPageInfo->lauth; char domain_name[256],radius_server_type[256],radius_server_ip[32],radius_server_port[32],radius_server_key[256],radius_server_portal[32], charging_server_ip[32],charging_server_port[32],charging_server_key[256], backup_radius_server_ip[32],backup_radius_server_port[32],backup_radius_server_key[256],backup_radius_server_portal[32], backup_charging_server_ip[32],backup_charging_server_port[32],backup_charging_server_key[256],swap_octets[256],strip_domain_name[256]; char class_to_bandwidth[10] = {0}; int ret = 0; unsigned long auth_ip=0; unsigned short auth_port=0; unsigned long acct_ip=0; unsigned short acct_port=0; unsigned long backup_auth_ip=0; unsigned short backup_auth_port=0; unsigned long backup_acct_ip=0; unsigned short backup_acct_port=0; struct in_addr inaddr; memset(domain_name, 0, sizeof(domain_name)); memset(radius_server_type, 0, sizeof(radius_server_type)); memset(radius_server_ip, 0, sizeof(radius_server_ip)); memset(radius_server_port, 0, sizeof(radius_server_port)); memset(radius_server_key, 0, sizeof(radius_server_key)); memset(radius_server_portal, 0, sizeof(radius_server_portal)); memset(charging_server_ip, 0, sizeof(charging_server_ip)); memset(charging_server_port, 0, sizeof(charging_server_port)); memset(charging_server_key, 0, sizeof(charging_server_key)); memset(backup_radius_server_ip, 0, sizeof(backup_radius_server_ip)); memset(backup_radius_server_port, 0, sizeof(backup_radius_server_port)); memset(backup_radius_server_key, 0, sizeof(backup_radius_server_key)); memset(backup_radius_server_portal, 0, sizeof(backup_radius_server_portal)); memset(backup_charging_server_ip, 0, sizeof(backup_charging_server_ip)); memset(backup_charging_server_port, 0, sizeof(backup_charging_server_port)); memset(backup_charging_server_key, 0, sizeof(backup_charging_server_key)); memset(swap_octets, 0, sizeof(swap_octets)); memset(strip_domain_name, 0, sizeof(strip_domain_name)); memset(class_to_bandwidth, 0, sizeof(class_to_bandwidth)); if( (cgiFormSubmitClicked(SUBMIT_NAME) == cgiFormSuccess) && (pstPageInfo->iUserGroup == 0) ) { cgiFormStringNoNewlines("domain_name",domain_name, sizeof(domain_name)); //cgiFormStringNoNewlines("radius_server_type",radius_server_type, sizeof(radius_server_type)); cgiFormStringNoNewlines("radius_server_ip",radius_server_ip, sizeof(radius_server_ip)); cgiFormStringNoNewlines("radius_server_port",radius_server_port, sizeof(radius_server_port)); cgiFormStringNoNewlines("radius_server_key",radius_server_key, sizeof(radius_server_key)); //cgiFormStringNoNewlines("radius_server_portal",radius_server_portal, sizeof(radius_server_portal)); cgiFormStringNoNewlines("charging_server_ip",charging_server_ip, sizeof(charging_server_ip)); cgiFormStringNoNewlines("charging_server_port",charging_server_port, sizeof(charging_server_port)); cgiFormStringNoNewlines("charging_server_key",charging_server_key, sizeof(charging_server_key)); cgiFormStringNoNewlines("backup_radius_server_ip",backup_radius_server_ip, sizeof(backup_radius_server_ip)); cgiFormStringNoNewlines("backup_radius_server_port",backup_radius_server_port, sizeof(backup_radius_server_port)); cgiFormStringNoNewlines("backup_radius_server_key",backup_radius_server_key, sizeof(backup_radius_server_key)); //cgiFormStringNoNewlines("backup_radius_server_portal",backup_radius_server_portal, sizeof(backup_radius_server_portal)); cgiFormStringNoNewlines("backup_charging_server_ip",backup_charging_server_ip, sizeof(backup_charging_server_ip)); cgiFormStringNoNewlines("backup_charging_server_port",backup_charging_server_port, sizeof(backup_charging_server_port)); cgiFormStringNoNewlines("backup_charging_server_key",backup_charging_server_key, sizeof(backup_charging_server_key)); //cgiFormStringNoNewlines("swap_octets",swap_octets, sizeof(swap_octets)); cgiFormStringNoNewlines("strip_domain_name",strip_domain_name, sizeof(strip_domain_name)); cgiFormStringNoNewlines("class_to_bandwidth",class_to_bandwidth, sizeof(class_to_bandwidth)); /////////////处理数据/////////////////// if(!strcmp(domain_name,"") || strlen(domain_name) > MAX_RADIUS_DOMAIN_LEN-1) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (radius_server_ip != NULL && strcmp(radius_server_ip, "") != 0 && !ip_input_is_legal(radius_server_ip)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (charging_server_ip != NULL && strcmp(charging_server_ip, "") != 0 && !ip_input_is_legal(charging_server_ip)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (backup_radius_server_ip != NULL && strcmp(backup_radius_server_ip, "") != 0 && !ip_input_is_legal(backup_radius_server_ip)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (backup_charging_server_ip != NULL && strcmp(backup_charging_server_ip, "") != 0 && !ip_input_is_legal(backup_charging_server_ip)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (radius_server_port != NULL && strcmp(radius_server_port, "") != 0 && !port_input_is_legal(radius_server_port)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (charging_server_port != NULL && strcmp(charging_server_port, "") != 0 && !port_input_is_legal(charging_server_port)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (backup_radius_server_port != NULL && strcmp(backup_radius_server_port, "") != 0 && !port_input_is_legal(backup_radius_server_port)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (backup_charging_server_port != NULL && strcmp(backup_charging_server_port, "") != 0 && !port_input_is_legal(backup_charging_server_port)) { ShowAlert( search(radius_public, "input_illegal")); return 0; } if (strlen(radius_server_key) > MAX_RADIUS_KEY_LEN-1 || strlen(charging_server_key) > MAX_RADIUS_KEY_LEN-1 || strlen(backup_radius_server_key) > MAX_RADIUS_KEY_LEN-1 || strlen(backup_charging_server_key) > MAX_RADIUS_KEY_LEN-1) { ShowAlert( search(radius_public, "input_illegal")); return 0; } memset(&inaddr,0,sizeof(struct in_addr)); inet_aton(radius_server_ip, &inaddr); auth_ip = ntohl(inaddr.s_addr); auth_port = atoi(radius_server_port); memset(&inaddr,0,sizeof(struct in_addr)); inet_aton( charging_server_ip,&inaddr); acct_ip = ntohl(inaddr.s_addr); acct_port = atoi(charging_server_port); memset(&inaddr,0,sizeof(struct in_addr)); inet_aton( backup_radius_server_ip,&inaddr); backup_auth_ip = ntohl(inaddr.s_addr); backup_auth_port = atoi(backup_radius_server_port); memset(&inaddr,0,sizeof(struct in_addr)); inet_aton( backup_charging_server_ip,&inaddr); backup_acct_ip = ntohl(inaddr.s_addr); backup_acct_port = atoi(backup_charging_server_port); ret = eag_add_radius(ccgi_connection, parameter.local_id, parameter.instance_id, domain_name, auth_ip, auth_port, radius_server_key, acct_ip, acct_port, charging_server_key, backup_auth_ip, backup_auth_port, backup_radius_server_key, backup_acct_ip, backup_acct_port, backup_charging_server_key ); int remove_domain_switch = atoi(strip_domain_name); ret = eag_set_remove_domain_switch(ccgi_connection, parameter.local_id, parameter.instance_id, domain_name, remove_domain_switch); int class_bandwidth = atoi(class_to_bandwidth); ret = eag_set_class_to_bandwidth_switch(ccgi_connection, parameter.local_id, parameter.instance_id, domain_name, class_bandwidth); fprintf( pp, "<script type='text/javascript'>\n" ); fprintf( pp, "window.location.href='wp_multi_radius.cgi?UN=%s&plotid=%s';\n", pstPageInfo->encry, plotid); fprintf( pp, "</script>\n" ); } return 0; }
int ShowConfigAgingtimePage(struct list *lpublic,struct list *lcon) { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_usrmag.cgi带入的加密字符串*/ char *str; char fdb_encry[BUF_LEN]; char agingtime[N]; int agetime=-1; int i, ret=-1; if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("default") != cgiFormSuccess)) { memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } //memset(fdb_encry,0,BUF_LEN); /*清空临时变量*/ } memset(fdb_encry,0,BUF_LEN); /*清空临时变量*/ cgiFormStringNoNewlines("fdb_encry",fdb_encry,BUF_LEN); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcon,"fdb_man")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ ".a3{width:30;border:0; text-align:center}"\ "</style>"\ "</head>"\ "<script src=/ip.js>"\ "</script>"\ "<body>"); memset(agingtime,0,N); cgiFormStringNoNewlines("agingtime",agingtime,N); if(cgiFormSubmitClicked("submit_fdb") == cgiFormSuccess) { if(strcmp(agingtime,"")!=0) { if((strcmp(agingtime,"0")==0) || ((strtoul(agingtime,0,10)>=10)&&(strtoul(agingtime,0,10)<=630))) { ret = config_fdb_agingtime(agingtime);//设置fdb老化时间 switch(ret) { case -3: ShowAlert(search(lcon,"arg_not_null")); break; case -2: ShowAlert(search(lcon,"arg_form")); break; case -1: ShowAlert(search(lpublic,"oper_fail")); break; case NPD_FDB_ERR_NONE : ShowAlert(search(lpublic,"oper_succ")); break; case NPD_FDB_ERR_GENERAL: ShowAlert(search(lpublic,"oper_fail")); break; case NPD_FDB_ERR_NODE_EXIST : ShowAlert(search(lcon,"fdb_exist")); break; case NPD_FDB_ERR_NODE_NOT_EXIST: ShowAlert(search(lcon,"fdb_not_exist")); break; case NPD_FDB_ERR_PORT_NOTIN_VLAN: ShowAlert(search(lcon,"port_not_vlan")); break; case NPD_FDB_ERR_VLAN_NONEXIST: ShowAlert(search(lcon,"vlan_not_exist")); break; case NPD_FDB_ERR_SYSTEM_MAC: ShowAlert(search(lcon,"mac_confilt")); break; case NPD_FDB_ERR_BADPARA: ShowAlert(search(lcon,"illegal_input")); break; case NPD_FDB_ERR_OCCUR_HW: ShowAlert(search(lcon,"HW_error")); break; default : ShowAlert(search(lpublic,"oper_fail")); } } else { ShowAlert(search(lcon,"arg_form")); } } else { ShowAlert(search(lcon,"arg_not_null")); } } if(cgiFormSubmitClicked("default") == cgiFormSuccess) { ret = config_fdb_agingtime_default();//恢复fdb老化时间为默认值 switch(ret) { case -1: ShowAlert(search(lpublic,"oper_fail")); break; case NPD_FDB_ERR_NONE : ShowAlert(search(lpublic,"oper_succ")); break; case NPD_FDB_ERR_GENERAL: ShowAlert(search(lpublic,"oper_fail")); break; case NPD_FDB_ERR_NODE_EXIST : ShowAlert(search(lcon,"fdb_exist")); break; case NPD_FDB_ERR_NODE_NOT_EXIST: ShowAlert(search(lcon,"fdb_not_exist")); break; case NPD_FDB_ERR_PORT_NOTIN_VLAN: ShowAlert(search(lcon,"port_not_vlan")); break; case NPD_FDB_ERR_VLAN_NONEXIST: ShowAlert(search(lcon,"vlan_not_exist")); break; case NPD_FDB_ERR_SYSTEM_MAC: ShowAlert(search(lcon,"mac_confilt")); break; case NPD_FDB_ERR_BADPARA: ShowAlert(search(lcon,"illegal_input")); break; case NPD_FDB_ERR_OCCUR_HW: ShowAlert(search(lcon,"HW_error")); break; default : ShowAlert(search(lpublic,"oper_fail")); } } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>FDB</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_fdb style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("default") != cgiFormSuccess)) fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); else fprintf(cgiOut,"<td width=62 align=left><a href=wp_contrl.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",fdb_encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("default") != cgiFormSuccess)) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_show_fdb.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"show_fdb")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=yingwen_san>FDB </font><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"fdb_age")); /*突出显示*/ fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_static_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> FDB</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_sta")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_blacklist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_bla")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_fdb_limit.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"fdb_limit")); fprintf(cgiOut,"</tr>"); //add new web page for delete fdb fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_delete_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s FDB</font></a></td>",encry,search(lpublic,"menu_san"),search(lcon,"del")); fprintf(cgiOut,"</tr>"); } else if(cgiFormSubmitClicked("submit_fdb") == cgiFormSuccess || cgiFormSubmitClicked("default") == cgiFormSuccess) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_show_fdb.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"show_fdb")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=yingwen_san>FDB </font><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcon,"fdb_age")); /*突出显示*/ fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_static_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> FDB</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_sta")); fprintf(cgiOut,"</tr>"\ "<tr height=25>"\ "<td align=left id=tdleft><a href=wp_add_blacklist.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_bla")); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_config_fdb_limit.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>FDB </font><font id=%s>%s</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"fdb_limit")); fprintf(cgiOut,"</tr>"); //add new web page for delete fdb fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_delete_fdb.cgi?UN=%s target=mainFrame class=top><font id=%s>%s FDB</font></a></td>",fdb_encry,search(lpublic,"menu_san"),search(lcon,"del")); fprintf(cgiOut,"</tr>"); } for(i=0;i<1;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=700 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td align=left valign=top style=\"padding-top:18px\">"); fprintf(cgiOut,"<table border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td>%s:</td>",search(lcon,"fdb_age")); fprintf(cgiOut,"<td><input type=text name=agingtime size=15></td>"\ "<td><font color=red>(10--630||0)</font></td>"\ "</tr>"); fprintf(cgiOut,"</table>"); fprintf(cgiOut,"<table border=0 cellspacing=0 cellpadding=0 style=\"padding-top:20px\">"); fprintf(cgiOut,"<tr height=30>"); fprintf(cgiOut,"<td>%s:</td>",search(lcon,"age_now")); ret = show_fdb_agingtime(&agetime); if(ret == 0) fprintf(cgiOut,"<td width=50>%ds</td>",agetime); else if(ret == -1) fprintf(cgiOut,"<td>%s</td>",search(lcon,"age_err")); else if(ret==-5) ShowAlert(search(lcon,"HW_error")); fprintf(cgiOut,"<td><input type=submit width=60 name=default value=%s /></td>"\ "<td><input type=text name=no_submit style=display:none></td>"\ "</tr>",search(lcon,"re_default")); fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</td>"\ "</tr>"\ "<tr>"); if((cgiFormSubmitClicked("submit_fdb") != cgiFormSuccess)&&(cgiFormSubmitClicked("default") != cgiFormSuccess)) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",encry); } else if(cgiFormSubmitClicked("submit_fdb") == cgiFormSuccess || cgiFormSubmitClicked("default") == cgiFormSuccess) { fprintf(cgiOut,"<td><input type=hidden name=fdb_encry value=%s></td>",fdb_encry); } fprintf(cgiOut,"</tr>"\ "</table>"\ "</td>"\ "</tr>"\ "<tr height=4 valign=top>"\ "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\ "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\ "</tr>"\ "</table>"\ "</td>"\ "<td width=15 background=/images/di999.jpg> </td>"\ "</tr>"\ "</table></td>"\ "</tr>"\ "<tr>"\ "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\ "<td align=left valign=top background=/images/di777.jpg> </td>"\ "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\ "</tr>"\ "</table>"\ "</div>"\ "</form>"\ "</body>"\ "</html>"); free(encry); return 0; }
int ShowPolicerPage() { int retz; ccgi_dbus_init(); struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lcontrol; /*解析help.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lcontrol=get_chain_head("../htdocs/text/control.txt"); char *encry=(char *)malloc(BUF_LEN); char *str; char * mode=(char *)malloc(AMOUNT); memset(mode,0,AMOUNT); int result; //char policer_encry[BUF_LEN]; char addn[N]; int i=0; int cl=1; int retu=0; int policer_num=0; char menu[21]="menulist"; char* i_char=(char *)malloc(10); char * deletepolicer=(char * )malloc(10); memset(deletepolicer,0,10); char * index=(char * )malloc(10); memset(index,0,10); char * CheckUsr=(char * )malloc(10); memset(CheckUsr,0,10); char * disablecounter = (char *)malloc(10); memset(disablecounter,0,10); char * counterindex = (char *)malloc(10); memset(counterindex,0,10); struct policer_info receive_policer[Policer_Num]; //policer mode char * policer_mode=(char * )malloc(10); memset(policer_mode,0,10); //policer mode information char * policer_mode_info=(char * )malloc(10); memset(policer_mode_info,0,10); for(i=0;i<Policer_Num;i++) { receive_policer[i].policer_index=0; receive_policer[i].policer_state=(char *)malloc(20); memset(receive_policer[i].policer_state,0,20); receive_policer[i].CounterState=(char *)malloc(20); memset(receive_policer[i].CounterState,0,20); receive_policer[i].Out_Profile_Action=(char *)malloc(20); memset(receive_policer[i].Out_Profile_Action,0,20); receive_policer[i].Policer_Mode=(char *)malloc(20); memset(receive_policer[i].Policer_Mode,0,20); receive_policer[i].Policing_Packet_Size=(char *)malloc(20); memset(receive_policer[i].Policing_Packet_Size,0,20); } memset(encry,0,BUF_LEN); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) { ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ return 0; } strcpy(addn,str); cgiFormStringNoNewlines("DELRULE",deletepolicer,10); cgiFormStringNoNewlines("INDEX",index,10); cgiFormStringNoNewlines("CheckUsr",CheckUsr,10); cgiFormStringNoNewlines("ENABLE",disablecounter,10); cgiFormStringNoNewlines("COUNTERINDEX",counterindex,10); cgiFormStringNoNewlines("policer_mode",policer_mode,10); cgiFormStringNoNewlines("policer_mode_info",policer_mode_info,10); if(strcmp(CheckUsr,"")!=0) retu=atoi(CheckUsr); show_qos_mode(mode); cgiHeaderContentType("text/html"); fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"); fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>"); fprintf(cgiOut,"<title>%s</title>",search(lcontrol,"route_manage")); fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>"\ "<style type=text/css>"\ "#div1{ width:42px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:50px; height:15px; padding-left:5px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}"\ ".ShowPolicy {overflow-x:hidden; overflow:auto; width: 750px; height: 386px; clip: rect( ); padding-top: 2px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px} "\ "</style>"\ "</head>"\ "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"\ "<body>"); if(strcmp(deletepolicer,"delete")==0) { result=delete_policer(index); switch(result) { case 0: ShowAlert(search(lcontrol,"del_succ")); break; case -2: ShowAlert(search(lcontrol,"no_policer")); break; case -3: ShowAlert(search(lcontrol,"inuse_policer")); break; case -4: ShowAlert(search(lcontrol,"fail_del_policer")); break; default : ShowAlert(search(lpublic,"oper_fail")); break; } } if(cgiFormSubmitClicked("submit_policerlist") != cgiFormSuccess) { retu=checkuser_group(str); } else if(cgiFormSubmitClicked("submit_policerlist") == cgiFormSuccess) { fprintf( cgiOut, "<script type='text/javascript'>\n" ); fprintf( cgiOut, "window.location.href='wp_qosModule.cgi?UN=%s';\n",encry); fprintf( cgiOut, "</script>\n" ); } if(strcmp(disablecounter,"disable")==0) { retz=counter_policer(counterindex,disablecounter,index); switch(retz) { case 0: ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } if(cgiFormSubmitClicked("config_mode") == cgiFormSuccess) { if(strcmp(policer_mode,"strict")==0) { retz=set_strict_mode(policer_mode_info); switch(retz) { case 0: ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } else if(strcmp(policer_mode,"loose")==0) { retz=set_meter_loose_mode(policer_mode_info); switch(retz) { case 0: ShowAlert(search(lpublic,"oper_succ")); break; default: ShowAlert(search(lpublic,"oper_fail")); break; } } fprintf(cgiOut, "<script type='text/javascript'>\n" ); fprintf(cgiOut, "window.location.href='wp_policer.cgi?UN=%s';\n",encry); fprintf(cgiOut, "</script>\n" ); } fprintf(cgiOut,"<form method=post>"\ "<div align=center>"\ "<table width=976 border=0 cellpadding=0 cellspacing=0>"\ "<tr>"\ "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\ "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\ "<td width=153 align=left valign=bottom background=/images/di22.jpg><font id=titleen>QOS</font><font id=%s> %s</font></td>",search(lpublic,"title_style"),search(lpublic,"management")); fprintf(cgiOut,"<td width=690 align=right valign=bottom background=/images/di22.jpg>"); fprintf(cgiOut,"<table width=130 border=0 cellspacing=0 cellpadding=0>"\ "<tr>"\ "<td width=62 align=center><input id=but type=submit name=submit_policerlist style=background-image:url(/images/%s) value=""></td>",search(lpublic,"img_ok")); fprintf(cgiOut,"<td width=62 align=left><a href=wp_qosModule.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",encry,search(lpublic,"img_cancel")); fprintf(cgiOut,"</tr>"\ "</table>"); fprintf(cgiOut,"</td>"\ "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\ "</tr>"\ "<tr>"\ "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\ "<tr>"\ "<td width=12 align=left valign=top background=/images/di888.jpg> </td>"\ "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=4 valign=bottom>"\ "<td width=120> </td>"\ "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\ "</tr>"\ "<tr>"\ "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\ "<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); #if 0 if(cgiFormSubmitClicked("submit_policerlist") != cgiFormSuccess) { fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"policer")); /*突出显示*/ fprintf(cgiOut,"</tr>"); if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addpolicer.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_policer")); fprintf(cgiOut,"</tr>"); } fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_qoscounter.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"counter")); fprintf(cgiOut,"</tr>"); } else if(cgiFormSubmitClicked("submit_policerlist") == cgiFormSuccess) { #endif fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=%s>%s</font></td>",search(lpublic,"menu_san"),search(lcontrol,"policer")); /*突出显示*/ fprintf(cgiOut,"</tr>"); if(retu==0) { fprintf(cgiOut,"<tr height=25>"\ "<td align=left id=tdleft><a href=wp_addpolicer.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"add_policer")); fprintf(cgiOut,"</tr>"); } fprintf(cgiOut,"<tr height=26>"\ "<td align=left id=tdleft><a href=wp_qoscounter.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font></a></td>",encry,search(lpublic,"menu_san"),search(lcontrol,"counter")); fprintf(cgiOut,"</tr>"); //} int rowsCount=0; if(retu==0) rowsCount=15; else rowsCount=16; for(i=0;i<rowsCount;i++) { fprintf(cgiOut,"<tr height=25>"\ "<td id=tdleft> </td>"\ "</tr>"); } fprintf(cgiOut,"</table>"\ "</td>"\ "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\ "<table width=700 height=310 border=0 cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr>"\ "<td id=sec1 style=\"border-bottom:2px solid #53868b;font-size:14px\">\n"\ "<table width=%s>\n","90%"); fprintf(cgiOut,"<tr>\n"\ "<td id=sec1 style=\"font-size:14px\">%s</td>",search(lcontrol,"policy_map_info")); fprintf(cgiOut,"<td id=sec1 style=\"font-size:14px\" align='right'><font color='red'><b>%s</b></font></td>",search(lcontrol,mode)); fprintf(cgiOut,"</tr>\n"\ "</table>\n"\ "</td>\n"); fprintf(cgiOut,"</tr>"); //////////////////new///////////////////// if(checkuser_group(addn)==0)/*administrator*/ { fprintf(cgiOut,"<tr><td> </td></tr>"); fprintf(cgiOut,"<tr>"); fprintf(cgiOut,"<td>"); fprintf(cgiOut,"<table>"); fprintf(cgiOut,"<tr align=left style=padding-top:8px>"); fprintf(cgiOut,"<td id=td1 width=110>%s:</td>",search(lcontrol,"config_policer_mode")); fprintf(cgiOut,"<td align=left style=padding-left:10px width=50><select name=policer_mode onchange=\"javascript:this.form.submit();\">"); for(i=0;i<2;i++) if(strcmp(Policer_Mode[i],policer_mode)==0) /*显示上次选中的*/ fprintf(cgiOut,"<option value=%s selected=selected>%s",Policer_Mode[i],Policer_Mode[i]); else fprintf(cgiOut,"<option value=%s>%s",Policer_Mode[i],Policer_Mode[i]); fprintf(cgiOut,"</select>\n"); fprintf(cgiOut,"</td>"); int policer_modechoice=0; cgiFormSelectSingle("policer_mode", Policer_Mode, 2, &policer_modechoice, 0); if(policer_modechoice==0) { fprintf(cgiOut,"<td align=left style=padding-left:10px><select name=policer_mode_info>"); fprintf(cgiOut,"<option value=%s>%s","l1","L1"); fprintf(cgiOut,"<option value=%s>%s","l2","L2"); fprintf(cgiOut,"<option value=%s>%s","l3","L3"); fprintf(cgiOut,"</select>"); fprintf(cgiOut,"</td>"); } else if(policer_modechoice==1) { fprintf(cgiOut,"<td align=left style=padding-left:10px><select name=policer_mode_info>"); fprintf(cgiOut,"<option value=%s>%s","0","0"); fprintf(cgiOut,"<option value=%s>%s","1","1"); fprintf(cgiOut,"<option value=%s>%s","2","2"); fprintf(cgiOut,"</select>"); fprintf(cgiOut,"</td>"); } fprintf(cgiOut,"<td align=left style=padding-left:10px>"); fprintf(cgiOut,"<input type=submit style=width:70px; height:36px border=0 name=config_mode style=background-image:url(/images/SubBackGif.gif) value=\"%s\">",search(lcontrol,"mode_submit")); fprintf(cgiOut,"</td>"); fprintf(cgiOut,"</tr>"); fprintf(cgiOut,"</table>"); fprintf(cgiOut,"</td>"); fprintf(cgiOut,"</tr>"); } /////////////////////////////////////// fprintf(cgiOut,"<tr>"\ "<td align=left valign=top style=padding-top:18px>"\ "<div class=ShowPolicy><table width=688 border=1 frame=below rules=rows bordercolor=#cccccc cellspacing=0 cellpadding=0>"); fprintf(cgiOut,"<tr height=30 bgcolor=#eaeff9 style=font-size:14px id=td1 align=left>"\ "<th width=45 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),"Index"); fprintf(cgiOut,"<th width=45 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Policer_State")); fprintf(cgiOut,"<th width=40 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),"CIR"); fprintf(cgiOut,"<th width=40 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),"CBS"); fprintf(cgiOut,"<th width=110 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),"Counter State"); fprintf(cgiOut,"<th width=110 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),"Counter Index"); fprintf(cgiOut,"<th width=85 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Out_Profile")); fprintf(cgiOut,"<th width=100 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Remap_QOS")); fprintf(cgiOut,"<th width=50 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Policer_Mode")); fprintf(cgiOut,"<th width=50 style=font-size:12px><font id=%s>%s</font></th>", search(lpublic,"menu_thead"),search(lcontrol,"Policer_Size")); fprintf(cgiOut,"<th width=13 style=font-size:12px> </th>"); fprintf(cgiOut,"</tr>"); show_policer(receive_policer,&policer_num); for(i=0;i<policer_num;i++) { memset(menu,0,21); strcpy(menu,"menulist"); sprintf(i_char,"%d",i+1); strcat(menu,i_char); fprintf(cgiOut,"<tr height=25 bgcolor=%s align=left>",setclour(cl)); fprintf(cgiOut,"<td style=font-size:12px>%u</td>",receive_policer[i].policer_index); fprintf(cgiOut,"<td style=font-size:12px>%s</td>",receive_policer[i].policer_state); fprintf(cgiOut,"<td style=font-size:12px>%ld</td>",receive_policer[i].cir); fprintf(cgiOut,"<td style=font-size:12px>%ld</td>",receive_policer[i].cbs); fprintf(cgiOut,"<td style=font-size:12px align='center'>%s</td>",receive_policer[i].CounterState); if(receive_policer[i].CounterIndex==0) { fprintf(cgiOut,"<td style=font-size:12px align='center'>%s</td>","No"); } else { fprintf(cgiOut,"<td style=font-size:12px align='center'>%d</td>",receive_policer[i].CounterIndex); } fprintf(cgiOut,"<td style=font-size:12px align='center'>%s</td>",receive_policer[i].Out_Profile_Action); fprintf(cgiOut,"<td style=font-size:12px align='center'>%u</td>",receive_policer[i].Remap_QoSProfile); fprintf(cgiOut,"<td style=font-size:12px>%s</td>",receive_policer[i].Policer_Mode); fprintf(cgiOut,"<td style=font-size:12px>%s</td>",receive_policer[i].Policing_Packet_Size); if(retu==0) { fprintf(cgiOut,"<td align=left>"); fprintf(cgiOut,"<div style=\"position:relative; z-index:%d\" onmouseover=\"popMenu('%s');\" onmouseout=\"popMenu('%s');\">",(policer_num-i),menu,menu); fprintf(cgiOut,"<img src=/images/detail.gif>"\ "<div id=%s style=\"display:none; position:absolute; top:5px; left:0;\">",menu); fprintf(cgiOut,"<div id=div1>"); //if(cgiFormSubmitClicked("submit_policerlist") != cgiFormSuccess) // { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_conpolicer.cgi?UN=%s&INDEX=%u&COUNTERINDEX=%d target=mainFrame>%s</a></div>",encry,receive_policer[i].policer_index,receive_policer[i].CounterIndex,search(lpublic,"configure")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_policer.cgi?UN=%s&INDEX=%u&DELRULE=%s target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",encry,receive_policer[i].policer_index,"delete",search(lcontrol,"confirm_delete"),search(lcontrol,"delete")); if(receive_policer[i].CounterIndex!=0) { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_policer.cgi?UN=%s&INDEX=%u&COUNTERINDEX=%d&ENABLE=%s target=mainFrame>%s</a></div>",encry,receive_policer[i].policer_index,receive_policer[i].CounterIndex,"disable",search(lcontrol,"counter_disable")); } #if 0 } else { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_conpolicer.cgi?UN=%s&INDEX=%u&COUNTERINDEX=%d target=mainFrame>%s</a></div>",encry,receive_policer[i].policer_index,receive_policer[i].CounterIndex,search(lpublic,"configure")); fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_policer.cgi?UN=%s&INDEX=%u&DELRULE=%s target=mainFrame >%s</a></div>",encry,receive_policer[i].policer_index,"delete",search(lcontrol,"confirm_delete"),search(lcontrol,"delete")); if(receive_policer[i].CounterIndex!=0) { fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_policer.cgi?UN=%s&INDEX=%u&COUNTERINDEX=%d&ENABLE=%s target=mainFrame>%s</a></div>",encry,receive_policer[i].policer_index,receive_policer[i].CounterIndex,"disable",search(lcontrol,"counter_disable")); } //} #endif fprintf(cgiOut,"</div>"\ "</div>"\ "</div>"); fprintf(cgiOut,"</td>"); } else fprintf(cgiOut,"<td> </td>"); fprintf(cgiOut,"</tr>"); cl=!cl; }
int cgiMain() { STPageInfo stPageInfo; //portal_lcon = get_chain_head("../../htdocs/text/control.txt"); //初始化常用公共变量 memset( &stPageInfo, 0,sizeof(STPageInfo) ); cgiFormStringNoNewlines("UN", stPageInfo.encry, BUF_LEN); stPageInfo.username_encry=dcryption(stPageInfo.encry); if( NULL == stPageInfo.username_encry ) { ShowErrorPage(search(stPageInfo.lpublic,"ill_user")); /*用户非法*/ return 0; } stPageInfo.iUserGroup = checkuser_group( stPageInfo.username_encry ); //stPageInfo.pstModuleContainer = MC_create_module_container(); init_portal_container(&(stPageInfo.pstPortalContainer)); if( NULL == stPageInfo.pstPortalContainer ) { return 0; } stPageInfo.lpublic=stPageInfo.pstPortalContainer->lpublic;//get_chain_head("../htdocs/text/public.txt"); stPageInfo.lauth=stPageInfo.pstPortalContainer->llocal;//get_chain_head("../htdocs/text/authentication.txt"); stPageInfo.fp = cgiOut; //初始化完毕 //处理表单 // stPageInfo.formProcessError = getUserInput( &(stPageInfo.stUserInput) ); if( cgiFormSubmitClicked(SUBMIT_NAME_USER_MANAGE) == cgiFormSuccess ) { if( 0 == stPageInfo.formProcessError ) { //ShowAlert( search( lpublic, "ip_not_null" ) ); stPageInfo.formProcessError = doUserCommand( &(stPageInfo) ); doRedir( &stPageInfo ); } } char url[256]; memset( url, 0, 256 ); MC_setActiveLabel( stPageInfo.pstPortalContainer->pstModuleContainer, 3 ); MC_setPrefixOfPageCallBack( stPageInfo.pstPortalContainer->pstModuleContainer, (MC_CALLBACK)s_usr_mng_prefix_of_page, &stPageInfo ); MC_setContentOfPageCallBack( stPageInfo.pstPortalContainer->pstModuleContainer, (MC_CALLBACK)s_usr_mng_content_of_page, &stPageInfo ); MC_setOutPutFileHandle( stPageInfo.pstPortalContainer->pstModuleContainer, cgiOut ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, FORM_ONSIBMIT, "return true;" ); //可以设置为一个javascript函数,这个js函数的实现放在prefix回调函数中就可以了。 MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, FORM_METHOD, "post" ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, FORM_ACTION, "wp_user_manage.cgi" ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, PUBLIC_INPUT_ENCRY, stPageInfo.encry ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, BTN_OK_IMG, search(stPageInfo.lpublic,"img_ok") ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, BTN_OK_SUBMIT_NAME, SUBMIT_NAME_USER_MANAGE ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, LABLE_TOP_HIGHT, "25" ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, BTN_OK_SUBMIT_NAME, "submit_user_manage" ); snprintf( url, sizeof(url), "wp_authentication.cgi.cgi?UN=%s", stPageInfo.encry ); MC_setModuleContainerDomainValue( stPageInfo.pstPortalContainer->pstModuleContainer, BTN_CANCEL_URL, url ); MC_writeHtml( stPageInfo.pstPortalContainer->pstModuleContainer ); release_portal_container(&(stPageInfo.pstPortalContainer)); return 0; }