Jump to content

PHP 5 to 7 ereg?


jefferis

Recommended Posts

I folks,  I have some old forms on client sites that broke with the upgrade to php 7.  I am wondering which PCRE to replace this following bit of code, which seems to be the only one in the form that is deprecated: 

function CheckEmail($email, $optional) {
 if ( (strlen($email) == 0) && ($optional === kOptional) ) {
  return true;
 } elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) {
  return true;
 } else {
  return false;
 }
}

Just preg?   or one of these? diamond.php

 

I'm not doing much coding anymore. However, what happened was when the form was filled out and posted, instead of running the form's code, the actual php file downloaded.  

TIA,

Jeff 

Link to comment
Share on other sites

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.