Jump to content

help register page


Orionsbelter

Recommended Posts

hi can some help me i have a email input where i want it to echo invaild when someone gives an invaild email because people aren't sigining up with real emails, also can some show me the scripts for stopping people sigining up with bad username like twat. or dick etc. thanks:D

Link to comment
Share on other sites

<?php 
// Function to check whether a given hostName is a valid email
// domain address.
function myCheckDNSRR($hostName, $recType = '')
{
if(!empty($hostName)) {
	if( $recType == '' ) $recType = "MX";
	exec("nslookup -type=$recType $hostName", $result);
	// check each line to find the one that starts with the host
	// name. If it exists then the function succeeded.
	foreach ($result as $line) {
		if(eregi("^$hostName",$line)) {
			return true;
		}
	}
	// otherwise there was no mail handler for the domain
	return false;
}
return false;
}

// If you are running this test on a Windows machine, you'll need to
// uncomment the next line and comment out the checkdnsrr call:
//if (myCheckDNSRR("joemarini.com","MX"))
if (checkdnsrr("joemarini.com","MX"))
echo "yup - valid email!";
else
echo "nope - invalid email!";
?>

 

annndd you bad words one i use this

 

<?php function filterBadWords($str){

// words to filter
$badwords=array( "[naughty word removed]", "[naughty word removed]", "[no swearing please]", "[oops]", "[oops]", "[naughty word removed]", "[oops]", "[oops]" );

// replace filtered words with
$replacements=array( "[naughty word removed]", "[how wude!]", "[no swearing please]" );

for($i=0;$i < sizeof($badwords);$i++){
  srand((double)microtime()*1000000); 
  $rand_key = (rand()%sizeof($replacements));
  $str=eregi_replace($badwords[$i], $replacements[$rand_key], $str);
}
return $str;
}

example call : $your_text_on_page = filterBadWords($your_text_from_comments) ?>

Link to comment
Share on other sites

$email = $_POST['email'];

if (isset($_POST['submit']))
{
  if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
  {
    echo 'You have entered an invalid email address';
  }
  else
  {
    // the email address is valid, so do stuff here
  }
}

 

this will check to see if the email address is using standard email formatting.

 

i.e. "joe@mymail.com" will work, where "joemail.com" or "joe@joemail" will not

 

micmania's simple bad word solution will work for the naughty words you do not want

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.