Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland asked on

unexpected T_OBJECT_OPERATOR

HI , i Wrote 2  functions in a class. and i am trying to call those function from web page

but its saying :unexpected T_OBJECT_OPERATOR

dont understand why
can any one please help me

i have attached the code
''''''''''''
DataVerification.php
'''''''''''''''''''''''
<?php
 
class DataVerification
{
 
public function filled_out($form_vars)
{
  // test that each variable has a value
  foreach ($form_vars as $key => $value)
  {
     if (!isset($key) || ($value == '')) 
        return false;
  } 
  return true;
}
 
public function valid_email($address)
{
  // check an email address is possibly valid
  if (ereg('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $address))
    return true;
  else 
    return false;
}
 
}
 
?>
'''''''''''''''''
Register_new.php
'''''''''''''''''
<?php
require_once('../DesignClass/HtmlFormat.php');
require_once('../DataVerification/DataVerification.php');  -------------------------------------
$username = $_POST[Username];
$userpassword = $_POST[Userpassword1];
$userpassword2 = $_POST[Userpassword2];
$userEmail = $_POST[UserEmail];
 
$ObjDataVerification = new DataVerification(); ---------------------------------
 
try
  {
    // check forms filled in
    if (!ObjDataVerification->filled_out($_POST))  (------------------ Problem-----------)
    {
      throw new Exception('You have not filled the form out correctly - please go back'
          .' and try again.');    
    }
   
    // email address not valid
    if (!ObjDataVerification->valid_email($userEmail)) (------------------ Problem-----------)
    {
      throw new Exception('That is not a valid email address.  Please go back '
                          .' and try again.');
    } 
 
    // passwords not the same 
    if ($userpassword != $userpassword2)
    {
      throw new Exception('The passwords you entered do not match - please go back'
                           .' and try again.');
    }
 
    // check password length is ok
    // ok if username truncates, but passwords will get
    // munged if they are too long.
    if (strlen($userpassword)<6 || strlen($userpassword2) >16)
    {
      throw new Exception('Your password must be between 6 and 16 characters.'
                           .'Please go back and try again.');
    }
   
        echo 'Your registration was successful.  Go to the members page '
          .'to start setting up your bookmarks!';
    }
  catch (Exception $e)
  {
     //do_html_header('Problem:');
    echo $e->getMessage(); 
     //do_html_footer();
     exit;
  } 
?>

Open in new window

PHP

Avatar of undefined
Last Comment
fosiul01

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
fosiul01

I Made a bad habbit of asking too much question in EE before looking details in to the problem!!!

Will try to remember this next time

Thanks its done
Your help has saved me hundreds of hours of internet surfing.
fblack61