Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 20:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Hilfe]CGI-Parser

Discussion on [Hilfe]CGI-Parser within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Preakz's Avatar
 
elite*gold: 0
Join Date: Feb 2012
Posts: 84
Received Thanks: 22
Exclamation [Hilfe]CGI-Parser

Hallo Liebe Community...
ich habe leider ein Problem und zwar haben wir ein CGI-Projekt von unserem Lehrer auf's Auge gedrückt bekommen. Ich habe den CGI-Parser soweit aber sobald er mehr als 5 Keywords übergeben kriegt zählt er nurnoch die Länge hoch und ich verstehe absolut nicht warum.
PS: Ja ich weiß man könnte den Parser auch mit Maps besser realisieren jedoch dürfen wir nur Stoff den wir im Unterricht durchgenommen haben verwenden... :/

Hier mal die Funktion (HTML[] ist der POST der eingelesen wurde ( KEYWORD=DATA&KEYWORD=...&...), HTMLData die Struktur indem ich das getrennte speichere und verwalte ):

Code:
//HTMLString Splitten
void MakeUseable( char HTML[] , THTMLData *HTMLData)
{
	/****************************************
	 *				Parser					*
	 ****************************************/
	//Variablen
	int HTML_size			= StrLaenge(HTML);
	int Keywords			= 0;
	int Charcount			= 0;
	int MAX_Kw_Lengh		= 0;
	int MAX_kw_Data_Lengh	= 0;
	
	//Temp Vars
	char	TempChar		= ' ';
	int		TempKLengh		= 0;
	int		TempKDLengh		= 0;
	bool	Fall			= false;


	//Zeichen zählen
	for(int i=0; HTML[i] != '\0'; i++)
		Charcount++;

	//Leerzeichen setzen
	for(int i=0; HTML[i] == '\0'; i++)
		if( HTML[i] =='+' )
			HTML[i] = ' ';

	// Fall 0=Keyword 1=KeywordData
	for(int i=0; HTML[i] != '\0'; i++)
	{
		if( Fall == false )
		{
			//MAX_Keyword-Länge zählen
			TempKLengh++;
			if( HTML[i] == '=' )
			{
				Keywords++;
				if( TempKLengh > MAX_Kw_Lengh )
				{
					MAX_Kw_Lengh = TempKLengh-1;
					TempKLengh = 0;
					Fall = true;
				}
			}
		}
		if( Fall == true )
		{
			//MAX_Keyword-Data-Länge zählen
			TempKDLengh++;
			//cout << TempKDLengh<<endl;
			if( HTML[i] == '&' || HTML[i+1] == '\0' )
			{
				if( TempKDLengh > MAX_kw_Data_Lengh )
				{
					MAX_kw_Data_Lengh = TempKDLengh-1;
					TempKDLengh = 0;
					Fall = false;
				}
			}
		}
	}

	cout << "Keywordlänge = " << MAX_Kw_Lengh << endl;
	cout << "KeywordData_l= " << MAX_kw_Data_Lengh << endl;
	cout << "Anz_Keywords = " << Keywords << endl;
	system("pause");

	HTMLData->num_of_Keywords		= Keywords;
	HTMLData->num_of_Keywordlengh	= MAX_Kw_Lengh;
	HTMLData->num_of_Datalengh		= MAX_kw_Data_Lengh;

	if(Keywords > 0 && MAX_kw_Data_Lengh > 1)
	{
		//Dynamischen Speicher anlegen...
		HTMLData->Keywords = new char*[Keywords];

		//Keywords
		for(int b=0; b<Keywords; b++)
		{
			//cout << b;
				HTMLData->Keywords[b] = new char[MAX_Kw_Lengh+1];
				//cout << "laenge=" << a << endl;
		}

		HTMLData->Data = new char*[Keywords+1];

		//Data
		for(int b=0; b<Keywords; b++)
		{
			//cout << b;
				HTMLData->Data[b] = new char[MAX_kw_Data_Lengh+1];
				//cout << "laenge=" << a << endl;		
		}

		int pos = 0;
		int lengh = 0;
	
		for(int a=0; a < Keywords; a++)
		{

				for(int bla=pos; HTML[bla] != '='; bla++)
				{
					HTMLData->Keywords[a][lengh] = HTML[bla];
					++lengh;
					pos +=1;
					//cout << "POS: " << pos << endl;
				}
				HTMLData->Keywords[a][lengh] = '\0';
				cout << "FULL STRING:"<< HTMLData->Keywords[a] << endl;
				lengh = 0;pos += 1;
	
				for(int coo=pos; HTML[coo] != '&' && HTML[coo] != '\0'; coo++)
				{
					HTMLData->Data[a][lengh] = HTML[coo];
					++lengh;
					pos += 1;
				}
				HTMLData->Data[a][lengh] = '\0';
				cout << "FULL STRING DATA:"<< HTMLData->Data[a] << endl;
				lengh = 0;pos +=1;
		
		}

	}
	//cout << "FINISH" << endl;

	
}
Ich hoffe mir kann da jemand behilflich sein :S
MfG Preakz


EDIT : /CLOSE FEHLER GEFUNDEN
Preakz is offline  
Reply


Similar Threads Similar Threads
NPC.ini Parser
03/13/2011 - CO2 Programming - 1 Replies
Ah, well I know this is REALLY simple, but as I was rummaging through my hard drive, I found something that might be useful to some people. It pretty much goes through the npc.ini and parses the data and writes it to a new text file, and writes it like this, 10-19 Storekeeper Yeah its pretty simple, but it should help most people. You MIGHT need to change the value of the 1122 in "for (int x = 1; x < 1122; x++)" depending on what patch the npc.ini is. using System; using...
Item-Parser
07/13/2010 - Diablo 2 - 17 Replies
D2Parser Diesen Parser hab ich mir runtergeladen. Hab alles nach Anleitung befolgt, aber: Wenn ich D2 per Parser starte und mich in Europe einlogge, dort mit nem Char ingame gehe und dann anschließend aus dem Spiel wieder austrete wird keine .xml Datei erstellt, es gibt auch garkeinen d2plog-Ordner im Hauptverzeichnis. Jemand eine Ahnung was ich vergessen hab?
Item Parser Hilfe
05/29/2010 - Diablo 2 - 2 Replies
bekomme öfter den fehler typ1 is not a function bla kommt nur bei kiefernknochen hut : == jawboneCap # ( >= 1 || >= 1 || >= 1 ) && ( >= 1 || >= 1 || >= 1 ) && <= 9 == fangedHelm # ( >= 1 || >= 1 || >= 1 ) && ( >= 1 || >= 1 || >= 1 ) && <= 9 == jawboneCap # ( >= 1 || >= 1 ) && ( >= 1 || >= 1 ) && <= 9 == fangedHelm # ( >= 1 || >= 1 ) && ( >= 1 || >= 1 ) && <= 9
Parser
04/08/2009 - FFXI Exploits, Hacks, Bots, Tools & Macros - 0 Replies
Hello, sorry i have been looking for a parser for some time and have tried many different ones and none seem to work in some way or another, most of the time its compatibility issues (vista x64) or some .net framework problem or something. The ones i did get working only displayed my data (which was innacurate btw) and did not display anyone elses data that was in the party. If anyone can help it would be greatly appreciated, thanks ^^
FFXI Parser
04/06/2006 - FFXI Exploits, Hacks, Bots, Tools & Macros - 10 Replies
FFXI Parser Für alle die jemanden was beweisen müssen ;D Setup Download



All times are GMT +1. The time now is 20:41.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.