|
You last visited: Today at 17:16
Advertisement
[Release]E-mail validity checker for register pages!
Discussion on [Release]E-mail validity checker for register pages! within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
03/18/2010, 23:04
|
#1
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
[Release]E-mail validity checker for register pages!
Well, I got a bit bored, and decided I need something like this, and you guys do too, so here's a little e-mail validity checker I coded up:
PHP Code:
<?php function checkemail($email) { if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { return false; } $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if(!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&↪'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|↪([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } ?>
Add that function to the TOP of your register completion page, and use it like this in all your checks for it:
PHP Code:
$email = trim($_POST['email']); if(!checkemail($email)) { echo 'Invalid email address!'; } else { echo 'Email address is valid'; }
NOTE: If you don't know what this does, just don't bother posting.
ANOTHER NOTE: If you use this on your site, please give small little credits to how I helped
|
|
|
03/18/2010, 23:11
|
#2
|
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
|
goodjob , php looks nuts o-o
|
|
|
03/18/2010, 23:13
|
#3
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Quote:
Originally Posted by xScott
goodjob , php looks nuts o-o
|
Thanks for the feedback :P It actually wasn't too hard to code, considering how similar PHP is to C#. It works perfectly btw.
|
|
|
03/18/2010, 23:18
|
#4
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
<3 I love it!
|
|
|
03/18/2010, 23:43
|
#5
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
You could also check it just do something like...
$results = mysql_query(Select * FROM `accounts` Where `email` == $email);
if ($results == 1)
echo 'Email already in use';
else
echo 'Good email';
something of that knowledge.
|
|
|
03/18/2010, 23:47
|
#6
|
elite*gold: 0
Join Date: Nov 2009
Posts: 129
Received Thanks: 45
|
Quote:
Originally Posted by PeTe Ninja
You could also check it just do something like...
$results = mysql_query(Select * FROM `accounts` Where `email` == $email);
if ($results == 1)
echo 'Email already in use';
else
echo 'Good email';
something of that knowledge.
|
He's checking whether its a valid e-mail, not whether its already in use.
|
|
|
03/18/2010, 23:50
|
#7
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
Quote:
Originally Posted by ~Falcon
He's checking whether its a valid e-mail, not whether its already in use.
|
I know.. I showed them if you want to check if it's in use.. I can read PHP
|
|
|
03/19/2010, 00:00
|
#8
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Quote:
Originally Posted by PeTe Ninja
You could also check it just do something like...
$results = mysql_query(Select * FROM `accounts` Where `email` == $email);
if ($results == 1)
echo 'Email already in use';
else
echo 'Good email';
something of that knowledge.
|
This script is only to check if the email address is real, not some jibberish stuff a spammer typed in.
|
|
|
03/19/2010, 00:44
|
#9
|
elite*gold: 0
Join Date: Apr 2009
Posts: 110
Received Thanks: 32
|
Nice ! I liked it.
|
|
|
03/19/2010, 00:46
|
#10
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Quote:
Originally Posted by Luiz01
Nice ! I liked it.
|
Thanks.
|
|
|
03/19/2010, 03:00
|
#11
|
elite*gold: 0
Join Date: Sep 2009
Posts: 321
Received Thanks: 60
|
why dont u add a captcha XD
|
|
|
03/19/2010, 12:21
|
#12
|
elite*gold: 0
Join Date: Nov 2005
Posts: 122
Received Thanks: 186
|
AJAX version using the RFC official email validity regex string.
Code:
function isValidEmail (email){
return /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(email);
}
function checkEmail(){
if(isValidEmail(txtEmail.value)){
SetMessage(msgEmail, "The email appears valid", "green");
emailValid = true;
}else{
SetMessage(msgEmail, "The email appears invalid", "red");
emailValid = false;
}
setPostValid();
}
Preview here:
|
|
|
03/19/2010, 22:10
|
#13
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Quote:
Originally Posted by BEanErzzz
AJAX version using the RFC official email validity regex string.
Code:
function isValidEmail (email){
return /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(email);
}
function checkEmail(){
if(isValidEmail(txtEmail.value)){
SetMessage(msgEmail, "The email appears valid", "green");
emailValid = true;
}else{
SetMessage(msgEmail, "The email appears invalid", "red");
emailValid = false;
}
setPostValid();
}
Preview here:
|
Looks nice, but I made mine from scratch, so you have to give me some kudos for that :P
|
|
|
03/20/2010, 02:09
|
#14
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
Quote:
Originally Posted by walmartboi
This script is only to check if the email address is real, not some jibberish stuff a spammer typed in.
|
does anyone read my posts? or do you just look at the code..
|
|
|
03/20/2010, 03:23
|
#15
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by LegalConquer
why dont u add a captcha XD
|
I would love if someone released a captcha reg lol.
|
|
|
|
|
Similar Threads
|
[Release] ConquerSx Register & Change Pass Pages
11/09/2011 - CO2 PServer Guides & Releases - 35 Replies
Hi all this is my php script for ConquerSx source with cool design hope you enjoy it
screenshot
http://i48.tinypic.com/1y74b5.jpg
and here is config.php which you must edit
<?php
//Database
|
[Release/Guide]All Pages of a Website
09/03/2011 - EO PServer Guides & Releases - 13 Replies
Hello all!
Im going to give out the 'Pages' as they say to your website. I modified my ones of course, But Go ahead, Modify for your need also. The Red Color ones, You need to change because without those, It will not function correct.
This includes:
All Rankings
Banned Players
Broadcast
|
[QUESTION] Where Do I Release Registration Pages?
01/25/2010 - CO2 Private Server - 6 Replies
Where do i release registration pages that i have made?
|
Register Pages
06/30/2008 - EO PServer Hosting - 3 Replies
There are alot of Websites on the Private servers list Whose Register pages do not Work CAN U PLEASE FIX THAT Theres no point of you being there if you cant fix ur register page and ur Server has been there for months
|
All times are GMT +2. The time now is 17:16.
|
|