Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
YAPIH (Yet Another PHPMyChat Integration Hack) 1.0 Details »»
YAPIH (Yet Another PHPMyChat Integration Hack) 1.0
Version: 1.00, by version version is offline
Developer Last Online: Nov 2002 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 04-08-2002 Last Update: Never Installs: 15
 
No support by the author.

YAPIH (Yet Another PHPMyChat Integration Hack) 1.0 by Joshua McNeese <jmcneese@enterthemuse.com>

Now, first off, this is not an 'out-of-the-box' hack, that you can just uncompress and change a config file and expect to work right off the bat. This hack was the result of me spending a considerable amount of time hand-editing files and replacing variables to convice PHPMyChat to use the VBulletin user database table. You will have to modify this to work with your server/configuration, and if you are not familiar with the PHP internals of VBulletin or with MySQL, turn back now. You have been warned.

(1) Uncompress YAPIH-1.0.zip in the ServerRoot of your server, so that you will access the chat via http://yourhost.com/chat/

(2) Execute the SQL commands in the file 'chat.sql'. This will create the tables needed for PHPMyChat as well as modify your user table. Altering your user table is dangerous, so be sure to have backups handy.

(3) Modify your VB templates:

ADD these two variables to your 'phpinclude' template:
PHP Code:
$chatname str_replace(" ""%20"$bbuserinfo[username]);
$chatpass $bbuserinfo[password]; 
This will replace any space in a username with spaces, as PHPMyChat does not accept spaces in names, and assign it to the variable $chatname. The users hashed password is assigned to $chatpass, for convenience.

(4) Edit the /chat/config/config.lib.php3 to match your server/configuation/preference.

(5) Now, the last (and tricky) part. What you have now is a working PHPMyChat installation that will authenticate on the VBulletin user table, if you followed the instructions faithfully and received no errors. What must be done now is provide your users with a way to access the chatrooms that you have created. I do this via a DHTML/PHP4 menu panel that lists the available chatrooms, and opens the chatroom in a 600x400 java popup box. You can do this anyway you want, so long as the link is provided via a template in VBulletin, or if you know how to pass variables to custom PHP scripts from within the 'phpinclude' template (which is what I do). The URL you must use is in this format:

Code:
/chat/index.php3?U=$chatname&PWD_Hash=$chatpass&Ver=H&L=english&R0=$chatroom&T=1&D=10&N=200&EN=1
Where $chatname and $chatpass are provided by the 'phpinclude' template, and $chatroom is provided by however you choose to assign that variable. It's up to you to figure out how you wish to do so, because everyone structures their site navigation in a different way.

To see the end-user representation of this hack, go to http://www.enterthemuse.com/ and login as 'test', password 'test'. On the left side of the site is a panel-based menu that will include a section 'Chat'. Take a look around, pay attention to where the URLs point and try it out.

It might work for you, it might not, it's totally dependent on your understanding of how to pass variables from your VB templates (in particular 'phpinclude'). Try it, and if all else fails, post your experiences on vb.org.

Download it HERE.

Good luck,

Joshua McNeese

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-19-2002, 12:55 PM
version's Avatar
version version is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i've seen plenty of referrals from vb.org and people fiddling around as test, but has no one actually tried this yet? i am surprised, because there are loads of people always requesting this very thing. :surprised:
Reply With Quote
  #3  
Old 06-03-2002, 01:39 PM
ashy ashy is offline
 
Join Date: Dec 2001
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I cant believe there are no replies to this.

Well I have just installed it and so far so good.

I did take a full mysqldump back up - perhaps your warnings put people off - so they should.

I can hot link from forums to the phpmychat ok - all I would love to do now is have a dynamic list of live chat rooms from phpmychat, a list of users that are in there - Any ideas Please

Also some tidying of course for my own site and wondering how best to integrate your "gender" for the user table into the registration process - what type of input is this supposed to be?

And a lot of testing of course - user drop out restarts that sort of thing.

Thanks,

Steve
www.southport.gb.com
Reply With Quote
  #4  
Old 06-03-2002, 02:00 PM
TWTCommish's Avatar
TWTCommish TWTCommish is offline
 
Join Date: Oct 2001
Location: Pittsburgh, PA, USA
Posts: 783
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There isn't by any chance any EASY way to integrate phpMyChat with the vB layout, is there?
Reply With Quote
  #5  
Old 06-03-2002, 02:27 PM
ashy ashy is offline
 
Join Date: Dec 2001
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found this one very clear to implement.

Just make sure you do a mysqldump backup first (eg as instructed in vbulletin.com Server - moving server - dummies version).

This is the 3rd variant I have tried and if you want only VB registered users in the chat - it looks the best IMHO
Reply With Quote
  #6  
Old 06-03-2002, 02:33 PM
ixian's Avatar
ixian ixian is offline
 
Join Date: Oct 2001
Location: Denver, CO
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think this hack would get a lot more response, and perhaps become one of the more popular hacks, if a bit more in the way of instructions were provided, particularly on passing variables.

I uploaded the files in a /chat directory, no problem.
I created/added the tables as outlines in chat.sql, no problem
I added the variables to my phpincludes template, no problem.

It's the link usage I have a problem with. I can create a link easy - I use a DHTML menu myself - and the chat index opens, but the variables for vb user/password (yes I am logged in) are not passed along. This is natural enough, I imagine, because when calling it from the front page of my site the phpincludes template is not read. I can't seem to get the username/password passed along even if I link to it within my forums.

In particular, this statement:
Quote:
or if you know how to pass variables to custom PHP scripts from within the 'phpinclude' template (which is what I do).
Catches my eye - if we don't know how, and you do, you think you could share? Even an example of how you did it would be helpful.

There also needs to be a way to redirect to the user_not_logged_on template for folks who aren't registered.

I could try taking a crack at it, but it might be easier if Version gave some pointers here.
Reply With Quote
  #7  
Old 06-04-2002, 07:32 AM
version's Avatar
version version is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ixian, the phpinclude template is always parsed, even for the front page of the site, if you include("$forumpath/global.php").

here's the chatstuff in my phpinclude template:
PHP Code:
if ($bbuserinfo[userid] != "0") {
  
$chatname str_replace(" ""%20"$bbuserinfo[username]);
  
$chatpass $bbuserinfo[password];

  
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
  
mysql_select_db($dbname) or die("Can't select database");

  
mysql_query("DELETE from chat_users where u_time < ".(time() - 240)." and u_time > 0");
  
$num_chatters_query mysql_query("SELECT DISTINCT username FROM chat_users WHERE room != \"PRIVATE_ROOM\"");
  
$num_chatters mysql_num_rows($num_chatters_query);

  if (
$num_chatters == "0") {
    
$chatextra "";
  } elseif (
$num_chatters == "1") {
    
$chatextra "(1 user)";
    
$istext "is";
    
$membertext "member";
  } else {
    
$chatextra "($num_chatters users)";
    
$istext "are";
    
$membertext "members";
  }

  
$who_chatters_query mysql_query("SELECT DISTINCT username FROM chat_users");

  while (
$chatters mysql_fetch_array($who_chatters_query)) {
    
$who_chatters .= "&nbsp;$chatters[username]&nbsp;";
  }
  
  eval(
"\$chatinfo = \"".gettemplate("forumhome_chatinfo")."\";"); 

also in my phpinclude, specifically the bit that builds the dynamic menu:
PHP Code:
ob_start();
  
$pan = new Panel();
  
$pan->addPanel"1""General""$forumpath/menu_general.php" );
  
$pan->addPanel"2""Help""$forumpath/menu_help.php" );  
  if (
$bbuserinfo[userid] != "0") {
    
$pan->addPanel"3""User""$forumpath/menu_user.php" );
    
$pan->addPanel"4""Chat $chatextra""$baseurl/forums/menu_chat.php?username=$chatname&password=$chatpass);
    
$pan->addPanel"5""Misc.""$baseurl/forums/menu_misc.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
    if (
$bbuserinfo[usergroupid] == "6") {
      
$pan->addPanel"6""Moderator""$baseurl/forums/menu_mod.php?username=$chatname&password=$chatpass);
      
$pan->addPanel"7""Administrator""$baseurl/forums/menu_admin.php?username=$chatname&password=$chatpass);
       
$pan->addPanel"8""Test""$baseurl/forums/menu_test.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
     }
    if (
$bbuserinfo[usergroupid] == "7" || $bbuserinfo[usergroupid] == "5") {
      
$pan->addPanel"6""Moderator""$baseurl/forums/menu_mod.php?username=$chatname&password=$chatpass);
      
$pan->addPanel"7""Test""$baseurl/forums/menu_test.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
     }
  }
  
$pan->Display(); 
  
$menucontents ob_get_contents();
ob_end_clean(); 
as you can see, i pass variables to my subscripts variables in the URLs, i.e. $chatname as $username, $bbuserinfo[userid] as $userid.

here is the contents of the "menu_chat.php" script mentioned above:
PHP Code:
print "<a href=\"/chat/index.php3?U=$username&PWD_Hash=$password&Ver=H&L=english&R0=General&T=1&D=10&N=200&EN=1\">General Chat</a><br>
 <a href=\"/chat/index.php3?U=
$username&PWD_Hash=$password&Ver=H&L=english&R0=Poetry+Slam&T=1&D=10&N=200&EN=1\">Poetry Slam</a><br>"
i am also attaching the template for the forumhome_chatinfo. let me know if there is more questions, and if someone wants to add more (or better) instructions to my package, send me the changes and i will give you credit. (busy life right now, got twins on the way )
Reply With Quote
  #8  
Old 06-10-2002, 06:58 PM
ixian's Avatar
ixian ixian is offline
 
Join Date: Oct 2001
Location: Denver, CO
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The only php pages on my site are the forums. The rest is done via ssi. I have a feeling something will get jacked but good if I try to included global.php on my non-php front page. I wish there was an easy way to add this as a forums addon, right now I can't make heads or tails of what you are doing with the phpinclude template.
Reply With Quote
  #9  
Old 06-11-2002, 04:10 PM
version's Avatar
version version is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ixian,

ah, i understand what you mean now. what i can suggest is that you build a front page in PHP, since that can be coded in such a way as to work like SSI (ala include(), exec(), virtual(), etc.), then you can include the global.php and have the phpinclude parsed even for your front page.

what exactly are you trying to display on your front page? give me an example, and maybe i can help out with an alternative.
Reply With Quote
  #10  
Old 06-13-2002, 07:14 AM
solent solent is offline
 
Join Date: May 2002
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i try it and i found it great although i have a couple of problems.

First my username and password is not directly passed when i click on the chat rooms although i did exactly as you said.

Second the chat room dose not open in a new window in the specified resolution that i passed to it.

Any ideas please
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07485 seconds
  • Memory Usage 2,335KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete