Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 17:16

  • Please register to post and access all features, it's quick, easy and FREE!

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.

Reply
 
Old   #1
 
walmartboi's Avatar
 
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
walmartboi is offline  
Thanks
7 Users
Old 03/18/2010, 23:11   #2
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
goodjob , php looks nuts o-o
xScott is offline  
Old 03/18/2010, 23:13   #3
 
walmartboi's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
Quote:
Originally Posted by xScott View Post
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.
walmartboi is offline  
Old 03/18/2010, 23:18   #4
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
<3 I love it!
Arcо is offline  
Old 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.
PeTe Ninja is offline  
Old 03/18/2010, 23:47   #6
 
elite*gold: 0
Join Date: Nov 2009
Posts: 129
Received Thanks: 45
Quote:
Originally Posted by PeTe Ninja View Post
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.
~Falcon is offline  
Old 03/18/2010, 23:50   #7
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
Quote:
Originally Posted by ~Falcon View Post
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
PeTe Ninja is offline  
Old 03/19/2010, 00:00   #8
 
walmartboi's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
Quote:
Originally Posted by PeTe Ninja View Post
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.
walmartboi is offline  
Old 03/19/2010, 00:44   #9
 
Luiz01's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 110
Received Thanks: 32
Nice ! I liked it.
Luiz01 is offline  
Old 03/19/2010, 00:46   #10
 
walmartboi's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
Quote:
Originally Posted by Luiz01 View Post
Nice ! I liked it.
Thanks.
walmartboi is offline  
Old 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
LegalConquer is offline  
Old 03/19/2010, 12:21   #12
 
BEanErzzz's Avatar
 
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:
BEanErzzz is offline  
Old 03/19/2010, 22:10   #13
 
walmartboi's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
Quote:
Originally Posted by BEanErzzz View Post
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
walmartboi is offline  
Old 03/20/2010, 02:09   #14
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
Quote:
Originally Posted by walmartboi View Post
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..
PeTe Ninja is offline  
Old 03/20/2010, 03:23   #15
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Quote:
Originally Posted by LegalConquer View Post
why dont u add a captcha XD
I would love if someone released a captcha reg lol.
Arcо is offline  
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.