Forum Moderators: coopster

Message Too Old, No Replies

Parse Error

         

Laced

2:00 pm on May 7, 2003 (gmt 0)

10+ Year Member



I'm fairly new to PHP..about an hour or so. I'm working on a statistics module for a phpBB Statistics Hack.

I installed my module
Activated it
And get this message when I go to view the statistics page

"Parse error: parse error, unexpected T_STRING in /home/johnlacy/public_html/dev/modules/top_referrals/module.php on line 54"

Now Line 54 is blank.

This is lines 47-59 of my module.php


$core->pre_defined('rank'),

'username' => $lang['Username'],

'referrals' => $lang['Referral_Total'],

$core->pre_defined('percent'),

$core->pre_defined('graph'))


If anyone could help me out I'd appreciate it a great deal. I'm trying to get this done asap.

bcolflesh

2:06 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like an extra parenthesis:

'graph'))

Regards,
Brent

jatar_k

3:20 pm on May 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



and Welcome to WebmasterWorld Laced :)

Laced

3:43 pm on May 7, 2003 (gmt 0)

10+ Year Member



Well I've gotten to a point now where all I do is run into parse errors that dont make sense to me.

Now I'm getting
"Parse error: parse error, unexpected ';' in /home/johnlacy/public_html/dev/modules/top_referrals/module.php on line 32"

Here are lines 21-35


if (!defined('IN_PHPBB') )

{

die("Hacking attempt");

}

//

// Top Referrals

//


The line above // Top Referrals is line 32. I'm just not understanding this. I know nothing about php really..I'm just tryin to wing a quick mod. If anyone cares to help me feel free to e-mail me <email in profile>

[edited by: jatar_k at 3:53 pm (utc) on May 7, 2003]

jatar_k

3:52 pm on May 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would imagine it is dropping through from somewhere above, i cant see anything there that should be generating an error.

Laced

7:01 pm on May 7, 2003 (gmt 0)

10+ Year Member



Its a module for a statistics mod for phpBB I just modeled mine after some already made...I know some of the coding may be wrong but that doesnt explain the parse errors in my mind

Here is the module as it is writing in .pak format

3.0.0
#
# This file contains Installation Informations.
# This file does not include Installation Instructions for the normal User.
# Please do not edit this file if you are not the Module Author.
#
# Please read the provided install.txt for Informations on how to install this Module.
#
# Module Name
[name]
Top Referrals
[/name]
# Module Directory Name
[short_name]
top_referrals
[/short_name]
# your name
[author]
Laced
Top Referral Mod: Laced
[/author]
# your email
[email]
Site History Mod:
[/email]
# your webpage url
[url]
[/url]
# module version
[version]
1.0.0
[/version]
# required minimum Statistics Mod Version
[stats_mod_version]
3.0.0
[/stats_mod_version]
# default update time
[update_time]
update_time_from top_referrals
1
[/update_time]
[check_update_site]
[/check_update_site]
# extra info for the user
[extra_info]
This Module DOES require the Referral Mod by
and the newest Statistics Mod by
This module will display the top referrals on your forum.
[/extra_info]
<?php
[lang_english]
$lang['module_name'] = 'Top Referrals';
[/lang_english]
?>

<?php
if (!defined('IN_PHPBB') )
{
die("Hacking attempt")
}

//
// Top Referrals
//
$core->start_module(true);

$core->set_content('bars');

$core->set_view('rows', $core->return_limit);
$core->set_view('columns', 5);

$core->define_view('set_columns', array(
$core->pre_defined('rank'),
'username' => $lang['Username'],
'Total Referrals' => $lang['Referral_Total'],
$core->pre_defined('percent'),
$core->pre_defined('graph'),
);

$content->percentage_sign = TRUE;
$core->set_header($lang['module_name']);
$core->assign_defined_view('align_rows', array(
'left',
'left',
'center',
'center',
'left')
);

$sql = "SELECT COUNT(referral_id) AS referral_total FROM " . REFERRAL_TABLE . "WHERE ruid = $ruid";

$result = $core->sql_query($sql, 'Unable to retrieve users data');
$row = $core->sql_fetchrow($result);

$referral_total = $row['Referral_Total'];

$sql = "SELECT COUNT(referral_id) AS referral_total
FROM " . REFERRAL_TABLE . "
WHERE ruid = $ruid
ORDER BY referral_total DESC
LIMIT " . $core->return_limit;

$result = $core->sql_query($sql, 'Unable to retrieve users data');
$data = $core->sql_fetchrowset($result);
$content->init_math('referrals', $data[0]['Referral_Total'], $referrals);
$core->set_data($data);

$core->define_view('set_rows', array(
'$core->pre_defined()',
'$core->generate_link(append_sid($phpbb_root_path . \'profile.php?mode=viewprofile&u=\' . $core->data(\'user_id\')), $core->data(\'username\'), \'target="_blank"\')',
'$core->data(\'user_posts\')',
'$core->pre_defined()',
'$core->pre_defined()')
);

$core->run_module();

?>

[edited by: jatar_k at 7:06 pm (utc) on May 7, 2003]
[edit reason] trimmed specifics and funny chars [/edit]

jatar_k

7:15 pm on May 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what were all the strange chars in there?

Laced

2:30 am on May 8, 2003 (gmt 0)

10+ Year Member



The strange characters are needed for the .pak file to be valid when installing into your phpBB board via the statistics hack in the admin cpanel. Other wise you get invalid pak

toadhall

3:00 am on May 8, 2003 (gmt 0)

10+ Year Member



The only two things I can see as problematic are these (the 2nd not so crucial):

$core->define_view('set_columns', array(
$core->pre_defined('rank'),
'username' => $lang['Username'],
'Total Referrals' => $lang['Referral_Total'],
$core->pre_defined('percent'),
$core->pre_defined('graph'), [b]< the , should be a ) - needed to end the array.[/b]
);

to read - $core->pre_defined('graph'))

//

if (!defined('IN_PHPBB') )
{
die("Hacking attempt") [b]< you [i]could[/i] put a semicolon here, for good luck ;o)[/b]
}

to read - die("Hacking attempt");

See anything else Adam?

T

jatar_k

4:44 am on May 8, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



i actually wonder about that semi colon, it was in one post and not in the other.
this one
die("Hacking attempt");

Laced

7:37 am on May 8, 2003 (gmt 0)

10+ Year Member



was a typo in one version. I guess you would need to know the referral mod data..as well as knowledge of some of the other modules. Which I dont have much of. So o well tryin to find help for other module authors. Thank you all for your help in my first php experience.