Is their a simple way to repair this?

Started by uth, February 13, 2015, 08:36:52 PM

Previous topic - Next topic

uth

Hoping to solve this with out starting over. When some one trys to register they now get this error......

Parse error: syntax error, unexpected ':', expecting ')' in /home/ut***/public_html/forums/Sources/Register.php on line 311

Kindred

Smf version?
  What mod did you recently try to install?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

uth

SMF 2.0.9 | SMF © 2014, Simple Machines

Haven't installed a mod in months, I did have to manually add some users through a data base. Had printed out another user and used it to fill everything out. Users are working great just now a few days later this is popping up and I am lost.

Kindred

First of all...  You should never add users directly in the database.
If you need to manually add users, there are ways to do so as an admin, from inside the smf admin tools.  By adding them directly in the database, you have bypassed several of the things which the system does when a user account is created... More than just adding a row to the members table.


Second... The error thatbyou indicate is a code error. That means that you made a change to the source code in the file... For some reason... And made a bad edit.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

uth

Thank you for the reply,
      The options to register a user I saw from the admin console didn't work had kept telling me that the user existed so I went this way....apparently screwed up. Not sure what or how I got to the source code . I take it the answer is to scrap it and start over?

Kindred

You could include lines 280 to 310 of the register.php file in a post...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

uth

#6
Thank you it is truly appreciated.

'buddy_list',
'pm_ignore_list',
'smiley_set',
'signature', 'personal_text', 'avatar',
'lngfile',
'secret_question', 'secret_answer',
);
$possible_ints = array(
'pm_email_notify',
'notify_types',
'icq',
'gender',
'id_theme',
);
$possible_floats = array(
'time_offset',
);
$possible_bools = array(
'notify_announcements', 'notify_regularity', 'notify_send_body',
'hide_email', 'show_online',
);

if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '')
$_POST['secret_answer'] = md5($_POST['secret_answer']);

// Needed for isReservedName() and registerMember().
require_once($sourcedir . '/Subs-Members.php');

// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(: '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));

Burke ♞ Knight

uth, it is always best to use the code tags, when posting code.



[code][/code]




Kindred

Oops...   Ask, I just realized that I misread your line number...   Can you also include through line 320?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Shambles

The last line posted above is the failing one - looks like a whole chunk of code got snipped out

Code (find) Select
// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(: '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));



Code (replace) Select
// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : "\xC2\xA0\xC2\xAD\xE2\x80\x80-\xE2\x80\x8F\xE2\x80\x9F\xE2\x80\xAF\xE2\x80\x9F\xE3\x80\x80\xEF\xBB\xBF") : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));



Chances are that other bits have been snipped out - smells of erroneous editing...

uth

Hello Every one, thank you for the reply's and sorry for not using the indicators.


[code] // Collect all extra registration fields someone might have filled in.
$possible_strings = array(
'website_url', 'website_title',
'aim', 'yim',
'location', 'birthdate',
'time_format',
'buddy_list',
'pm_ignore_list',
'smiley_set',
'signature', 'personal_text', 'avatar',
'lngfile',
'secret_question', 'secret_answer',
);
$possible_ints = array(
'pm_email_notify',
'notify_types',
'icq',
'gender',
'id_theme',
);
$possible_floats = array(
'time_offset',
);
$possible_bools = array(
'notify_announcements', 'notify_regularity', 'notify_send_body',
'hide_email', 'show_online',
);

if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '')
$_POST['secret_answer'] = md5($_POST['secret_answer']);

// Needed for isReservedName() and registerMember().
require_once($sourcedir . '/Subs-Members.php');

// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(: '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));
if (trim($_POST['real_name']) != '' && !isReservedName($_POST['real_name']) && $smcFunc['strlen']($_POST['real_name']) < 60)
$possible_strings[] = 'real_name';
}

if (isset($_POST['msn']) && preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['msn']) != 0)
$profile_strings[] = 'msn';

// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
         

Shambles

Correct the code as I demonstrated in my post above yours.

uth

Quote from: Shambles on February 14, 2015, 03:40:13 AM
The last line posted above is the failing one - looks like a whole chunk of code got snipped out

Code (find) Select
// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(: '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));



Code (replace) Select
// Validation... even if we're not a mall.
if (isset($_POST['real_name']) && (!empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum')))
{
$_POST['real_name'] = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : "\xC2\xA0\xC2\xAD\xE2\x80\x80-\xE2\x80\x8F\xE2\x80\x9F\xE2\x80\xAF\xE2\x80\x9F\xE3\x80\x80\xEF\xBB\xBF") : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $_POST['real_name']));



Chances are that other bits have been snipped out - smells of erroneous editing...

I copied the replace code from the post into the php and it repaired the original error it now points to line 851 that is here.

Parse error: syntax error, unexpected ':' in /home/uth**/public_html/forums/Sources/Register.php on line 851


// Clean it up like mother would.
$context['checked_username'] = : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $context['checked_username']);
if ($smcFunc['strlen']($context['checked_username']) > 25)
$context['checked_username'] = $smcFunc['htmltrim']($smcFunc['substr']($context['checked_username'], 0, 25));


Thank you every one for the help, it is appreciated, means I can give her good news or at least hope when I head up to the hospital. I apologize that something I did some how is having you all work at trying to undo my mistakes. I am grateful for it!

Shambles

Quote from: Shambles
Chances are that other bits have been snipped out - smells of erroneous editing...

Simplest way is to grab yourself a fresh copy of register.php and compare it with yours, for the lines which are faulty. Otherwise we could be here all day fixing bits of snipped code here and there ;)

uth

Thank you, is their a place to download one? And any danger in just replacing the whole thing with the downloaded one?

Shambles

Depends if you have any mods applied that affected register.php

Get a copy from the SMF 2.0.9 download section, or from your backup assuming you took one.


uth

Hello,
  Thank you again for the help. I renamed the old file registerold and uploaded the new one and everything seems to be working so far. Had one last question, do you know how to edit the e-mail the system sends out when a user's registration is rejected, would like to customize what is said in the rejection letter.
  Again, thank you every one!!

Off to learn how to make a back up :)

EDIT:
Sorry forgot to ask this, what is the better way of adding a user when the forum claims they already exist although do not actually exist? Not sure if it is getting confused from the wordpress site, the smf forums are on a sub domain.

Sir Osis of Liver

/Themes/default/languages/EmailTemplates.english.php -



'admin_approve_reject' => array(
/*
@additional_params: admin_approve_reject
USERNAME: The user name for the member receiving the email.
@description:
*/
'subject' => 'Registration Rejected',
'body' => '{USERNAME},

Regrettably, your application to join {FORUMNAME} has been rejected.

{REGARDS}',
),


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

uth


uth

Spoke to soon :) Now they can not log out....and get this message.

"Unable to verify referring url. Please go back and try again."

Or this when trying to complete registration.

"Parse error: syntax error, unexpected ':', expecting ')' in /home/ut**/public_html/forums/Sources/Subs-Members.php on line 505"

Here is the list of plugins
1. SimpleAds 1.0.1
2. BK Modding StatCounter 1.0
3. Board Icons 1.0
4. Tidy Child Boards 1.4.1 
5. Menu Buttons 1.1
6. Simple Audio Video Embedder


Advertisement: