Jump to content


Error creating member: wrong auth


3 replies to this topic

#1 Smilie

    Newbie

  • Active Member
  • Pip
  • 12 posts
  • Gender:Male

Posted 15 October 2011 - 04:55 PM

Hi,
I get the following errors when trying to add a new member:
IPBWI Errors
Error: #1: wrong_auth
Error: #2: That username is already taken
Error: #3: That username is already taken
Error: #4: That username is already taken
Error: #5: That username is already taken
Error: #6: That username is already taken
Error: #7: That username is already taken
Error: #8: That username is already taken
Error: #9: That username is already taken
Error: #10: That username is already taken

I'm using a code based on the one provided in the example.. please share your ideas :P

if ($_GET["op"] == "do")
{
  
	$email = mysql_real_escape_string($_POST['email']);
	$password = mysql_real_escape_string($_POST['password']);
	$username = mysql_real_escape_string($_POST['username']);
	$displayname = mysql_real_escape_string($_POST['displayname']);
	$sha1pass = sha1(strtoupper($username).":".strtoupper($password));
						// convert custom_fields in a custom array
   // first check, which custom fields exists
   $customFields = $ipbwi->member->listCustomFields();
   // load fielddatas
   foreach($customFields as $field){
	// get delivered field datas
	if(isset($_POST['field_'.$field['pf_id']])){
	 $fieldDatas['field_'.$field['pf_id']] = $_POST['field_'.$field['pf_id']];
	}else{
	 $fieldDatas['field_'.$field['pf_id']] = '';
	}
  
	if($ipbwi->member->create($username, $password, $email, $fieldDatas, true, $displayname)){
	if($ipbwi->member->login($username, $password)){
	 header('location: '.ipbwi_WEB_URL).die();
	}
   }
				  }
					  
	echo $ipbwi->printSystemMessages();

Edited by Smilie, 15 October 2011 - 04:57 PM.


#2 Smilie

    Newbie

  • Active Member
  • Pip
  • 12 posts
  • Gender:Male

Posted 16 October 2011 - 02:29 PM

Okay, so my members do get created, still wondering why it print the error message, and why so many times, when it's clearly not the case?

#3 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9234 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 17 October 2011 - 06:43 PM

it seems that the script is called multiple times when when account creation form is send. please try this test snippet instead of your code pasted above for testing purposes:
if ($_GET["op"] == "do")
{
if(intval($GLOBALS['ipbwi_testcount']) < 1){
$GLOBALS['ipbwi_testcount'] = 1;
}
 
		$email = mysql_real_escape_string($_POST['email']);
		$password = mysql_real_escape_string($_POST['password']);
		$username = mysql_real_escape_string($_POST['username']);
		$displayname = mysql_real_escape_string($_POST['displayname']);
		$sha1pass = sha1(strtoupper($username).":".strtoupper($password));
												// convert custom_fields in a custom array
   // first check, which custom fields exists
   $customFields = $ipbwi->member->listCustomFields();
   // load fielddatas
   foreach($customFields as $field){
		// get delivered field datas
		if(isset($_POST['field_'.$field['pf_id']])){
		 $fieldDatas['field_'.$field['pf_id']] = $_POST['field_'.$field['pf_id']];
		}else{
		 $fieldDatas['field_'.$field['pf_id']] = '';
		}
 
		if($ipbwi->member->create($username, $password, $email, $fieldDatas, true, $displayname)){
		if($ipbwi->member->login($username, $password)){
		 header('location: '.ipbwi_WEB_URL).die();
		}
   }
echo '<p>IPBWI member creation '.$GLOBALS['ipbwi_testcount'].' counts runned</p>';
 
$GLOBALS['ipbwi_testcount']++;
 
								  }
										
		echo $ipbwi->printSystemMessages();


#4 Smilie

    Newbie

  • Active Member
  • Pip
  • 12 posts
  • Gender:Male

Posted 18 October 2011 - 06:22 PM

No worries, got it solved, apparently there was an issue with the for each loop.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users