Jump to content

easy function help


mikefrederick

Recommended Posts

Well don't do that, just notify the user that the login name is already in use. On your registration page, use this code

<?php
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
	echo '<ul class="err"><strong><font size=5>';
	foreach($_SESSION['ERRMSG_ARR'] as $msg) {
		echo '<li>',$msg,'</li>'; 
	}
	echo '</ul></strong</font>';
	unset($_SESSION['ERRMSG_ARR']);
}
?>

then make a register-exec.php and use this



$qry = "SELECT count(*) AS c FROM members WHERE login='$login'";
$result = mysql_query($qry);
if($result) {
	$result_array = mysql_fetch_assoc($result);
	if($result_array['c'] > 0) {
		$errmsg_arr[] = 'Login ID already in use';
		$errflag = true;
	}
	@mysql_free_result($result);
}
else {
	die("Query failed");
}

 

And obviously modify the select queries as needed.

 

This last piece of code checks to make sure that none of the required fields are missing, add more if u need.

             if($login == '') {
	$errmsg_arr[] = 'Login ID missing';
	$errflag = true;
}
if($password == '') {
	$errmsg_arr[] = 'Password missing';
	$errflag = true;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.