By the time the 
printf("Content-Type: text/html; charset=%s\r\n", (LocalCharset.size()) ? 
LocalCharset.c_str() : "iso-8859-1");
is executed, no template has been read.

The patch is as follows:


==========================================================================================================
--- sc.cpp      Thu Mar 15 14:28:17 2001
+++ sc.new.cpp  Thu Mar 15 14:26:12 2001
@@ -145,12 +145,6 @@
        InitRand();
        InitCharset();
 
-       // Load query result template
-       if (LoadTemplate(templ, cgiQuery.m_query_words.c_str()))
-       {
-               printf("<html><body>Can't open template file '%s'!</body></html>\n", 
templ);
-               return 0;
-       }
        // Output Content-Type if run under web server
        // Some servers do not pass QUERY_STRING if the query was empty,
        // so we check REQUEST_METHOD as well to be safe
@@ -160,6 +154,12 @@
                printf("Content-Type: text/html; charset=%s\r\n", 
(LocalCharset.size()) ? LocalCharset.c_str() : "iso-8859-1");
                if (cgiQuery.m_take == 0)
                        printf("\r\n");
+       }
+       // Load query result template
+       if (LoadTemplate(templ, cgiQuery.m_query_words.c_str()))
+       {
+               printf("<html><body>Can't open template file '%s'!</body></html>\n", 
+templ);
+               return 0;
        }
        cgiQuery.FormQuery();
        // Print TOP and if no query BOTTOM
==========================================================================================================

Sorry if this has been answered before.


-- 
�������� ��������
Application Developer
Eurisko A.E.
�������� 9
106 71 �����
���: +301 3633362
���: +301 3633074
e-mail: [EMAIL PROTECTED]

Reply via email to