Jump to content

Canguingo

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by Canguingo

  1. aaaah! got it!! hahaha it was the if (!preg_match($pattern, $mail_address)) { return true; } else { return false; } that ! was asking for the oposite right??
  2. oh! well that's probably what happens because everytime I write a correct email I get this error email from the last else in the code. So what you say is that I should change something to make it the other way around. ... right? but what?
  3. Anybody a possible solution?? please...
  4. Thanx, I know you gave me that link already and I tryed to read it and understand it but for me is in chiness... I'm a bit new here. sorry about that. I've try to use both examples you gave me. and with both i get the error that the email is invalid. See my code: // DEFINE FUNCTIONS function spamcheck($field) { //eregi() performs a case insensitive regular expression match. old comment.. if (preg_match("/to:|cc:|bcc:/", $field)) { return true; } else { return false; } } function check_email($mail_address) { $pattern = "/^[\w-]+(\.[\w-]+)*@"; $pattern .= "([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i"; if (!preg_match($pattern, $mail_address)) { return true; } else { return false; } } //END FUNCTIONS if (isset($_REQUEST['send'])){ if (($_REQUEST['naam']=="") OR ($_REQUEST['naam']=="")) { echo "<p><b><br><FONT face=Verdana color=#ff7500 size=2>El campo 'nombre' es obligatorio.</FONT></b></b><p>"; } elseif (isset($_REQUEST['email'])) { //check if the email address is invalid $checkcode = $_REQUEST['email'].$_REQUEST['bericht'].$_REQUEST['adres'].$_REQUEST['pcplaats'].$_REQUEST['bedrijf'].$_REQUEST['naam']; $mailcheck = spamcheck($checkcode); if ($mailcheck==TRUE) { echo "Nice try."; $klaar =1; } else { // check if address is an address $email = $_REQUEST['email']; if (check_email($email)) { //send email $subject = "Mensaje desde rcr66.com"; $message = "De: ".$_REQUEST['naam']."( $email )"; $message .= "\n Calle: ".$_REQUEST['adres']; $message .= "\n Ciudad: ".$_REQUEST['pcplaats']; $message .= "\n Mensaje:"; $message .= $_REQUEST['bericht']; mail("$emailto", "$subject", $message, "From: $email" ); echo "<p><br><b><FONT face=Verdana color=#ff7500 size=2>Gracias por tu mensaje, prometemos contestarte lo antes posible</FONT></b></br></p>"; $klaar =1; } else { echo "<p><b><br><font face=Verdana color=#ff7500 size=2>Fout email</font></br></b></p>"; } } } } Any idea where else do i need to change?
  5. Salathe, thanks but if I use stripos() i get an error as if the email field was wrong or not filled in. I've seen some answers that recomend to use preg_match() however when I use this one I ge : Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Any other possible solutions? Thx in advance
  6. Hello, I have the same problem, here is my code: // DEFINE FUNCTIONS function spamcheck($field) { //eregi() performs a case insensitive regular expression match if (eregi("to:", $field) || eregi("cc:", $field) || eregi("bcc:", $field)) { return true; } else { return false; } } function check_email($mail_address) { $pattern = "/^[\w-]+(\.[\w-]+)*@"; $pattern .= "([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i"; if (!preg_match($pattern, $mail_address)) { return true; } else { return false; } } //END FUNCTIONS Every time I run this code (contact form) I get the error "Deprecated: Function eregi() is deprecated ..." However the email is sent. Any solution?? Thanks in advance!
×
×
  • 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.