473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can i validate the email, so it's not fake...

117 100+
Ok, recently i found over 35 fake emails signed up on my site using .con .fk .up .ip .nk .dk and no @ sign so i need to make it so it requires a real email.

mymail@yahoo.com or others but no mymail.host253.dk!
This is how i have it now what do i need to add?

[PHP]$error = false;
$errormessage = "";

if (strlen($emailaddress) < 1) {
$error = true;
$msg .= "Sorry. You did not enter an email address.";
} else {

$sql = "select * from subscribers where emailaddress = '$emailaddress'";[/PHP]

And 3 signed up to be members no "ip or email" submited but in the about me feild was links to there site porn ewwweeee.
I HATE THEM ALREADY!

So i need to get help making a security code on the register page so if it is not entered no signup1

I would like to make it with words not numbers, random.
Please help i cant have this going on i just got listed in the search now this :(
Sep 5 '07 #1
6 1941
You can use regular expressions for that.

Please see http://www.regular-expressions.info/email.html and http://www.php.net/preg_match

:)

--[Edit]--
Sorry, I didn't read all the way through. If you don't like the required email format trick above, then it looks like you want a form of "CAPTCHA". Here's a nice tutorial for that :)

http://www.white-hat-web-design.co.u...hp-captcha.php
Sep 5 '07 #2
Breana
117 100+
I got the chapa working, it say no code entered if i dont but the image wont pop up/show why?

I need to get this fixed.
I added a .httaccess file with the rite on but nothing...

Expand|Select|Wrap|Line Numbers
  1.  Remove Flags
  2.  
  3. memory_limit
  4.  
  5. 18M
  6.     Delete
  7. gamehackers.ifastnet.com
  8.  
  9. register_globals
  10.  
  11. On
  12.     Delete
  13. gamehackers.ifastnet.com
  14.  
  15. magic_quotes_gpc
  16.  
  17. On
  18.     Delete
  19. gamehackers.ifastnet.com
  20.  
  21. magic_quotes_runtime
  22.  
  23. On
Sep 5 '07 #3
Atli
5,058 Expert 4TB
Hi.

You need to have the GD extension in order for the Captcha code to work.

If that is all in order, could you show us the code that you use to display the image?
Sep 5 '07 #4
Breana
117 100+
Can i install the gd on my free host? i havent got the paid host yet...

[PHP]<tr>
<td colspan="2"><font color="#003366" size="1" face="Arial"><br />
<img src="images/Dotted_Border.png" width="500" height="10" /><br />
Security Code.</font></td>
</tr>
<tr>
<td><img src="../CaptchaSecurityImages.php" /></td>
<td><input id="security_code" name="security_code" type="text" /></td>
</tr>[/PHP]

Or can it be done with words or numbers not an image?
I just want simple not high tech..
Sep 6 '07 #5
Breana
117 100+
Is it possible to have it load in a textbox not an image, i have seen several sites doing it that way or with plane text.

I just need it to be simple like that i have been searching all morning but no luck...
Sep 6 '07 #6
Breana
117 100+
UPDATE, well i founf a nice chapa and it works but i am having trouble intragrating it into my error string!

I want it not to exit and be in the same error string as the rest, if no echo error and so on..
Be cause as it sits now it echos error bad code but if the rest is ok it still creats the users lol.

Here is the new code.
On the form.
[PHP]<tr>
<td colspan="2"><?php
// vim:set ts=4 sw=4 ai:
include('CaptchaSecurityImages.php');

$guess = $_REQUEST['guess'];

$c = new Craptcha( $_SERVER['REMOTE_ADDR'] );
?>
<font color="#003366" size="1" face="Arial">What is the total of</font> <font color="#FF0000" size="-2"><?=$c->toString()?>?</font><br />
<input type="text" name="guess">
<font color="#003366" size="1" face="Arial">(answer in written English)</font></td>
</tr>[/PHP]

And in the saveuser.php is this.
The chapa code, is above my other error code:
[PHP]<?php
// vim:set ts=4 sw=4 ai:
include('CaptchaSecurityImages.php');

$guess = $_REQUEST['guess'];

$c = new Craptcha( $_SERVER['REMOTE_ADDR'] );

if ($guess)
{
if ($c->answerMatches($guess))
{
$c->clear();
}
else
{
echo "Incorrect Security Code!\n";
exit;
}
}
?>[/PHP]

Other code i use:
[PHP]<?php

$error = false;
$errormessage = "";

if (strlen($loginname) < 1) {
$error = true;
$errormessage .= "<font color=\"#FF0000\">Sorry,</font> You did not enter a Login name.</b><br>\n";
}

if (strlen($password) < 1) {
$error = true;
$errormessage .= "<font color=\"#FF0000\">Sorry,</font> You did not enter a password.</b><br>\n";
}

if (strlen($confirmpassword) < 1) {
$error = true;
$errormessage .= "<font color=\"#FF0000\">Sorry,</font> You did not enter a confirmation password.</b><br>\n";
}

if (strlen($email) < 1) {
$error = true;
$errormessage .= "<font color=\"#FF0000\">Sorry,</font> You did not enter an email address.</b><br>\n";
}

if ($password != $confirmpassword) {
$error = true;
$errormessage .= "<img src=\"images/invalid.gif\" width=\"402\" height=\"107\" /><br><br><b><font color=\"#FF0000\">Sorry,</font> Your password and confirmation password do not match</b><br>\n";
}

$sql = "select * from users where login = '$loginname'";
$result = mysql_query($sql ,$db);

if ($myrow = mysql_fetch_array($result)) {
$error = true;
$errormessage .= "<img src=\"images/invalid.gif\" width=\"402\" height=\"107\" /><br><br><b><font color=\"#FF0000\">Sorry,</font> That Login Name is already taken</b><br>\n";
}
$sql = "select * from users where email = '$email'";
$result = mysql_query($sql ,$db);

if ($myrow = mysql_fetch_array($result)) {
$error = true;
$errormessage .= "<img src=\"images/invalid.gif\" width=\"402\" height=\"107\" /><br><br><b><font color=\"#FF0000\">Sorry,</font> That Email is already in use</b><br>\n";
}

if ($error) {
$errormessage .= "\n";
$msg = $errormessage;
} else {
$userid = nextid("users", "userid");

$sql = "insert into users (userid, login, password, email, gender, aboutme, points, genderimage) values ($userid, '$loginname', '" . sha1($password) . "', '$email' , '$gender', '$aboutme', '$points', '$genderimage')";
$result = mysql_query($sql ,$db);

$loggedin = true;
$uid = $userid;
$upwd = $password;
$uname = $loginname;

session_register("loggedin");
session_register("upwd");
session_register("uid");
session_register("uname");

$message = "Thank you for creating an account at $sitename. Here are your account details.\n\n";
$message .= "================================================= =========\n\n";

$message .= "Login : $loginname\n";
$message .= "Password : $password\n";
$message .= "Email : $email\n";
$message .= "Email : $gender\n";

$message .= "\n\n============================================= =============\n\n";
$message .= "Don't forget to come visit us at \n$siteurl\n\n";

mail("$email", "$sitename new account details", $message, "From: $webmasteremail\r\n" ."Reply-To: $webmasteremail\r\n");



$msg = "<img src=\"images/Success_Account.gif\" /><br /><br />Congratulations. Your account has been created, A copy of you <br />account details has been emailed to you. <br />Go to the <a href=index.php>Home Page</a>.";

}

?><font size="2" face='Arial'><?php printf($msg); ?></font>[/PHP]
Sep 6 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: news | last post by:
There's all kinds of ways to validate an email address to make sure it's well formed and whatnot, but what about checking to see if it's a valid e-mail account? Like how you can use checkdnsrr()...
1
by: Techy | last post by:
I have two fields in my form so called : invoice and cash Now I want to validate this form on the client side with the help of javascript in such a way that if one of these fields is empy an...
1
by: Grytpype-Thynne | last post by:
Hi, Can anyone help me to get this third party code to validate as 4.01 strict. <form action="http://**********.org.uk/draw/draw_data.php" method="post" target="PageName"...
7
by: Randel Bjorkquist | last post by:
First, I'm extremely new to C# and the Microsoft Visual Studio IDE. I am in the middle of writing a small web application that communicates to a database server and sends out email confirmations. ...
3
by: Mike Logan | last post by:
How do I validate messages? If my schema has a simpleType with facets like "minExclusive" and "maxLength" will the .Net framework validate the message before running the web service? This is what...
1
by: Joey | last post by:
Does anyone know how to validate only one certain control in server side code on postback? Instead of Page.Validate() and Page.IsValid, is there some functionality equivalent to...
1
by: jayparaiso | last post by:
Hi! How to validate check box and drop down menu in one form?
11
by: TokyoJ | last post by:
I run a small camp in Alaska for kids and my director is asking for a web form. Could someone please have a look and offer some advice on where I'm making mistake(s)? I'm using the RegExp function...
1
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.