Willkommen, Gast
  • Seite:
  • 1
  • 2

THEMA: Parse error: syntax error, unexpected T_STRING in

Parse error: syntax error, unexpected T_STRING in 2 years 5 months ago #68192

Hi all,

I'm getting an error message at the beginning of my form like this:

Parse error: syntax error, unexpected T_STRING in facileforms.process.php(1052) : eval()'d code on line 11

Line 11 simply reads: global $mainframe;

Can someone tell me what I'm overlooking? BTW, the form works just fine, just displays this error code. Thanks!

LP
  • lxp
  • lxp's Avatar
  • OFFLINE
  • Junior Boarder
  • Beiträge: 21
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Parse error: syntax error, unexpected T_STRING in 2 years 5 months ago #68396

Hi,

it seems you are using some custom php pieces. I guess in a before form piece.
Could you please post me that code? Then I can have a look what is wrong with it.

Regards,
Markus
  • TheMuffinMan
  • TheMuffinMan's Avatar
  • OFFLINE
  • Moderator
  • Beiträge: 5714
  • Thank you received: 383
  • Karma: 70
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Parse error: syntax error, unexpected T_STRING in 2 years 5 months ago #68400

Hi Markus,

Here's the begin form piece. Thanks!!!!!!!

LP

// Create the user
global $mainframe;
JFactory::getLanguage()->load('com_user');
$db = JFactory::getDBO();
$db->setQuery("Select * From #__facileforms_records Where name = ".$db->Quote($this->formrow->name).");
$list = $db->loadObjectList();
$listSize = count($list);

for($i = 0; $i < $listSize;$i++)
{
$db->setQuery("Select * From #__users Where id = ".$db->Quote($list[$i]->user_id)." And block = 1");
$userResult = $db->loadObjectList();
if(count($userResult) == 1)
{
$db->setQuery("Update #__users Set block = 0 Where id = ".$db->Quote($userResult[0]->id)."");
$db->query();
$usersConfig = &JComponentHelper::getParams( 'com_users' );
$sitename = $mainframe->getCfg( 'sitename' );
$useractivation = $usersConfig->get( 'useractivation' );
$mailfrom = $mainframe->getCfg( 'mailfrom' );
$fromname = $mainframe->getCfg( 'fromname' );
$siteURL = JURI::base();
$subject = sprintf ( JText::_( 'Account details for' ), $userResult[0]->name, $sitename);
$subject = html_entity_decode($subject, ENT_QUOTES);
$message = sprintf ( JText::_( 'SEND_MSG' ), $userResult[0]->name, $sitename, $siteURL);
$message = html_entity_decode($message, ENT_QUOTES);

//get all super administrator
$query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
$db->setQuery( $query );
$rows = $db->loadObjectList();

// Send email to user
if ( ! $mailfrom || ! $fromname )
{
$fromname = $rows[0]->name;
$mailfrom = $rows[0]->email;
} //end if

JUtility::sendMail($mailfrom, $fromname, $userResult[0]->email, $subject, $message);

// Send notification to all administrators
$subject2 = sprintf ( JText::_( 'Account details for' ), $name, $sitename);
$subject2 = html_entity_decode($subject2, ENT_QUOTES);

// get superadministrators id
foreach ( $rows as $row )
{
if ($row->sendEmail)
{
$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $sitename, $userResult[0]->name, $userResult[0]->email,

$userResult[0]->username);
$message2 = html_entity_decode($message2, ENT_QUOTES);
JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
} // end if
} // end foreach
} // end if
} // end Create User
  • lxp
  • lxp's Avatar
  • OFFLINE
  • Junior Boarder
  • Beiträge: 21
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Parse error: syntax error, unexpected T_STRING in 2 years 5 months ago #68424

Hi Markus,

I removed the begin script and the error has disappeared. However, now the new end script (see below) doesn't bind the custtype or create the user as registered. Any ideas? Thanks!

LP

// Create User - End Submit Piece
// Requires
// Begin create user
global $mainframe;
JFactory::getLanguage()->load('com_user');
$this->execPieceByName('ff_InitLib');
$user = clone(JFactory::getUser());
$pathway =& $mainframe->getPathway();
$config =& JFactory::getConfig();
$authorize =& JFactory::getACL();
$document =& JFactory::getDocument();

// If user registration is not allowed, show 403 not authorized.
$usersConfig = &JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration') == '0') {
echo '<script>alert("Access forbidden");history.go(-1);</script>';
return;
} else {

// Initialize new usertype setting
$newUsertype = $usersConfig->get( 'new_usertype' );
if (!$newUsertype) {
$newUsertype = 'Registered';
}

// Bind the post array to the user object
$post = array(
'name' => ff_getSubmit('first_name'),
'username' => ff_getSubmit('e_mail'),
'email' => ff_getSubmit('e_mail'),
'password' => ff_getSubmit('password'),
'password2' => ff_getSubmit('password'),
'custtype' => ff_getSubmit('custtype'),
'task' => 'register_save',
'id' => '0',
'gid' => '0',
);

if (!$user->bind( $post, 'usertype' )) {
echo '<script>alert("'.addslashes($user->getError()).'");history.go(-1);</script>';
return;
} else {

// Set some initial user values
$user->set('id', 0);
$user->set('usertype', '');
$user->set('gid', $authorize->get_group_id( '', $newUsertype, 'ARO' ));

$date =& JFactory::getDate();
$user->set('registerDate', $date->toMySQL());

// If user activation is turned on, we need to set the activation information
$useractivation = $usersConfig->get( 'useractivation' );
if ($useractivation == '1')
{
jimport('joomla.user.helper');
$user->set('activation', JUtility::getHash( JUserHelper::genRandomPassword()) );
$user->set('block', '1');
}

// If there was an error with registration, set the message and display form
if ( !$user->save() )
{
echo '<script>alert("'.addslashes(JText::_( $user->getError())).'");history.go(-1);</script>';
return;
} else {

$db =& JFactory::getDBO();

$name = $user->get('name');
$email = $user->get('email');
$username = $user->get('username');

JFactory::getDBO()->setQuery("Update #__facileforms_records Set user_id = '".$user->get('id')."',

username = ".JFactory::getDBO()->Quote($username).", user_full_name = ".JFactory::getDBO()->Quote($name)." Where id = '".$this->record_id."'");
JFactory::getDBO()->query();
}

}

}


// Load BF Library
$this->execPieceByName('ff_InitLib');
  • lxp
  • lxp's Avatar
  • OFFLINE
  • Junior Boarder
  • Beiträge: 21
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Parse error: syntax error, unexpected T_STRING in 2 years 4 months ago #68621

Hi,

please revert the old code but change this line

$db->setQuery("Select * From #__facileforms_records Where name = ".$db->Quote($this->formrow->name).");

to this

$db->setQuery("Select * From #__facileforms_records Where name = ".$db->Quote($this->formrow->name));

This was the line where the error appeared.

Maybe everything will work then as expected.

Regards,
Markus
  • TheMuffinMan
  • TheMuffinMan's Avatar
  • OFFLINE
  • Moderator
  • Beiträge: 5714
  • Thank you received: 383
  • Karma: 70
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Parse error: syntax error, unexpected T_STRING in 2 years 4 months ago #68726

Sheer genius! YOU DA MAN!!!! Thanks Markus
  • lxp
  • lxp's Avatar
  • OFFLINE
  • Junior Boarder
  • Beiträge: 21
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.
  • Seite:
  • 1
  • 2
Moderators: ForumSupport, lennerd, pedro81
Time to create page: 0.135 seconds
Powered by Kunena Forum :: Joomlana_Dark-by- bz_kunena-templates

Über Crosstec

Crosstec GmbH & Co. KG

Hohenzollernring 57

50672 Cologne, Germany

Live Chat Software