fosiul01
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
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;
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Will try to remember this next time
Thanks its done