ceegeye library

latest release 2.0.2
ceegeye is a C++ library for creating CGI (Common Gateway Interface) programs. The library comes with several example programs to help you get acquainted with its usage. If you are familiar with C/C++ it will be quick to learn. It also in-cooperates an XHTML class for displaying web content. If you need some kind of interpreted programming language (i.e. PHP or Perl) please see the links on the left of this page. ceegeye is free software subject to the terms of the GPL License.

How to uncompress and compile the library

To use the library, create a basic C++ file as below. In your main function just instantiate an instance of the CGI object class. One other caveat, we must close the http header to the browser, calling xhtml::pagebegin( ) accomplishes this for us. At this point any data sent to the xhtml object gets sent to the requesting browser. Here is code for the typical hello world programming example but in ceegeye speak.

#include <ceegeye/ceegeye.h>
using namespace ceegeye;
int main(int argc, char* argv[ ], char *envp[ ]) {
  CGI cgi; // instantiate our CGI object
  xhtml p(cgi); // encapsulates xhtml output
  p.pagebegin("Hello World demo"); // open WepPage.
  p.body( );
  p.div( ); // keep well formed xhtml
  p << "Hello World";
  p.divend( );
  return 0;

Once we have an instance of CGI we can use its member functions to extract data sent by browsers to the web server. Of course a form is needed for the user of the browser to inform us what data to process. In the case of the simpleform demo program the cgi program is also called to display this form. It is probably easier to use a program to specifically write form pages for us (i.e. wysiwyg html page editor). To make it easier for users of ceegeye to get up and running I have the demo programs display the forms needed by the CGI. Just compile the demo programs and browse to them from a web browser. Obviously your web server will have to have CGI enabled, with the correct file permissions set on the files for the cgi’s to work. There are only a few functions in the interface to use:

bool GetValue(const string& valuename, vector<char>& filedata, string& data);
bool GetValue(const string& valuename, string& data);

and the CGI environment variable functions.
if we have a simple form on a web page e.g.

<form method="post" action="/cgi-bin/simpleform.cgi"
 <input type="text" name="firstname">
 <input type="submit" name="submit" value="Submit">

When the form is submitted we can use the GetValue( ) member of class CGI to retrieve the user entered data in the form:

string name;
cgi.GetValue("firstname", name);

name will now hold the value the user entered into the text field on the form if the form is submited.

Example demo/programs that are included with this library:

  • helloworld
  • simpleform
  • cookie
  • webpage
  • ajax/mysql demo documentation
  • session
  • file uploading
  • environment variables
  • a simple logging class

Programs that use ceegeye

  • Qmailctl.cgi CGI program that controls the qmail email server
  • FireLance CGI to control an iptables firewall.