• 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

Authenticating against MySQL (Joomla)

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

Post a reply
8 posts • Page 1 of 1

Postby micoots » Thu Sep 07, 2006 10:18 pm

Hi,

I've search the forums but still don't quite understand how I can configure PFC to authenticate against users in a MySQL database.

The MySQL database (a Joomla database) has the jos_users table which contains the usernames and the md5 hashes of their passwords.

How do I tell phpFreeChat to query that table and the username field within that table to get the username of the user?

Thanks.

Michael.
micoots
New member
 
Posts: 4
Joined: Thu Sep 07, 2006 3:14 pm
Top

Postby youngcalihottie » Fri Sep 08, 2006 7:33 am

you make your own code to query your login system. once they have been authenticated, you set the param:

params["nick"] = iconv("ISO-8859-1", "UTF-8", $YOURARRAY['YOURVARIABLE']);

params["nick"] is how you tell phpfreechat that you want to manually set the nick.

hope this helps
youngcalihottie
New member
 
Posts: 9
Joined: Mon Sep 04, 2006 11:55 pm
Top

Postby aidejoomla » Mon Sep 25, 2006 3:03 pm

what is your array in french ?
thanks
aide pour joomla
help for joomla
aide-joomla
aidejoomla
New member
 
Posts: 9
Joined: Mon Sep 25, 2006 2:50 pm
  • Website
Top

Postby micoots » Thu Sep 28, 2006 1:16 pm

Hi,

I'm glad I just got through installing the stable release. Now for integrating into Joomla, I re-read this forum post:

youngcalihottie wrote:you make your own code to query your login system. once they have been authenticated, you set the param:

params["nick"] = iconv("ISO-8859-1", "UTF-8", $YOURARRAY['YOURVARIABLE']);

params["nick"] is how you tell phpfreechat that you want to manually set the nick.

hope this helps

Hmm.. it does help I guess, but I'm not a php programmer so wouldn't know how to start with coding my own query to the login system.

For joomla, all users are contained in the table jos_users, where they have md5 hash passwords.

Any advice how I can start this code? (noting I have never programmed php before).

Thanks.

Michael.
Last edited by micoots on Thu Sep 28, 2006 1:17 pm, edited 1 time in total.
micoots
New member
 
Posts: 4
Joined: Thu Sep 07, 2006 3:14 pm
Top

Postby madmumbler » Sun Oct 01, 2006 4:14 pm

I also use Joomla. I use CB though with Joomla -- are you using a vanilla Joomla installation (and do you have the latest update?).

I don't have an exact answer, but here's a theory I don't have time to test right now (but will because I do eventually want to do this *LOL*).

Go look in your Joomla files for the SQL query code. It's standard, and off the top of my head I want to say it's in a config.php file in the main index, maybe? You'll see it.

Use that as your starting point. Write yourself a basic code to call info from the db so you can see how it works.

Then go look at the flie for the login module you're using (whether it's the standard mod or CB or whatever). Look for the same "guts" in there, where you see it calling the database.

You'll have to write a file and merge it with the login for phpFreeChat, calling appropriate login actions from phpFreeChat, so it uses the MySQL queries and authentication.

I know it sounds easy in theory... *LOL*

I may be cutting my chops on this and writing my very first programming. *LOL*

I have done some basic php/MySQL scripting, following along with a book.

Once you figure out the queries, THEN if you're feeling brave, go on Joomla's site and read the info there about writing your own mods and coms and you can write an extension for Joomla.

As for now, I'm running phpFreeChat inside a Joomla page wrapper, with the link on the menu to the wrapper only visible to registered users. It's not a perfect solution, and far from secure, but most of the members on the website I'm using this on don't have the skill or the time or desire to hack it when they can simply log in and use it. *LOL*

HTH,
Lesli in SWFL.

micoots wrote:Hmm.. it does help I guess, but I'm not a php programmer so wouldn't know how to start with coding my own query to the login system.

For joomla, all users are contained in the table jos_users, where they have md5 hash passwords.

Any advice how I can start this code? (noting I have never programmed php before).

Thanks.

Michael.
Lesli in SWFL.
http://www.madmumbler.net/main/shop

Have YOU donated to the phpFreeChat project yet? Look for the PayPal button in the right column!
madmumbler
Member
 
Posts: 29
Joined: Sat Sep 30, 2006 9:57 pm
Location: SWFL
  • Website
Top

Postby madmumbler » Sun Oct 01, 2006 4:17 pm

One more thing, before you do ANY coding, back up your db, your server files, and update your Joomla to the latest version if it's not already. TOTALLY debug that, update any extensions that need it. Get EVERYTHING up to date and working FIRST. Then you can go writing code. *LOL* It's far easier to start with the newest versions rather than working with stuff that's one or two releases old and you have to start over from scratch because something changes.

HTH,
Lesli in SWFL.
Lesli in SWFL.
http://www.madmumbler.net/main/shop

Have YOU donated to the phpFreeChat project yet? Look for the PayPal button in the right column!
madmumbler
Member
 
Posts: 29
Joined: Sat Sep 30, 2006 9:57 pm
Location: SWFL
  • Website
Top

Postby micoots » Mon Oct 02, 2006 12:44 am

Hi Lesli,

madmumbler wrote:One more thing, before you do ANY coding, back up your db, your server files, and update your Joomla to the latest version if it's not already. TOTALLY debug that, update any extensions that need it. Get EVERYTHING up to date and working FIRST. Then you can go writing code. *LOL* It's far easier to start with the newest versions rather than working with stuff that's one or two releases old and you have to start over from scratch because something changes.

HTH,
Lesli in SWFL.

Thanks for your detailed reply.

I am running the latest Joomla 1.0.11 stable, with CB 1.0.1.

I haven't the time at the moment to delve into coding (Real life means all my time currently is taken up on moving various servers to another data centre for my webhosting company - my website where I want to use this chatter is a hobby) but I will try and look at this again beginning of November.

I'm not sure how far I will get with this as I'm not a coder and never have been (well, apart from shell scripts - I am a sys admin by trade :) ).. but will try.

If anyone else makes progress on this before November, I'd be interested to know!

Thanks again.

Michael.
micoots
New member
 
Posts: 4
Joined: Thu Sep 07, 2006 3:14 pm
Top

Postby Yokhannan » Sun Oct 22, 2006 12:59 pm

Might I suggest rather than expecting pfc from having to deal with authentication, you simply utilize your existing session system to check authentication.

You say you are using a database and you are already storing all the necessary user information... so therefore your website should already be using sessions. (you are using sessions, right?!?!)

Rather than add a ton of code into pfc, just authenticate via sessions.

There is no reason you couldn't authenticate people with under 10 lines of code placed into the top of /chat/index.php

Code: Select all
if (isset($sid) && $sid)
{
   session_id ($sid);
   session_start();
}
if ( $_SESSION['userid'] == '' )
{
   die('Sorry you need to log into our website first.');
}

Or whatever you use for sessions and user_ids....

Let your server do what it does best... let php does what it does best... and let pfc does what it do best (and authentication isn't what it does best).

Yokhannan
Yokhannan
Member
 
Posts: 18
Joined: Sun Oct 22, 2006 12:50 pm
  • Website
Top


Post a reply
8 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

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