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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Breana
    New Member
    • Aug 2007
    • 117

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

    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.co m 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($emaila ddress) < 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 :(
  • pinesolpirate
    New Member
    • Sep 2007
    • 1

    #2
    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 :)

    Last edited by pinesolpirate; Sep 5 '07, 08:54 PM. Reason: Incomplete response.

    Comment

    • Breana
      New Member
      • Aug 2007
      • 117

      #3
      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...

      Code:
       Remove Flags
      	
      memory_limit
      	
      18M
      	Delete
      gamehackers.ifastnet.com
      	
      register_globals
      	
      On
      	Delete
      gamehackers.ifastnet.com
      	
      magic_quotes_gpc
      	
      On
      	Delete
      gamehackers.ifastnet.com
      	
      magic_quotes_runtime
      	
      On

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        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?

        Comment

        • Breana
          New Member
          • Aug 2007
          • 117

          #5
          Can i install the gd on my free host? i havent got the paid host yet...

          [PHP]<tr>
          <td colspan="2"><fo nt color="#003366" size="1" face="Arial"><b r />
          <img src="images/Dotted_Border.p ng" width="500" height="10" /><br />
          Security Code.</font></td>
          </tr>
          <tr>
          <td><img src="../CaptchaSecurity Images.php" /></td>
          <td><input id="security_co de" 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..

          Comment

          • Breana
            New Member
            • Aug 2007
            • 117

            #6
            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...

            Comment

            • Breana
              New Member
              • Aug 2007
              • 117

              #7
              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"><?p hp
              // vim:set ts=4 sw=4 ai:
              include('Captch aSecurityImages .php');

              $guess = $_REQUEST['guess'];

              $c = new Craptcha( $_SERVER['REMOTE_ADDR'] );
              ?>
              <font color="#003366" size="1" face="Arial">Wh at 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">(a nswer 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('Captch aSecurityImages .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($loginn ame) < 1) {
              $error = true;
              $errormessage .= "<font color=\"#FF0000 \">Sorry,</font> You did not enter a Login name.</b><br>\n";
              }

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

              if (strlen($confir mpassword) < 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 != $confirmpasswor d) {
              $error = true;
              $errormessage .= "<img src=\"images/invalid.gif\" width=\"402\" height=\"107\" /><br><br><b><fo nt 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($sq l ,$db);

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

              if ($myrow = mysql_fetch_arr ay($result)) {
              $error = true;
              $errormessage .= "<img src=\"images/invalid.gif\" width=\"402\" height=\"107\" /><br><br><b><fo nt 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($sq l ,$db);

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

              session_registe r("loggedin") ;
              session_registe r("upwd");
              session_registe r("uid");
              session_registe r("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 />Congratulation s. 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]

              Comment

              Working...