troubleshooting Question

unexpected T_OBJECT_OPERATOR

Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland asked on
PHP
2 Comments1 Solution767 ViewsLast Modified:
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;
  } 
?>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros