• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Help with parse syntax error?

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
12 posts • Page 1 of 1

Postby BoonI » Sun Dec 28, 2008 1:29 am

Parse error: syntax error, unexpected T_STRING in (directory name)/public_html/phpBB3/chat/index.php on line 11

line 11

$user->setup('viewforum');




this should be an easy one but it has stumped me.
any help would be greatly appreciated.
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby OldWolf » Sun Dec 28, 2008 10:50 am

What's line 10 look like? Sometimes the error is late.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby OldWolf » Mon Dec 29, 2008 3:02 am

BoonI wrote:$auth->acl($user-

This line definitely isn't complete. I think you might have meant to combine it and the next one to read:
$auth->acl($user->setup('viewforum'));

But I'm not sure... since I have no idea what those functions do. :)
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby BoonI » Mon Dec 29, 2008 11:27 pm

Here's everything down to line 11

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB3/chat/index.php'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path = '../phpBB3/chat/index. $phpEx); // include the common.php file, this is important, especially for database connects.

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby OldWolf » Tue Dec 30, 2008 5:12 am

It's this line:
include($phpbb_root_path = '../phpBB3/chat/index. $phpEx);

Note that there's an opening apostrophe, but not a closing one. :)

Your root path isn't really the correct root path either... root path is supposed to direct the user to the root of the phpbb directory. So if you're working in a folder at phpbb3/chat, the correct root path would be '../' I hope that makes sense.

Once you fix that, your include should look more like:
include($phpbb_root_path . 'chat/index' . $phpEx);

Hope that helps!
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby BoonI » Tue Dec 30, 2008 9:12 am

Now What?

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '/home2/xxxxxxx/public_html/phpBB3/chat/index.php'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

Warning: include(/home2/xxxxxxxxx/public_html/phpBB3/chat/index.phpcommon.php) [function.include]: failed to open stream: No such file or directory in /home2/xxxxxxxx/public_html/phpBB3/chat/index.php on line 6

Warning: include() [function.include]: Failed opening '/home2/xxxxxxxxxxx/public_html/phpBB3/chat/index.phpcommon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/xxxxxxxxx/public_html/phpBB3/chat/index.php on line 6

Fatal error: Call to a member function session_begin() on a non-object in /home2/xxxxxxx/public_html/phpBB3/chat/index.php on line 8
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby BoonI » Tue Dec 30, 2008 10:11 am

Started from scratch pretty frustrated but I am stubborn.
Here's what I am thinking.I need to change the phpbb to phpBB3 and that doesn't work so I try putting the entire url home2/xxxx/public_html/phpBB3/chat/index.php still no dice. The only good news is that reloading the demo pages works. I have had some other weird results but they are unrelated.Hopefully my distress will help someone avoid a similar sandtrap in the future. Oh yeah and apparently the syntax error just had nothing to do with it.I was holding out for a quick and painless solution but none exist. getting pretty bleak here so I will let you try once more to explain this to me. By the way which code is it that you claim works?

Warning: include(../phpbb/common.php) [function.include]: failed to open stream: No such file or directory in /home2/xxxx/public_html/phpBB3/chat/index.php on line 6

Warning: include() [function.include]: Failed opening '../phpbb/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/xxxx/public_html/phpBB3/chat/index.php on line 6

Fatal error: Call to a member function session_begin() on a non-object in /home2/xxxx/public_html/phpBB3/chat/index.php on line 9
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby OldWolf » Wed Dec 31, 2008 8:06 am

First, the issue your experiencing is a call to the wrong location. Something is wrong with your path.

Here's how we can work this out... I need to know what your structure looks like (so in other words, where are all your files? Are they all inside of phpBB3? Is the index.php file inside of a folder called chat inside of phpBB3? Please be specific). Next, I need to see the exact content of the file your trying and where it is.

Finally, I'm fairly sure you're using the one I said works, and there's nothing wrong with it... it's actually a problem with your paths and the things your changing, not the other user's code. The root path variable needs to lead to phpbb's root path as I explained before. Then your includes should be based on that variable.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby BoonI » Thu Jan 01, 2009 5:22 am

My file structure is as follows home2/me/public_html/phpBB3/chat/index.php

Here is the code I'm going to use. It's the default index page that came with the free chat with the phpBB3 integration code I got from the php homepage pasted at the top.

I hope that's enough to go on.Again,Thank you for your help.

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>phpFreeChat- Sources Index</title>
<link rel="stylesheet" title="classic" type="text/css" href="style/generic.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/header.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/footer.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/menu.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/content.css" />
</head>
<body>

<div class="header">
<h1>phpFreeChat - Sources Index</h1>
<img alt="logo bulle" src="style/bulle.gif" class="logo2" />
</div>

<div class="menu">
<ul>
<li class="sub title">General</li>
<li>
<ul class="sub">
<li class="item">
<a href="demo/">Demos</a>
</li>
<?php if (file_exists(dirname(__FILE__)."/checkmd5.php")) { ?>
<li>
<a href="checkmd5.php">Check md5</a>
</li>
<?php } ?>
<!--
<li class="item">
<a href="admin/">Administration</a>
</li>
-->
</ul>
</li>
<li class="sub title">Documentation</li>
<li>
<ul>
<li class="item">
<a href="http://www.phpfreechat.net/overview">Overview [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/fr/overview">Overview [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/es/overview">Overview [es]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/zh/overview">Overview [zh]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/ar/overview">Overview [ar]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/quickstart">Quickstart [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/fr/quickstart">En avant ! [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/parameters">Parameters list [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/faq">FAQ [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/fr/faq">FAQ [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/advanced-configuration">Advanced configuration [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/fr/advanced-configuration">Configuration avancée [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/customize">Customize [en]</a>
</li>
</ul>
</li>
</ul>
<p class="partner">
<a href="http://www.phpfreechat.net"><img alt="phpfreechat.net" src="style/logo_88x31.gif" /></a><br/>
<a href="http://www.jeu-gratuit.net/">jeu-gratuit</a><br/>
<a href="http://jeux-flash.jeu-gratuit.net/">jeux-flash</a><br/>
<a href="http://www.pronofun.com/">pronofun</a><br/>
<a href="http://areno.jeu-gratuit.net/">areno</a><br/>
<a href="http://www.micropolia.com/">micropolia</a><br/>
<a href="http://www.zeitoun.net/">zeitoun</a><br/>
<a href="http://www.hotscripts.com/?RID=N452772">hotscripts</a><br/>
</p>
</div>

<div class="content">
<?php $chat->printChat(); ?>
<?php if (isset($params["isadmin"]) && $params["isadmin"]) { ?>
<p style="color:red;font-weight:bold;">Warning: because of "isadmin" parameter, everybody is admin. Please modify this script before using it on production servers !</p>
<?php } ?>
</div>

</body></html>
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby OldWolf » Thu Jan 01, 2009 5:42 am

Change this line:
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';

to this line:
$phpbb_root_path = '../';

without changing anything else, and tell me what happens.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby BoonI » Sun Jan 04, 2009 4:02 am

That worked! I guess the simplest path was the easiest one.Now as to why the call to member function error.You got me there. I checked for syntax error and couldn't find one.Line 108 is exactly the same as the one above.It looks pretty standard its just a call to start the chat so I have no idea why its not working.Thanks for the help with the root path that seems to be resolved.:)

Fatal error: Call to a member function printChat() on a non-object in /home2/xxxx/public_html/phpBB3/chat/index.php on line 108
BoonI
Member
 
Posts: 11
Joined: Sat Dec 20, 2008 7:24 am
Top

Postby OldWolf » Sun Jan 04, 2009 12:24 pm

"Call to a member function printChat() on a non-object" is telling you that inside that function there is a call to a class that doesn't exist. You must have chopped off the chat header by accident, the part that calls the chat file and creates the object:

Put this just after $user->setup();, but before ?>
Code: Select all
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "www.survivorsresource.com";
$params["theme"] = "green";
$params["max_msg"] = 0;
$params["max_nick_len"] = 15;
$params["nick"] = $user->data["username"];
$params["language"] = "ru_RU";
$params["isadmin"] = false;
$params["admins"] = array("admin" => "password");
$params["serverid"] = md5(__FILE__);
$params["debug"] = false;

$chat = new phpFreeChat($params);
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top


Post a reply
12 posts • Page 1 of 1

Return to phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)

Who is online

Users browsing this forum: No registered users and 8 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub