• 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

Forum members only SMF

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

Post a reply
30 posts • Page 1 of 2 • 1, 2

Postby EOAA » Mon Jun 18, 2007 4:31 pm

I've made the chat folder outside of the forum folder and have been able to connect the forum SSI.php to the chat. If I'm registered in the forum then it automatically logs me into the chat with the same username as the forum username, great. But what do I do to stop guests from joining the chat. Basically I need to ban all except forum members, how do I do that?
EOAA
Member
 
Posts: 29
Joined: Wed Jun 13, 2007 2:47 am
Top

Postby mrjackmrjac » Fri Aug 10, 2007 7:14 pm

if(logged_in_SMF)
{
// configure params, excetera...
}
else
{
// throw him/her away from the chat
header("Location: http://www.somewhereelse.com/");
}
mrjackmrjac
New member
 
Posts: 1
Joined: Fri Aug 10, 2007 7:08 pm
Location: Italy
  • Website
  • YIM
Top

Postby marcozecca » Mon Nov 26, 2007 1:40 pm

help please!how can I integrate this chat with smf? how can it recognise username in smf and put the same one in the chat??
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Fri Jan 25, 2008 9:33 pm

<?php

/////////////////////////////////////////////////////////////////////////////////

// Include SSI.php. It is relative path! Chenge it for your path
require(dirname(__FILE__) . '/../smf/SSI.php');

$user_info = ssi_welcome('array');

if (!$user_info['is_guest'])
{
require_once dirname(__FILE__)."/src/phpfreechat.class.php";

/////////////////////////////////////////////////////////////////////////////////

$params = array();

// Some initializations are going here
// ......................................

// Setup user nickname
$params["nick"] = $user_info['is_guest'] ? "Guest-" . rand(1, 1000) : $user_info['name'];

// Other initializations are going here
// ......................................

/////////////////////////////////////////////////////////////////////////////////

$chat = new phpFreeChat($params);
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Your title is going here</title>
<?php
if (!$user_info['is_guest'])
{
$chat->printJavascript();
$chat->printStyle();

// Style sheet
echo '<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/style.css" />';
}
?>
</head>

<body>
<?php
if ($user_info['is_guest'])
{
// Some actions for not registered users are going here
}
else
{
$chat->printChat();
}
?>

</body>
</html>
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Postby marcozecca » Sat Jan 26, 2008 9:38 am

ah ok!thax!
but can you explain me,step by step,what should I do?I have smf installed, and I downloaded phpfreechat,and now?which files should I modifie?in which folders?
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Sat Jan 26, 2008 9:45 am

In what folder you have SMF installed?
Give me URL of your site...
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Postby marcozecca » Sat Jan 26, 2008 9:56 am

I installed smf in the principal folder, so that if you digit: www.mysite.com, you directly go to the smf! the chat in in the foder chat, and to go there you must digit www.mysite.com/chat/
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Sat Jan 26, 2008 10:17 am

Create directory chat in the root of your site.
Copy in it the following folders from phpfreechat installation package:

data
i18n
lib
src
themes


and the following files:

AUTHORS.txt
COPYING.txt
index.php
version.txt
Last edited by Kela on Sat Jan 26, 2008 10:17 am, edited 1 time in total.
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Postby marcozecca » Sat Jan 26, 2008 10:29 am

and the modifies that you wrote about logging into the chat with the same username of smf?where should I write them?
Last edited by marcozecca on Sat Jan 26, 2008 10:35 am, edited 1 time in total.
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Sat Jan 26, 2008 11:02 am

Open and edit index.php in the chat folder
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Postby marcozecca » Sat Jan 26, 2008 11:20 am

Please help me because I'm not so expert about php:

I have this lines in my index php files:
<?php

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Quick chat";
$params["nick"] = "guest".rand(1,1000); // setup the intitial nickname
$params["isadmin"] = true; // just for debug ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
//$params["debug"] = true;
$chat = new phpFreeChat( $params );

?>
<!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.en.html">Overview [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/overview.fr.html">Overview [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/overview.es.html">Overview [es]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/overview.ar.html">Overview [zh]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/overview.ar.html">Overview [ar]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/install.en.html">Install [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/install.fr.html">Install [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/faq.en.html">FAQ [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/faq.fr.html">FAQ [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/customize.en.html">Customize [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/customize.fr.html">Customize [fr]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/changelog.en.html">ChangeLog [en]</a>
</li>
<li class="item">
<a href="http://www.phpfreechat.net/changelog.fr.html">ChangeLog [fr]</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://sourceforge.net/projects/phpfreechat"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=158880&type=1" alt="SourceForge.net Logo" height="31" width="88" /></a><br/><br/>
<a href="http://www.hotscripts.com/?RID=N452772">hotscripts.com</a><br/>
<a href="http://www.jeu-gratuit.net/">jeu-gratuit.net</a><br/>
<a href="http://www.pronofun.com/">pronofun.com</a><br/>
</p>
</div>

<div class="content">
<?php $chat->printChat(); ?>
</div>

</body></html>


Where exactly should I put the lines you wrote me?is it enought yo add them at the end of the file, or should I overwrite anything???
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Sat Jan 26, 2008 11:29 am

<?php

/////////////////////////////////////////////////////////////////////////////////

require(dirname(__FILE__) . '/../SSI.php');

$user_info = ssi_welcome('array');

/////////////////////////////////////////////////////////////////////////////////

if (!$user_info['is_guest'])
{
require_once dirname(__FILE__)."/src/phpfreechat.class.php";

/////////////////////////////////////////////////////////////////////////////////

$params = array();
$params["serverid"] = md5("MySite Chat"); // calculate a unique id for this chat
$params["nick"] = $user_info['is_guest'] ? "Guest-" . rand(1, 1000) : $user_info['name'];
$params["title"] = "MySite Chat";
$params["language"] = "en_US";
$params["theme"] = "zilveer";
$params["shownotice"] = 0;
$params["display_ping"] = false;
$params["channels"] = array("Common room");
$params["time_offset"] = 2 * 3600;
$params["admins"] = array("" => "");
$params["frozen_nick"] = true;
$params["max_displayed_lines"] = 150;

if ($user_info["id"] == 1774)
$params["isadmin"] = true;

/////////////////////////////////////////////////////////////////////////////////

$params["container_type"] = "mysql";
$params["container_cfg_mysql_host"] = "localhost"; // default value is "localhost"
$params["container_cfg_mysql_port"] = 3306; // default value is 3306
$params["container_cfg_mysql_database"] = "your_database"; // default value is "phpfreechat"
$params["container_cfg_mysql_table"] = "chat"; // default value is "phpfreechat"
$params["container_cfg_mysql_username"] = "your_db_user"; // default value is "root"
$params["container_cfg_mysql_password"] = "your_db_password"; // default value is ""

/////////////////////////////////////////////////////////////////////////////////

$chat = new phpFreeChat($params);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>MySite Chat</title>
<?php
if (!$user_info['is_guest'])
{
$chat->printJavascript();
$chat->printStyle();
}
?>
</head>

<body>
<?php
if ($user_info['is_guest'])
{
// Not registered user
}
else
{
$chat->printChat();
}
?>
</body>
</html>

Type properly values:

$params["container_cfg_mysql_database"] = "your_database"; // default value is "phpfreechat"
$params["container_cfg_mysql_table"] = "chat"; // default value is "phpfreechat"
$params["container_cfg_mysql_username"] = "your_db_user"; // default value is "root"
$params["container_cfg_mysql_password"] = "your_db_password"; // default value is ""
Last edited by Kela on Sat Jan 26, 2008 11:29 am, edited 1 time in total.
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Postby marcozecca » Sat Jan 26, 2008 1:12 pm

ok thanks!!I got it!Wow!it's wonderful!

can I ask another question??
when I write something in the chat, it remains written,and visible,even for the other users that will connect a lot of time after, even hours or days!how can I erase all the message list each time I disconnect, or every day, for example?
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby marcozecca » Sat Jan 26, 2008 1:18 pm

and, how can I make appear in smf index the list of users currently online in chat?

if I could do these two thinsg, it would be wonderful!!

thanx a lot!
marcozecca
Member
 
Posts: 12
Joined: Mon Nov 26, 2007 1:36 pm
Top

Postby Kela » Sat Jan 26, 2008 1:57 pm

marcozecca
Implementing your wishes is required to write a bit of code... It take a some my time. I could do it for you if you make some donation for me. If you really interested in it - contact me via e-mail or ICQ: 339079437.

Have a nice day!
Chevrolet Captiva Club
Kela
Member
 
Posts: 13
Joined: Fri Jan 25, 2008 9:23 pm
  • Website
Top

Next

Post a reply
30 posts • Page 1 of 2 • 1, 2

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

Who is online

Users browsing this forum: No registered users and 7 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