Jump to content

Deprecated: Function eregi() is deprecated in


Silvernz

Recommended Posts

Hi im using an old script and am getting the following errors :( could some one please be so kind as to tell me what i need to chang :)?

 

Deprecated: Function eregi() is deprecated in /home/textetco/public_html/dup3/register2.php on line 74

 

Deprecated: Function eregi() is deprecated in /home/textetco/public_html/dup3/register2.php on line 87

 

Deprecated: Function eregi() is deprecated in /home/textetco/public_html/dup3/register2.php on line 96

 

here is the file upto line 110

 

<?



include ("igwt.php");
include ("mysql.php");
include ("api/smsapi.php");

$email = $_POST[email];
$emailconfirm = $_POST[emailconfirm];
$password = $_POST[password];
$passwordconfirm = $_POST[passwordconfirm];
$username = $_POST[username];
$firstname = $_POST[firstname];
$name = $_POST[name];
$accept = $_POST[accept];
$address = $_POST[address];
$city = $_POST[city];
$state = $_POST[state];
$zip = $_POST[zip];
$country = $_POST[country];
$mobile = $_POST[mobile];
$home = $_POST[home];
$date = date("Ymd");
$rand = rand(100000, 999999);
$affiliate = $_COOKIE['affiliate'];

$username = strtolower($username);


$subject = "Registration";
$sss = "From: support@yoursite.com\r\n";
$mmessage = "Dear $firstname $name,

Thank you for signing up! Just for signing up with us, you received a free SMS message!

Please read this email carefully because it contains important information!

You should recieve a SMS message with an activation code in order to fully activate your account (ability to earn extra free SMS credits).

In order to activate your account login to your account in the Member's Area.

In order to receive extra free messages, please read the \"Get Free SMSs\" area from your Member homepage.

If you experience delays and/or site bugs, please feel free to contact us

Please feel free to browse the forums and interact with other users in our Forum

Best regards,
Support Team.";

if (!$firstname)
{
$error[] = 'No first name selected!';
}

if (!$name)
{
$error[] = 'No name selected!';
}

if (!$mobile)
{
$error[] = 'No mobile phone selected!';
}

/* if (strlen($mobile) == 10)
{
$error[] = 'Mobile country code not entered! Eg. for a US phone number: 14044444442';
} */

if ($accept != 1) $error[] = 'You must accept the terms in order to continue';
  // check the username
  if(!eregi("^[[:alnum:]]+$", $username))
     $error[] = 'Username error';

  // check to make sure the password is long enough and of the right format
  if(!$password)
    $error[] = 'Password error';

  // check to make sure that the password matches the confirmed password.
  if($password != $passwordconfirm)
    $error[] = 'Passwords do not match!';

  // check to make sure they entered a valid email address
  if(!eregi("^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", 
$email))
    $error[] = 'Invalid e-mail';

  // check to make sure that the email matches the confirmed email.
  if($email != $emailconfirm)
    $error[] = 'E-mail confirmation error';

// check the mobile number
$atom = '[-a-z!#$%&\'*+/=?^_`{|}~]';
if (eregi($atom, $mobile)) {
$error[] = 'Invalid mobile phone number';
}


  // check to see if username already exists
  $check = mysql_query("SELECT username FROM users WHERE username = '$username'");
if(mysql_num_rows($check ) != 0)  {$error[] = 'This username is already in our database!'; };

// check to see if phone number already exists
  $check = mysql_query("SELECT mobile FROM users WHERE mobile = '$mobile'");
if(mysql_num_rows($check ) != 0)  {$error[] = 'This phone number is already in our database!'; };

  // check to see if email already exists
  $check = mysql_query("SELECT email FROM users WHERE email = '$email'");

 

Thanks for any help i am very greatful!!

 

 

 

 

Link to comment
Share on other sites

Thanks for the reply xyph,

 

My problem is i am now running the latest version of php and using a script from version 4.2 i realize eregi has been deprecated since PHP 5.3.0, i was hoping someone could be kind enough to tell me what the new code would be to fix these errors :)

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.