I have set up this chat on my site but my site has a login that stores usernames in a database, can someone help me adjust this chat so that it uses the username of the member logged in instead of guest or asking for a nickname, i have no experience so i need all the help i can get.
Yah what you want to integrate the script with? There's a number of integration techniques posted here for scripts like punBB, phpBB, etc. They're at http://www.phpfreechat.net/faq but is one of them what you want to integrate with?
Ok i am very inexperienced but ill try and explain, i am not using any kind of thing like phpbb or whatever that is, i simply designed a site using photoshop and frontpage, i then followed a tutorial to create login, registration and members list pages that use a database, then i decided that on my site i would like a chat page. So i found this installed it on my site but i would rather it automatically set the nickname to the members username that is stored in the database i have already setup.
I can upload or post any of the page scripts from my site if necessary and a screenshot of my database structure from phpmyadmin.
Does that help or am i just telling you useless information.
Utan made a login script for pfc located here: http://www.phpfreechat.net/forum/viewtopic.php?id=4678 , since it sounds like some kind of more "unique" script that you made yourself people here probably wont write a whole integration script if its too much work? (maybe i'm wrong?)
I'm not sure what kind of login/registration script you're using for your site so nobody here would know exactly how to integrate it, there must be a way to integrate it, i know that, but how easy it would be is a totally different subject . we'd probably have to see what were working with before we can give you any guidance.
# make a variable out of the username that was posted in the index-page. $username = $_POST['user']; # I am not sure what this thing makes.. but it has something with safety to do. $escaped_username = mysql_real_escape_string($username); # make a md5 password. $md5_password = md5($_POST['pass']);
$queryN = mysql_query("select * from user where username = '".$username."' and password = '".$md5_password."' AND level='1'");#This variable will check if the user is a level 1 user (Normal User) $queryA = mysql_query("select * from user where username = '".$username."' and password = '".$md5_password."' AND level='9'");#This variable will check if the user is a level 9 user (Admin User)
What about this, i found this liine in the index.php page of the chat: $params["nick"] = "guest".rand(1,1000); // setup the intitial nickname, is there any way to modify that to connect to my database and get the username?
require_once dirname(__FILE__)."/src/phpfreechat.class.php"; $params = array(); $params["title"] = "Nealeweb Chat"; $params["nick"] =$_SESSION['user']; $params['firstisadmin'] = true; //$params["isadmin"] = true; // makes everybody admin: do not use it on production servers $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["debug"] = false; $chat = new phpFreeChat( $params );
<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>
only thing though that the first person that get there will be admin.. to stop this from happening put this parameter instead of the one you have $params['firstisadmin'] =false;
put it to false or copy paste and overwrite the one you have.. then you need to "/rehash" .
Command rehash: is used to delete the PFC cache, when you do edit the index.php or the Parameters in PFC you need to send the command "/rehash" without the quotes and you must be admin in order to complete the command.