Jump to content

How to restrict user to use a specific e-mail address when registering?


Recommended Posts

hi,

 

I want my users to use specific e-mail address that mean,

 

when ever my user register on my site services

 

they will use only my e-mail service @thextremezik.com

 

following is my registering code

 

<?php

/*** Pirates of the Black Sea | Check RPGBUNNY.COM for more Full RPG Sources | www.rpgbunny.com ***/include "antet.php"; include "func.php";
$config=config();
if (!$config[3][1]) msg($lang['regClosed']);
$factions=factions();
$_SESSION["code"]=rand(1000, 9999);
?>
<html>
<?php echo "<link rel='stylesheet' type='text/css' href='".$imgs.$fimgs."default.css'>"; ?>

<head>
<title><?php echo $title; ?> - <?php echo $lang['register'] ?></title>
</head>

<body class="q_body">

<link rel="stylesheet" type="text/css" href="layout/css/css/style.css"/>
<div align="left">


<table class="q_table">
	<form name="form1" method="post" action="register_.php">
	  <label><?php echo $lang['username'] ?>
	  <input class='textbox' type="text" name="name">
	  </label>
                <p>
                  <label><?php echo $lang['password'] ?>
                  <input class='textbox' type="password" name="pass">
                  </label>
          </p>
                <p>
                  <label><?php echo $lang['retypePass'] ?>
                  <input class='textbox' type="password" name="pass_">
                  </label>
                </p>
                <p>
                  <label><?php echo $lang['validEmail'] ?>
                  <input class='textbox' type="text" name="email">
                  </label>
                </p>
                <p>
                  <label><?php echo $lang['faction'] ?>
                  <select class='dropdown' name="faction">
			  <?php for ($i=0; $i<count($factions); $i++) echo "<option value='".$i."'>".$factions[$i][1]."</option>"; ?>
			  </select>
                  </label>
                </p>
                <p>
                  <label><?php echo $lang['typeCode'] ?> '<?php echo $_SESSION["code"];?>'<img src="captcha.php">
                  <input class='textbox' type="text" name="code">
                  </label>
                </p>
                <p>
                  <label>
                  <input class='button' type="submit" name="reg" value="<?php echo $lang['submit'] ?>">
                  </label>
                </p>
	</form>		</td>
</tr>
</table>


</div>

</body>

</html>

 

see registeration page http://piratesoftheblacksea.thextremezik.com/

 

please help me

In theory the second one is easier, but it can allow for invalid emails to be validated which could lead to all sorts of problems depending on what you use the email address for. It did point out to me I forgot "$" at the end of my regex example.

Even easier, don't allow the user to enter in their domain at all, just the username portion of the email. Then in your code, assume that the domina is the one you specify. On the actual form, display the domain name to the right of the input field so the user understands that the domain is assumed

 

<input type="text" name="uname" > @thextremezik.com

 

Then just validate that the value has letters, numbers, undercore, dash, plus sign & periods. Of course the value can't begin or end with a period or have two periods in succession.

thank you for your answers

 

can you please tell me where I should add this code,

 

or please add this code for me

 

This one

if(!preg_match('~\@thextremezik\.com$~i', $EmailVar))

 

or any other

 

thanks

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.