• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Please help, database integration

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

Post a reply
12 posts • Page 1 of 1

Postby Nealec » Sat Jan 29, 2011 3:33 pm

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.
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby re*s.t.a.r.s.*2 » Sat Jan 29, 2011 3:40 pm

Can you tell us the what script are you using for your site..
Maybe someone here has it integrated and can help you with it...

but without knowing this, we cant be of any help..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby radionow » Sat Jan 29, 2011 5:02 pm

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?
My Site: http://chickentalk.org/
radionow
Member
 
Posts: 57
Joined: Sun Jan 10, 2010 6:26 pm
Top

Postby Nealec » Sat Jan 29, 2011 6:37 pm

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.
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby radionow » Sat Jan 29, 2011 6:45 pm

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 :P. we'd probably have to see what were working with before we can give you any guidance.
My Site: http://chickentalk.org/
radionow
Member
 
Posts: 57
Joined: Sun Jan 10, 2010 6:26 pm
Top

Postby Nealec » Sat Jan 29, 2011 6:51 pm

ok this is the login page script for my site:

<?php
session_start();
require_once 'database.php';

# 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)


if(mysql_num_rows($queryN) == 1)
{
$resultN = mysql_fetch_assoc($queryN);
$_SESSION['user'] = $_POST['user'];
header("location:Index.php");
}

elseif(mysql_num_rows($queryA) == 1)
{
$resultA = mysql_fetch_assoc($queryA);
$_SESSION['admin'] = $_POST['user'];
header("location:index.php");
}

else{
echo "Wrong Username or Password";
}
?>
<form name="back" method="post" action="index.php">
<input type="submit" name="back" id="back" value="Back to Home">

Does this help at all?
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby Nealec » Sat Jan 29, 2011 7:05 pm

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?
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby OldWolf » Sat Jan 29, 2011 8:55 pm

$params["nick"] = $_SESSION['user'];

Make sure to start the session at the top of the chat script.
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 Nealec » Sat Jan 29, 2011 9:05 pm

Hi thanks for helping but i think i may have done something wrong because its still asking for a nickname:

http://www.nealeweb.com/phpfreechat-1.3/

Here is the page script can u let me know if i did it right please.

<?php
session_start();
require_once 'database.php';
?>
<?php

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 );

?>
<!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="menu">
<p class="partner">
<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>

<div class="footer">
<font color="#FFFFFF">
<span class="partners">phpFreeChat partners:</span>
</font><font color="#FFFFFF">jeux gratuits |
</font><font color="#FFFFFF">jeux flash |
</font><font color="#FFFFFF">pronofun</font><font color="#FFFFFF"> |
</font><font color="#FFFFFF">areno</font><font color="#FFFFFF"> |
</font><font color="#FFFFFF">micropolia</font><font color="#FFFFFF"> |
</font><font color="#FFFFFF">zeitoun</font><font color="#FFFFFF"> |
</font>
<a href="http://federation.jeu-gratuit.net"><font color="#FFFFFF">federation</font></a>
</div>

</body></html>
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby re*s.t.a.r.s.*2 » Sun Jan 30, 2011 12:31 am

Hi,

I went to your site and just rehashed the chat..

Its working fine now..

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" .
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Nealec » Sun Jan 30, 2011 12:44 am

Hi thankyou so so much i dont know what rehashed means but i love it, your awesome!
Nealec
New member
 
Posts: 7
Joined: Sat Jan 29, 2011 3:29 pm
Top

Postby re*s.t.a.r.s.*2 » Sun Jan 30, 2011 4:13 am

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.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top


Post a reply
12 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 25 guests

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