Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Gate() or flow control problem
icon7.gif  Re: Gate() or flow control problem [message #10471 is a reply to message #10466] Wed, 11 July 2007 01:59 Go to previous messageGo to previous message
pntkl is currently offline  pntkl
Messages: 4
Registered: July 2007
Junior Member
Ok,

I understand what you're saying, Mirek. I'm not sure what gave me the impression I needed to use THISBACK(); in the condition... Wink

Thanks again, Mirek. Now I just need to find out what my Sha1 instance is doing... Smile

<EDIT>
I was calling the instance in the header file, instead of in its proper scope (User::Add()).
</EDIT>

Is crypto.h going to include other algorithms and will it be documented at all? It took me a while to realize crypto. Confused

These are the relevant code changes:

void
User::Add()
{
	if(!IsNull(~modify.EditFName) && !IsNull(~modify.EditLName) && !IsNull(~modify.EditUser) && !IsNull(~modify.EditPass) && !IsNull(~modify.DropGroup))
	{
		//if(!Gate(Validate())) <-- Removed.
		match = false;
		Validate();
		if(!match) // <-- bool match; added to User.h
		{
			Sha1 sha; // <-- Removed from User.h
			sha.Put(~modify.EditPass);
			String hashpass = sha.Finish();
			userarray.Add(~modify.EditFName, ~modify.EditLName, ~modify.EditUser, hashpass, ~modify.DropGroup);
			userarray.GoEnd();
			modify.EditFName <<= modify.EditLName <<= modify.EditUser <<= modify.EditPass <<= modify.DropGroup <<= Null;
			ActiveFocus(modify.EditFName);
			// sha.Put("", 0); <-- Removed. What was I thinking?!
		}
		else
			PromptOK("First and last name or user already exists!");
	}
	else
		PromptOK("Please complete all fields!");
}

void
User::Validate()
{
	int rcount = userarray.GetCount();
	if(rcount > 0)
	{
		for(int i = rcount - 1; i >= 0; i--)
		{
			String strFirstName = ~modify.EditFName;
			String strColFirstName = userarray.GetColumn(i, 0); // Get the First Name
			String strLastName = ~modify.EditLName;
			String strColLastName = userarray.GetColumn(i, 1); // Get the Last Name
			String strUser = ~modify.EditUser;
			String strColUser = userarray.GetColumn(i, 2); // Get the User Name
				
			if(CompareNoCase(strFirstName, strColFirstName) && CompareNoCase(strLastName, strColLastName) || CompareNoCase(strUser, strColUser))
			{
				match = false; // <-- Reversed, I guess CompareNoCase returns true--with no match?
			}
			else
			{
				match = true;
				break;
			}
		}
	}
	else
	{
		match = false;
	}
}

[Updated on: Wed, 11 July 2007 02:45]

Report message to a moderator

 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon7.gif
Read Message
Previous Topic: asm int 3, abort();
Next Topic: Problem using Split on carriage return
Goto Forum:
  


Current Time: Mon Jul 14 05:47:06 CEST 2025

Total time taken to generate the page: 0.03722 seconds