Habe jetzt einiges abgeändert jezt habe probleme beim auführen des programm ausgabe :
Code:
jan@dibsi:~/tuxist.de/tuxcms/cgi-bin$ ./index.cgi
Content-Type:text/html
<html>
<head>
<title>tuxist.de</title>
</head>
<body>
<form action="index.cgi" method=GET> <select name=" cssstyle" ><option>default</option><option>black</option><option>..</option><option>.</option>> </form>
</select><Input Type="submit" value="Switch Design">
Segmentation fault (core dumped)
gdb ausgabe:
Code:
(gdb) bt
#0 0x00002ae4f6c591c0 in cgi::anfrage () from /usr/lib/tuxcms/libhtml++.so
#1 0x00002ae4f6e5bcdf in htmlformsubmit::htmlformsubmit ()
from /usr/lib/tuxcms/libcss.so
#2 0x00002ae4f6e5b772 in libcss::libcssread () from /usr/lib/tuxcms/libcss.so
#3 0x0000000000400e4b in libcss::libcss ()
#4 0x0000000000400d4b in main ()
(gdb)
cgi.cpp
Code:
#include <iostream>
#include <string>
#include <fstream>
#include "include/libhtml++.h"
using namespace std;
string *cgi::anfrage()
{
*puffer = NULL;
char *request = getenv("REQUEST_METHOD");
if(NULL == request )
{
return NULL;
}
else if( strcmp(request, "GET") == 0 )
{
query = getenv("QUERY_STRING");
if( NULL == query )
{
return NULL;
}
}
else if ( strcmp(request, "POST") == 0 )
{
query = (getenv("CONTENT_LENGTH"));
}
else //bei Fehler oder keiner eingabe
return NULL;
}
string cgi::out(string formname)
{
if(query == NULL )
{
return NULL;
}
else
query1 = query;
int start;
int end;
start = query1.find(formname);
start += 1;
if (query1.find("&", start) !=string::npos )
{
end = query1.rfind(formname, end);
}
else
{
end = query1.find("&", start);
}
formname.substr(start,end);
}
string cgi::getcgi(string formname)
{
anfrage();
out(formname);
return (formname);
}
Code:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class cgi
{
private:
string query1;
public:
const char* value;
const char* query;
char *puffer;
string *anfrage();
string out(string formname);
string getcgi(string formname);
};
class htmlformsubmit : public cgi
{
private:
string submitname;
string methodform;
void inputsubmit( string submitname);
public:
htmlformsubmit(string submitname)
{
inputsubmit(submitname);
*anfrage();
};
};
class htmlformselect : public cgi
{
private:
void formselectdisplay(string formselectname, string formselectinput, string methodform);
public:
htmlformselect(string formselectname, string formselectinput, string methodform)
{
formselectdisplay (formselectname, formselectinput, methodform);
};
};
quellcode neu hochgeladen
Lesezeichen