Orionsbelter Posted May 18, 2008 Share Posted May 18, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/106156-help-register-page/ Share on other sites More sharing options...
runnerjp Posted May 18, 2008 Share Posted May 18, 2008 <?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) ?> Quote Link to comment https://forums.phpfreaks.com/topic/106156-help-register-page/#findComment-544121 Share on other sites More sharing options...
micmania1 Posted May 18, 2008 Share Posted May 18, 2008 $badwords = array('word1', 'word2', 'word3')'; if (array_value_exists($_POST['username'], $badwords)) { die ("BAD WORD"); } else { die ("FINE"); } Quote Link to comment https://forums.phpfreaks.com/topic/106156-help-register-page/#findComment-544125 Share on other sites More sharing options...
scarhand Posted May 18, 2008 Share Posted May 18, 2008 $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. "[email protected]" 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 Quote Link to comment https://forums.phpfreaks.com/topic/106156-help-register-page/#findComment-544176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.