Esempio n. 1
0
errprint()
{
    /* EXEC SQL WHENEVER SQLERROR CONTINUE;*/
    cgiPrintf("<b>Veritabaný hatasý:</b>");
    cgiPrintf("%s\n",sqlca.sqlerrm.sqlerrmc);
    exit(1);
}
/*--------------------------------------------------------------------------------------------------
  Read input.
--------------------------------------------------------------------------------------------------*/
char *cgiReadInput(void)
{
    char *lenstr = getenv("CONTENT_LENGTH");
    char *input;
    long len;

    if(lenstr == NULL) {
        cgiPrintf("CONTENT_LENGTH not set");
        return NULL;
    }
    if(sscanf(lenstr,"%ld",&len) != 1 || len > CGI_INPUT_MAXLEN) {
        cgiPrintf("Invalid input length");
        return NULL;
    }
    input = (char *)calloc(len + 1, sizeof(char));
    return fgets(input, len + 1, stdin);
}
/*--------------------------------------------------------------------------------------------------
  Read the sessionId cookie, and if not set, set it.  Return the sessionId.
--------------------------------------------------------------------------------------------------*/
char *cgiReadSessionId(void)
{
    char *session = cgiReadCookie("sessionId");

    if(session == NULL) {
        session = cgiGenerateRandomID(20);
        cgiPrintf("Set-Cookie: sessionId=%s\n", session);
    }
    return session;
}
Esempio n. 4
0
int cgiMain (void)
{
	int ret = OK;
	char name[512];
	char cmd[1024];
	char *keyName=NULL;
	char *ErrMsg = NULL;
	char *fileName=NULL;
	char *backName=NULL;
	char *p = NULL;
	char *directory= NULL;
	char *confFile=NULL;
	char *title=NULL;
	struct stat buf	;
	xmlDocPtr doc;
	xmlNodePtr pNode,pRoot;
  	//
	//	认证用户,并且获取用户名
	//
	ret = authentication(NULL,NULL);
	cgiHeaderContent("text/html");
	if (ret)
	{
		//
		//	认证失败
		//
		goto exit;
	}
	//
	//	获取属性文件名
	//
	ErrMsg = "propertyFile";
	ret = cgiGetString(&confFile,2,255,ErrMsg);
	if(ret)
		goto exit;	
	//
	//	获取要使用的属性记录主键
	//
	ErrMsg = "keyName";
	ret = cgiGetString(&keyName,1,255,ErrMsg);
	if (ret)
		goto exit;
	ErrMsg = NULL;
	//
	//	先在属性文件中获取cgi程序
	//
	doc = xmlParseFile(confFile);
	if (NULL == doc)
	{
		ret = NO_MESSAGE;
		ErrMsg="没有打开属性文件<p>或没有属性文件";
		goto exit;
	}
	//
	//	获取根节点
	//
	pRoot = xmlDocGetRootElement(doc);
	if (NULL == pRoot)
	{
		xmlFreeDoc(doc);
		ret = NO_MESSAGE;
		ErrMsg="空的属性文件";
		goto exit;
	}
	pNode = pRoot->xmlChildrenNode;
	//
	//	查找使用的配置树
	//
	while(pNode)
	{
		if (xmlStrcmp(pNode->name,"conf")==0)
		{
			xmlChar * keyValue = NULL;
			//
			//	查找使用的属性记录
			//
			keyValue = xmlGetProp(pNode,"name");
			if (xmlStrcmp(keyValue,(const xmlChar*)keyName)==0)
			{
				break;
			}
			xmlFree(keyValue);
		}
		pNode = pNode->next;
	}
	if (NULL == pNode)
	{
		xmlFreeDoc(doc);
		doc=NULL;
		ret = NO_MESSAGE;
		ErrMsg="没有找到指定的配置项";
		goto exit;
	}
	title = xmlGetProp(pNode,"title");
	if (strcmp(keyName,"systemLog")==0)
	{
		//
		//	系统日志处理部分。
		//
		time_t cur_time;
		struct tm *myTime;
		int i;
	 	cur_time = time(NULL);
		myTime = localtime(&cur_time);
		xmlFreeDoc(doc);
		doc = NULL;
		for(i=1;i<32;i++)
		{
			sprintf(name,"%s.%d",LOG_FILE_NAME,i);
			ret =  stat(name,&buf);
			if ((ret)||(buf.st_mode & S_IFDIR))
				continue;
			break;
		}
		if (i>=32)
		{
			cgiPrintf("<HTML><HEAD><meta http-equiv=\"refresh\" content=\"290;URL=/timeout.html\"></head></HEAD>"
				"<body background=\"/icons/bg01.gif\"><br><center><H2>%s</H2><P></center>"
				"<P><P><HR width=60%><br>"
				"<table align=center><tr><td>没有记录日志</td></tr></TABLE><P><P><HR width=60%><center></BODY></HTML>",title);
			dispOperateInfo(NULL,NO_DISP_MSG,"没有记录日志");
			return 0;		
		}
		//
		// 生成备份文件名
		//
		//snprintf(name,512,"../../htdocs/login/webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
		snprintf(name,512,"../download/webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
		snprintf(cmd,1024,"cd ./log ; tar -zcf %s sysLog.*",name);

		if (system(cmd)==-1)
			ret = EXEC_FAULT;
		else
		{
			//sprintf(name,"../htdocs/login/webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
			sprintf(name,"./download/webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
			ret =  stat(name,&buf);
			if (ret)
			{
				ret = BACK_FALSE;	
			}
			else
			{
				//sprintf(name,"/login/webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
				sprintf(name,"webadminLog.%d-%d-%d.tar.gz",myTime->tm_year+1900,myTime->tm_mon+1,myTime->tm_mday);
				//sprintf(cmd,"请 <font size =\"14\" color=blue><a href=%s color=red>下载</a> </font>后,妥善保存。",name);
				sprintf(cmd,"请 <font size =\"14\" color=blue><a href=/cgi-bin/download.cgi?downloadFile=%s color=red>下载</a> </font>后,妥善保存。",name);
				cgiPrintf("<HTML><head><link href=\"/icons/all.css\" >"
					"<meta http-equiv=\"refresh\" content=\"290;URL=/timeout.html\"></head>"
					"<BODY background=\"/icons/bg01.gif\"><br><center><H2>备份%s</H2><P></center>"
					"<P><HR width=60%><br><center>%s",title,cmd);
				cgiPrintf("<br><HR width=60%></body></html>");
				dispOperateInfo(NULL,NO_DISP_OK_MSG,NULL);
				return 0;
			}
		}
		goto exit;
	}	
	fileName = xmlGetProp(pNode,"fileName");
	if (fileName)
	{
		ret =  stat(fileName,&buf);
		if ((ret)||(buf.st_mode & S_IFDIR))
		{
			ret = NO_MESSAGE;
			ErrMsg="日志文件不存在";
			goto exit;
		}
	}
	backName = xmlGetProp(pNode,"backName");
	if ((backName==NULL)||(strlen(backName)==0))
	{
		ret = NO_MESSAGE;
		ErrMsg = "没有给出备份文件名";
		goto exit;	
	}
	directory = xmlGetProp(pNode,"directory");
	xmlFree(doc);
	doc = NULL;
	//
	//	获取日志所在的目录
	//
	strncpy(name,fileName,512);
	p=strrchr(name,'/');
	if (p)
	{
		*p=0;
		//
		// 生成备份文件名
		//
		if (directory)
			snprintf(cmd,1023,"cd %s ; tar -zcf %s.tar.gz %s %s",name,backName,p+1,directory);
		else
			snprintf(cmd,1023,"cd %s ; tar -zcf %s.tar.gz %s",name,backName,p+1);
		
	}
	else
	{
		if (directory)
			snprintf(cmd,1023,"tar -zcf %s.tar.gz %s %s",backName,fileName,directory);
		else
			snprintf(cmd,1023,"tar -zcf %s.tar.gz %s",backName,fileName);
	}
	if (system(cmd)==-1)
		ret = EXEC_FAULT;
	else
	{
		sprintf(name,"%s.tar.gz",backName);
		ret =  stat(name,&buf);
		if (ret)
		{
			ret = BACK_FALSE;
		}
		else
		{
			p=strrchr(backName,'/');
			if (p)
				p++;
			else
				p = backName;
			//snprintf(name,512,"/%s.tar.gz",p);
			snprintf(name,512,"%s.tar.gz",p);
			//snprintf(cmd,1023,"请 <font size =\"14\" color=blue><a href=%s color=red>下载</a> </font>后,妥善保存。",name);
			snprintf(cmd,1023,"请 <font size =\"14\" color=blue><a href=/cgi-bin/download.cgi?downloadFile=%s color=red>下载</a> </font>后,妥善保存。",name);
			cgiPrintf("<HTML><head><link href=\"/icons/all.css\" >"
				"<meta http-equiv=\"refresh\" content=\"290;URL=/timeout.html\"></head>"
				"<BODY background=\"/icons/bg01.gif\"><br><center><H2>备份%s</H2><P></center>"
				"<P><HR width=60%><br><center>%s",title,cmd);
			cgiPrintf("<br><HR width=60%></body></html>");			
			snprintf(cmd,1024,"%s",fileName);
			dispOperateInfo(NULL,NO_DISP_MSG,cmd);
			return 0;
		}
	}
exit:
	if (doc) 	xmlFree(doc);
	if (fileName) free(fileName);
	if (backName) free(backName);
	if (directory) free(directory);
	dispOperateInfo(NULL,ret,ErrMsg);
	return ret;
}
Esempio n. 5
0
cgiMain()
{
    int i;
    int waswhere = 0;
    int nosonuc = 0;
    int firsttime = 1;
    int nodaire=1;


    putenv("ORACLE_SID=yargitay");
    putenv("ORACLE_HOME=/u01/oracle/product/8.0.5");
    putenv("LD_LIBRARY_PATH=/u01/oracle/product/8.0.5/lib");
    putenv("NLS_LANG=TURKISH_TURKEY.WE8ISO8859P9");

    strcpy (uid.arr,"sorgu");
    uid.len=strlen(uid.arr);
    strcpy (pwd.arr,"sorgu");
    pwd.len=strlen(pwd.arr);

    cgiHeaderContent("text/html");
    cgiHtmlHead("T.C. Yargýtay Emsal kararlarý kanuna göre arama");
    cgiPrintf(
        "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-9\">");
    cgiPrintf(
        "<BODY TEXT=\"#ffffff\" BGCOLOR=\"#000000\" LINK=\"#FF0000\""
        " VLINK=\"#3333FF\""
        "ALINK=\"#FF0000\">"
        "<center>"
        "</img><img src=\"http://yargitay.gov.tr/images/yargi.JPG\"></img>"
        "<br>"
        "Ana sayfa için <a href=\"http://www.yargitay.gov.tr/\">http://www.yargitay.gov.tr</a>"
        " týklayýnýz"
        "</center>"
        "<HR>");

    cgiPrintf("<h2>Emsal Kararlarý Kanuna Göre Arama</h2>");
    cgiPrintf("Maddeye týkladýnýzda Esas Numarasýna göre týklayarak "
              "karara ulaþabilirsiniz."
              "<br>"
              "Görüþ ve önerileriniz için <a href=\"mailto:[email protected]\">"
              "[email protected]</a><br><br>");

    /* EXEC SQL CONNECT :uid IDENTIFIED BY :pwd using :dbname; */

    {
        struct sqlexd sqlstm;

        sqlstm.sqlvsn = 10;
        sqlstm.arrsiz = 4;
        sqlstm.sqladtp = &sqladt;
        sqlstm.sqltdsp = &sqltds;
        sqlstm.iters = (unsigned int  )10;
        sqlstm.offset = (unsigned int  )5;
        sqlstm.cud = sqlcud0;
        sqlstm.sqlest = (unsigned char  *)&sqlca;
        sqlstm.sqlety = (unsigned short)0;
        sqlstm.sqhstv[0] = (         void  *)&uid;
        sqlstm.sqhstl[0] = (unsigned int  )12;
        sqlstm.sqhsts[0] = (         int  )12;
        sqlstm.sqindv[0] = (         void  *)0;
        sqlstm.sqinds[0] = (         int  )0;
        sqlstm.sqharm[0] = (unsigned int  )0;
        sqlstm.sqadto[0] = (unsigned short )0;
        sqlstm.sqtdso[0] = (unsigned short )0;
        sqlstm.sqhstv[1] = (         void  *)&pwd;
        sqlstm.sqhstl[1] = (unsigned int  )12;
        sqlstm.sqhsts[1] = (         int  )12;
        sqlstm.sqindv[1] = (         void  *)0;
        sqlstm.sqinds[1] = (         int  )0;
        sqlstm.sqharm[1] = (unsigned int  )0;
        sqlstm.sqadto[1] = (unsigned short )0;
        sqlstm.sqtdso[1] = (unsigned short )0;
        sqlstm.sqhstv[2] = (         void  *)dbname;
        sqlstm.sqhstl[2] = (unsigned int  )10;
        sqlstm.sqhsts[2] = (         int  )10;
        sqlstm.sqindv[2] = (         void  *)0;
        sqlstm.sqinds[2] = (         int  )0;
        sqlstm.sqharm[2] = (unsigned int  )0;
        sqlstm.sqadto[2] = (unsigned short )0;
        sqlstm.sqtdso[2] = (unsigned short )0;
        sqlstm.sqphsv = sqlstm.sqhstv;
        sqlstm.sqphsl = sqlstm.sqhstl;
        sqlstm.sqphss = sqlstm.sqhsts;
        sqlstm.sqpind = sqlstm.sqindv;
        sqlstm.sqpins = sqlstm.sqinds;
        sqlstm.sqparm = sqlstm.sqharm;
        sqlstm.sqparc = sqlstm.sqharc;
        sqlstm.sqpadto = sqlstm.sqadto;
        sqlstm.sqptdso = sqlstm.sqtdso;
        sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
    }


    if(SQL_ERROR) {
        cgiPrintf("Veritabaný þu an bakým altýnda. Sonra deneyin. <p>BÝM");
        exit(0);
    }

    if(cgiFormGetVal("daire")) {
        strcpy(textdaire,          cgiFormGetVal("daire"));
        if(textdaire[0]!=0) {
            for(i=0; daireler[i].code; i++) {
                if(strcmp(daireler[i].code,textdaire)==0) {
                    cgiPrintf("<strong>Daire:</strong> %s<br>",daireler[i].name);
                    break;
                }
            }
            nodaire = 0;
        } else nodaire = 1;
    } else nodaire = 1;

    if(cgiFormGetVal("kanun")) {
        strcpy(kanun,          cgiFormGetVal("kanun"));
        cgiPrintf("<strong>Kanun:</strong> %s<br>",kanun);
    }


    if(nodaire) {
        /* EXEC SQL DECLARE kcura CURSOR FOR
        	SELECT madde, count(madde)
        	FROM emsal.kanun
        	WHERE kanun=:kanun
        	GROUP BY madde
        	ORDER BY madde
        ; */

    } else {
        strcpy(daireno,textdaire);
        /* EXEC SQL DECLARE kcur CURSOR FOR
        	SELECT madde, count(madde)
        	FROM emsal.kanun
        	WHERE daireno=:daireno AND
        		kanun=:kanun
        	GROUP BY madde
        	ORDER BY madde
        ; */

    }

    if(nodaire) {
        /* EXEC SQL OPEN kcura; */

        {
            struct sqlexd sqlstm;

            sqlstm.sqlvsn = 10;
            sqlstm.arrsiz = 4;
            sqlstm.sqladtp = &sqladt;
            sqlstm.sqltdsp = &sqltds;
            sqlstm.stmt = sq0002;
            sqlstm.iters = (unsigned int  )1;
            sqlstm.offset = (unsigned int  )36;
            sqlstm.cud = sqlcud0;
            sqlstm.sqlest = (unsigned char  *)&sqlca;
            sqlstm.sqlety = (unsigned short)0;
            sqlstm.sqhstv[0] = (         void  *)kanun;
            sqlstm.sqhstl[0] = (unsigned int  )256;
            sqlstm.sqhsts[0] = (         int  )0;
            sqlstm.sqindv[0] = (         void  *)0;
            sqlstm.sqinds[0] = (         int  )0;
            sqlstm.sqharm[0] = (unsigned int  )0;
            sqlstm.sqadto[0] = (unsigned short )0;
            sqlstm.sqtdso[0] = (unsigned short )0;
            sqlstm.sqphsv = sqlstm.sqhstv;
            sqlstm.sqphsl = sqlstm.sqhstl;
            sqlstm.sqphss = sqlstm.sqhsts;
            sqlstm.sqpind = sqlstm.sqindv;
            sqlstm.sqpins = sqlstm.sqinds;
            sqlstm.sqparm = sqlstm.sqharm;
            sqlstm.sqparc = sqlstm.sqharc;
            sqlstm.sqpadto = sqlstm.sqadto;
            sqlstm.sqptdso = sqlstm.sqtdso;
            sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
        }


    } else {
        /* EXEC SQL OPEN kcur; */

        {
            struct sqlexd sqlstm;

            sqlstm.sqlvsn = 10;
            sqlstm.arrsiz = 4;
            sqlstm.sqladtp = &sqladt;
            sqlstm.sqltdsp = &sqltds;
            sqlstm.stmt = sq0003;
            sqlstm.iters = (unsigned int  )1;
            sqlstm.offset = (unsigned int  )55;
            sqlstm.cud = sqlcud0;
            sqlstm.sqlest = (unsigned char  *)&sqlca;
            sqlstm.sqlety = (unsigned short)0;
            sqlstm.sqhstv[0] = (         void  *)daireno;
            sqlstm.sqhstl[0] = (unsigned int  )4;
            sqlstm.sqhsts[0] = (         int  )0;
            sqlstm.sqindv[0] = (         void  *)0;
            sqlstm.sqinds[0] = (         int  )0;
            sqlstm.sqharm[0] = (unsigned int  )0;
            sqlstm.sqadto[0] = (unsigned short )0;
            sqlstm.sqtdso[0] = (unsigned short )0;
            sqlstm.sqhstv[1] = (         void  *)kanun;
            sqlstm.sqhstl[1] = (unsigned int  )256;
            sqlstm.sqhsts[1] = (         int  )0;
            sqlstm.sqindv[1] = (         void  *)0;
            sqlstm.sqinds[1] = (         int  )0;
            sqlstm.sqharm[1] = (unsigned int  )0;
            sqlstm.sqadto[1] = (unsigned short )0;
            sqlstm.sqtdso[1] = (unsigned short )0;
            sqlstm.sqphsv = sqlstm.sqhstv;
            sqlstm.sqphsl = sqlstm.sqhstl;
            sqlstm.sqphss = sqlstm.sqhsts;
            sqlstm.sqpind = sqlstm.sqindv;
            sqlstm.sqpins = sqlstm.sqinds;
            sqlstm.sqparm = sqlstm.sqharm;
            sqlstm.sqparc = sqlstm.sqharc;
            sqlstm.sqpadto = sqlstm.sqadto;
            sqlstm.sqptdso = sqlstm.sqtdso;
            sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
        }


    }

    cgiPrintf("<TABLE>");
    cgiPrintf("<TR><TD><strong>Adet</strong></TD><TD><strong>Madde</strong></TD></TR>");
    while(1) {
        if(nodaire) {
            /* EXEC SQL FETCH kcura
            	INTO :madde:ind0, :count:ind1; */

            {
                struct sqlexd sqlstm;

                sqlstm.sqlvsn = 10;
                sqlstm.arrsiz = 4;
                sqlstm.sqladtp = &sqladt;
                sqlstm.sqltdsp = &sqltds;
                sqlstm.iters = (unsigned int  )1;
                sqlstm.offset = (unsigned int  )78;
                sqlstm.cud = sqlcud0;
                sqlstm.sqlest = (unsigned char  *)&sqlca;
                sqlstm.sqlety = (unsigned short)0;
                sqlstm.sqhstv[0] = (         void  *)madde;
                sqlstm.sqhstl[0] = (unsigned int  )16;
                sqlstm.sqhsts[0] = (         int  )0;
                sqlstm.sqindv[0] = (         void  *)&ind0;
                sqlstm.sqinds[0] = (         int  )0;
                sqlstm.sqharm[0] = (unsigned int  )0;
                sqlstm.sqadto[0] = (unsigned short )0;
                sqlstm.sqtdso[0] = (unsigned short )0;
                sqlstm.sqhstv[1] = (         void  *)&count;
                sqlstm.sqhstl[1] = (unsigned int  )4;
                sqlstm.sqhsts[1] = (         int  )0;
                sqlstm.sqindv[1] = (         void  *)&ind1;
                sqlstm.sqinds[1] = (         int  )0;
                sqlstm.sqharm[1] = (unsigned int  )0;
                sqlstm.sqadto[1] = (unsigned short )0;
                sqlstm.sqtdso[1] = (unsigned short )0;
                sqlstm.sqphsv = sqlstm.sqhstv;
                sqlstm.sqphsl = sqlstm.sqhstl;
                sqlstm.sqphss = sqlstm.sqhsts;
                sqlstm.sqpind = sqlstm.sqindv;
                sqlstm.sqpins = sqlstm.sqinds;
                sqlstm.sqparm = sqlstm.sqharm;
                sqlstm.sqparc = sqlstm.sqharc;
                sqlstm.sqpadto = sqlstm.sqadto;
                sqlstm.sqptdso = sqlstm.sqtdso;
                sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
            }


        } else {
            /* EXEC SQL FETCH kcur
            	INTO :madde:ind0, :count:ind1; */

            {
                struct sqlexd sqlstm;

                sqlstm.sqlvsn = 10;
                sqlstm.arrsiz = 4;
                sqlstm.sqladtp = &sqladt;
                sqlstm.sqltdsp = &sqltds;
                sqlstm.iters = (unsigned int  )1;
                sqlstm.offset = (unsigned int  )101;
                sqlstm.cud = sqlcud0;
                sqlstm.sqlest = (unsigned char  *)&sqlca;
                sqlstm.sqlety = (unsigned short)0;
                sqlstm.sqhstv[0] = (         void  *)madde;
                sqlstm.sqhstl[0] = (unsigned int  )16;
                sqlstm.sqhsts[0] = (         int  )0;
                sqlstm.sqindv[0] = (         void  *)&ind0;
                sqlstm.sqinds[0] = (         int  )0;
                sqlstm.sqharm[0] = (unsigned int  )0;
                sqlstm.sqadto[0] = (unsigned short )0;
                sqlstm.sqtdso[0] = (unsigned short )0;
                sqlstm.sqhstv[1] = (         void  *)&count;
                sqlstm.sqhstl[1] = (unsigned int  )4;
                sqlstm.sqhsts[1] = (         int  )0;
                sqlstm.sqindv[1] = (         void  *)&ind1;
                sqlstm.sqinds[1] = (         int  )0;
                sqlstm.sqharm[1] = (unsigned int  )0;
                sqlstm.sqadto[1] = (unsigned short )0;
                sqlstm.sqtdso[1] = (unsigned short )0;
                sqlstm.sqphsv = sqlstm.sqhstv;
                sqlstm.sqphsl = sqlstm.sqhstl;
                sqlstm.sqphss = sqlstm.sqhsts;
                sqlstm.sqpind = sqlstm.sqindv;
                sqlstm.sqpins = sqlstm.sqinds;
                sqlstm.sqparm = sqlstm.sqharm;
                sqlstm.sqparc = sqlstm.sqharc;
                sqlstm.sqpadto = sqlstm.sqadto;
                sqlstm.sqptdso = sqlstm.sqtdso;
                sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
            }


        }
        if(SQL_ERROR) {
            cgiPrintf(SQL_MESSAGE);
            exit(1);
        }
        if(SQL_NOTFOUND)break;
        cgiPrintf("<TR><TD>%d</TD>"
                  "<TD><A HREF=\"kanun3?daire=%s&madde=%s&kanun=%s\">"
                  "%s</A></TD></TR>",
                  count,nodaire?"":cgiEncodeUrl(daireno),cgiEncodeUrl(madde),
                  cgiEncodeUrl(kanun), madde);
    }
    cgiPrintf("</TABLE>");
    if(nodaire) {
        /* EXEC SQL CLOSE kcur; */

        {
            struct sqlexd sqlstm;

            sqlstm.sqlvsn = 10;
            sqlstm.arrsiz = 4;
            sqlstm.sqladtp = &sqladt;
            sqlstm.sqltdsp = &sqltds;
            sqlstm.iters = (unsigned int  )1;
            sqlstm.offset = (unsigned int  )124;
            sqlstm.cud = sqlcud0;
            sqlstm.sqlest = (unsigned char  *)&sqlca;
            sqlstm.sqlety = (unsigned short)0;
            sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
        }


    } else {
        /* EXEC SQL CLOSE kcura; */

        {
            struct sqlexd sqlstm;

            sqlstm.sqlvsn = 10;
            sqlstm.arrsiz = 4;
            sqlstm.sqladtp = &sqladt;
            sqlstm.sqltdsp = &sqltds;
            sqlstm.iters = (unsigned int  )1;
            sqlstm.offset = (unsigned int  )139;
            sqlstm.cud = sqlcud0;
            sqlstm.sqlest = (unsigned char  *)&sqlca;
            sqlstm.sqlety = (unsigned short)0;
            sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
        }


    }

}