Page 1 of 2

How to add ajax chat to subsoinc?

PostPosted: Wed Dec 14, 2011 1:11 pm
by falsadoo
I saw someone have added a chat room to subsonic and i am wondering how to do it... I am not good at programing so someone can tell me step by step how to do it... I really need to add that chat room because the chat that is in subsonic is very small and can not keep the massages

Re: How to add ajax chat to subsoinc?

PostPosted: Wed Dec 14, 2011 4:35 pm
by BKKKPewsey
falsadoo wrote:The chat that is in subsonic is very small and can not keep the massages

What sort of chat room are you hosting :shock:

:lol:

Re: How to add ajax chat to subsoinc?

PostPosted: Wed Dec 14, 2011 7:12 pm
by falsadoo
I do not have a chat room step up i just so someone have the theme darkness that have the chat option up there and i don't want the theme i just want the chat room but i have no idea how he did it and how to do it

Re: How to add ajax chat to subsoinc?

PostPosted: Thu Dec 15, 2011 4:03 am
by falsadoo
I figured out but now i run into another problem i want to delete the log in page from Ajax chat let it when the user log in to subsonic is automatically logged to the chat can someone help me with that?

Re: How to add ajax chat to subsoinc?

PostPosted: Sun Feb 12, 2012 12:29 pm
by Hellscream
I have idea but still need help from someone who can tell me how to read data from SQl table.
Example table:
( userID | username | email | password ) this is table from subregengine

and this is part of php file ( ajax chat users )

Code: Select all
<?php
/*
* @package AJAX_Chat
* @author Sebastian Tschan
* @copyright (c) Sebastian Tschan
* @license GNU Affero General Public License
* @link https://blueimp.net/ajax/
*/

// List containing the registered chat users:
$users = array();

// Default guest user (don't delete this one):
$users[0] = array();
$users[0]['userRole'] = AJAX_CHAT_USER;
$users[0]['userName'] = null;
$users[0]['password'] = null;
$users[0]['channels'] = array(0);


I appreciate any help

Re: How to add ajax chat to subsoinc?

PostPosted: Sun Feb 12, 2012 11:07 pm
by SparkyRih
Is this to add into subsonic (so that it is part of the layout)... Or should this become a service next to it?

Re: How to add ajax chat to subsoinc?

PostPosted: Sun Feb 12, 2012 11:18 pm
by Hellscream
This is a standalone service not related to SS in any way i just want to use your tables from subregengine so registered user can access chat inside SS.
I need code that will point to your tables with registered users.
$users[0]['userName'] = null;
$users[0]['password'] = null;
"null" values mean that user can enter anything and access chat without registering i dont like that.
Solution with reg page for chat is pfff terible double registration is anoying.
Question is. Is it possible to wrote code that will point to DB subsonicusers/table users/ colons username password.
For example u can access chat http://hellscream.dyndns.org/subchat without registering acc :(
THX for reply

This is code for register page for ajax chat

Code: Select all
<?php
include('PATHtoYOUR/chat/lib/data/users.php');
//check existing users   
   
   if ($_POST['username'])
   {
   //if user entered a name
   }
   //collect information from users.php
   $user_amount = count($users);
   for ($i=0; $i <=$user_amount;$i++);
   {
   //check usage of name
   if (strtolower($_POST['username']) == strtolower($users[$i]['userName']))
   $username_used = 1;
   }

//make sure user chose a password
if (!$_POST['password'])
$password_error = 1;

//ensure username avalible and password chosen
if (!$username_used and !$password_error)
{
//present user id accepted message
print 'Your selection '.$_POST['username'].' was accepted... your account was created. You may now login!!!';
$next_user = $user_amount++;
$new_user_information = '

//remote created from '.$_SERVER['REMOTE_ADDR'].'
$users['.$next_user.'] = array();
$users['.$next_user.'][\'userRole\'] = AJAX_CHAT_USER;
$users['.$next_user.'][\'userName\'] = \''.$_POST['username'].'\';
$users['.$next_user.'][\'password\'] = \''.$_POST['password'].'\';
$users['.$next_user.'][\'channels\'] = array(0,1);

?>';
$file_edit = fopen('PATHtoYOUR/chat/lib/data/users.php', 'r+');
fseek($file_edit, -3,SEEK_END);
fwrite($file_edit, $new_user_information);
fclose($file_edit);
}
//end of php

?>
<table border="0" align="center">
   <table border="0" align="center">
   <tr>
      <td>Use the form below to create a Chat user account.</td>
   </tr>
   <tr>
   <td>
   <!-- collect username and password information via form -->
   <form action="" method="post">
   Username:<input name="username" type="text" value="" /> 16 Character Maximum<br>
   Password:<input name="password" type="text" value="" /> No requirements.<br>
   <input name="submit" type="submit" value="Create" />
   </form>
   </td>
   </tr>
   </table>
</table>


I have errors related to writing something in php file
allow_url_fopen = On
allow_url_include = On
BUMP still dont like idea with double registration in SS

Re: How to add ajax chat to subsoinc?

PostPosted: Mon Feb 13, 2012 8:38 am
by SparkyRih
Ok I get it, so I can just donwload the Open Source AJAX Chat package...
I will see if I can make it use my DB...

Re: How to add ajax chat to subsoinc?

PostPosted: Mon Feb 13, 2012 2:13 pm
by Hellscream
TY for your time and help i appreciate that.

Re: How to add ajax chat to subsoinc?

PostPosted: Mon Feb 13, 2012 3:26 pm
by SparkyRih
So it just uses a plain PHP file to auth users...
And I can't just trick the file, because I use encrypted passwords instead of plain text passwords in the DB...

But I will see if I can find something to plug a DB into it.......

Edit: I figured it out :)
It's a matter of time now :P

Re: How to add ajax chat to subsoinc?

PostPosted: Mon Feb 13, 2012 6:16 pm
by Hellscream
SparkyRih wrote:So it just uses a plain PHP file to auth users...
And I can't just trick the file, because I use encrypted passwords instead of plain text passwords in the DB...

But I will see if I can find something to plug a DB into it.......

Edit: I figured it out :)
It's a matter of time now :P

:D like i said GENIUS
I cant w8 to test it

Re: How to add ajax chat to subsoinc?

PostPosted: Tue Feb 14, 2012 12:15 am
by muiz
Very nice..... cant wait

Re: How to add ajax chat to subsoinc?

PostPosted: Tue Feb 14, 2012 8:44 am
by SparkyRih
LOL, the way I wanted to do it is not possible... they dont allow code injection (which is a good thing imo)... so I have to find another way... but I will find it...

Re: How to add ajax chat to subsoinc?

PostPosted: Tue Feb 14, 2012 2:40 pm
by Hellscream
I have trust in you and I send you huge amount of positive energy so you can complete task :P.

Re: How to add ajax chat to subsoinc?

PostPosted: Tue Feb 14, 2012 6:09 pm
by SparkyRih
Ok, I'm able to use the usernames in my DB to access the chat, but I can't use the password (yet).
Since my passwords are encrypted, and ajax chat's passwords are plai ntext, I can't match them... I need to find the place in the code where the values of the login form are posted for the first time, so that I can encrypt the password, so it will match with my DB....

Edit: Nevermind, got the passwords working to! :D
Let mee cleanup the code a little, and I'll post my editted files wit hsome little instruction...