acaz โพสต์ 2008-11-23 19:17:46

Ajax IM For UCenter Home มาทำห้องสนทนากัน

Originalhttp://www.discuz.net/thread-1096971-1-1.htmlOriginal Ajax IM Chathttp://www.ajaxim.com/Screen Shout


Demo
http://www.czspaces.com
เข้าระบบ แล้วคลิ๊กที่เมนู เลือกห้องสนทนา

หากคุณเคยเล่น MSN ตัวนี้ละม้ายคล้ายๆ กันครับ

1. ดาวน์โหลดไฟลล์ด้านล่าง
2. ทำการแตกไฟลล์
เปิดไฟลล์ config_im.php
แก้ไข$sql_user   = 'USER';            //User DB
$sql_pass   = 'PASS';            //PASS DB
$sql_host   = 'localhost';            
$sql_db   = 'DB';               //DBเปิดไฟลล์ js/config.js
แก้ไขโดเมนvar yourdomain            = 'localhost';         // ajax im themeรวมไปถึงการตั้งค่าต่างๆ อยู่ที่ไฟลล์นี้ครับ
บันทึก

3. อัพโหลดไฟลล์และโฟเดอร์ที่อยู่ใน โฟเดอร์ Upload ขึ้นไปยัง
root ของ ucenter home

4. เข้าระบบ phpMyadmin
แล้วอัพเดทฐานข้อมูลด้วยไฟลล์ sql ที่อยู่ในโฟเดอร์ SQL
หรือคัดลอกจากที่นี่ไป#
# โครงสร้างตาราง `uchome_messages`
#

CREATE TABLE IF NOT EXISTS `uchome_messages` (
`recipient` text,
`sender` text,
`message` text,
`type` text,
`stamp` text,
`id` bigint(20) unsigned NOT NULL auto_increment,
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM;

#
# โครงสร้างตาราง `uchome_backmessages`
#

CREATE TABLE IF NOT EXISTS `uchome_backmessages` (
`recipient` text,
`sender` text,
`message` text,
`type` text,
`stamp` text,
`id` bigint(20) unsigned NOT NULL auto_increment,
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM;


#
# เพิ่มฟิลด์โครงสร้างตาราง `uchome_member`
#

ALTER TABLE `uchome_member` ADD `email` mediumtext;
ALTER TABLE `uchome_member` ADD `is_online` int(11) default 0;
ALTER TABLE `uchome_member` ADD `last_ping` text;
ALTER TABLE `uchome_member` ADD `last_ip` varchar(15) default NULL;
ALTER TABLE `uchome_member` ADD `banned` tinyint(1) default 0;
ALTER TABLE `uchome_member` ADD `admin` tinyint(1) default 0;
ALTER TABLE `uchome_member` ADD `buddyicon` varchar(4) default 'none';
ALTER TABLE `uchome_member` ADD `profile` text;

#
# โครงสร้างตาราง `uchome_chats`
#

CREATE TABLE IF NOT EXISTS `uchome_chats` (
`room` text,
`user` text,
`id` bigint(20) unsigned NOT NULL auto_increment,
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM;

#
# โครงสร้างตาราง `uchome_buddylists`
#

CREATE TABLE IF NOT EXISTS `uchome_buddylists` (
`id` int(11) NOT NULL auto_increment,
`user` varchar(255) NOT NULL default '',
`buddy` varchar(255) NOT NULL default '',
`group` varchar(100) NOT NULL default '',
PRIMARY KEY(`id`),
KEY `user` (`user`,`group`)
) TYPE=MyISAM;

#
# โครงสร้างตาราง `uchome_blocklists`
#

CREATE TABLE IF NOT EXISTS `uchome_blocklists` (
`id` int(11) NOT NULL auto_increment,
`user` varchar(100) NOT NULL default '',
`buddy` varchar(100) NOT NULL default '',
PRIMARY KEY(`id`),
KEY `user` (`user`,`buddy`)
) TYPE=MyISAM;

#
# อัพเดทโครงสร้างตาราง `uchome_member`
#

UPDATE `uchome_member` set admin=1 where username='เปลี่ยนชื่อเป็น uid แรกของคุณใน uch';ตรงUPDATE `uchome_member` set admin=1 where username='เปลี่ยนชื่อเป็น uid แรกของคุณใน uch';อย่าลืมเปลี่ยนเป็นชื่อของคุณนะครับ
ผมแยก SQL มาทำใหม่
ไม่แนะนำให้ติดตั้งผ่าน install.php ครับ

เปิดไฟลล์
header.htm ใน template ucenter home ที่คุณใช้งาน
ค้นหา<script language="javascript" type="text/javascript" src="source/script_face.js"></script>เพิ่มในบรรทัดต่อไป<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/effects.js" type="text/javascript"></script>
<script src="js/window.js" type="text/javascript"></script>
<script src="js/sm2.js" type="text/javascript"></script>
<script src="js/utils.js" type="text/javascript"></script>
<script src="js/config.js" type="text/javascript"></script>
<script src="js/im.basic.js" type="text/javascript"></script>
<script src="js/ajax_im.js" type="text/javascript"></script>
<script >
function isgoodok(){return true;}
window.onerror=isgoodok;
</script>เปิดไฟลล์ footer.htn ใน template ucenter home ที่คุณใช้งาน
เพิ่มโค๊ดต่อไปนี้<div align="left">
<div id="modal" style="display:none;" align="left">
   <div id="loginDialog" style="display:none;" align="left">
   
      <p style="display:none;"><span id="login_error_msg" class="dialog_error" style="display:none">&nbsp;</span></p>

      <p style="display:none;" > <span class="dialog_input"><input type="text" id="username"style="display:block" /></span></p>
      <div style="clear:both"></div>
      <p style="display:none;" ><span class="dialog_label lang-password langinsert-pre">:</span> <span class="dialog_input"><input type="password" id="password" onfoucs="this.select();" onkeypress="System.keyHandler(event, System.login);" /></span></p>
      <div style="clear:both;display:none;"></div>
      <p style="display:none;" >
         <span id="login_dialog_links" class="dialog_links" style="width:285px;" onselectstart="return false;" onmousedown="return false;" style="display:block" >
            <a href="#" class="stdButton lang-signOn" id="signon_button" onclick="System.login();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
            <a href="#" class="stdButton lang-register registerObject" onclick="Dialogs.register();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
            <a href="#" class="stdButton lang-forgotPassword langinsert-pre" onclick="Dialogs.forgotPass();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"> </a>
         </span>
      </p>
      <div style="clear:both;display:none;"></div>
   </div>
   
   <div id="registerDialog" class="registerObject" style="display:none;" align="left">
      <p><span class="dialog_modal_title lang-register"></span></p>
      <div style="clear:both;display:none;"></div>
      <p><span id="register_error_msg" class="dialog_error" style="display:none">&nbsp;</span></p>
      <div style="clear:both;display:none;"></div>
      <p><span class="dialog_label lang-username langinsert-pre">:</span> <span class="dialog_input"><input type="text" id="newusername" onkeypress="System.keyHandler(event, System.register);" /></span></p>
      <div style="clear:both;display:none;"></div>
      <p><span class="dialog_label lang-password langinsert-pre">:</span> <span class="dialog_input"><input type="password" id="newpassword" onkeypress="System.keyHandler(event, System.register);" /></span></p>
      <div style="clear:both;display:none;"></div>
      <p><span class="dialog_label lang-confirm langinsert-pre">:</span> <span class="dialog_input"><input type="password" id="newpassword2" onkeypress="System.keyHandler(event, System.register);" /></span></p>
      <div style="clear:both"style="display:none;"></div>
      <p><span class="dialog_label lang-email langinsert-pre">:</span> <span class="dialog_input"><input type="text" id="newemail" onkeypress="System.keyHandler(event, System.register);" /></span></p>
      <div style="clear:both;display:none;"></div>
      <p>
         <span class="dialog_links" style="width:190px;" onselectstart="return false;" onmousedown="return false;">
            <a href="#" class="stdButton lang-register" id="register_button" onclick="System.register();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
            <a href="#" class="stdButton lang-cancel" onclick="Dialogs.login();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
         </span>
      </p>
      <div style="clear:both;display:none;"></div>
   </div>
   
   <div id="forgotPassDialog" style="display:none;" align="left">
      <p><span class="dialog_modal_title lang-passwordReset"></span></p>
      <div style="clear:both;display:none;"></div>
      <p><span id="forgotpass_error_msg" class="dialog_error" style="display:none">&nbsp;</span></p>
      <div style="clear:both;display:none;"></div>
      <p><span class="dialog_label lang-emailAddress langinsert-pre">: </span> <span class="dialog_input"><input type="text" id="resetto" onkeypress="System.keyHandler(event, System.resetPass);" /></span></p>
      <div style="clear:both;display:none;"></div>
      <p>
         <span class="dialog_links" style="width:190px;" onselectstart="return false;" onmousedown="return false;" style="display:none;">
            <a href="#" class="stdButton lang-reset" id="forgotpass_button" onclick="System.resetPass();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
            <a href="#" class="stdButton lang-cancel" onclick="Dialogs.login();return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);"></a>
         </span>
      </p>
      <div style="clear:both;display:none;"></div>
   </div>
</div>


<div class="itemList" id="statusList" style="display:none;" align="left">
   <a href="#" class="lang-available langinsert-post" onclick="Status.set(0, Languages.get('available'));return false;"><img src="/themes/dark/online.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-friendsOnly langinsert-post" style="border-bottom: 1px solid #bfbcb8;" onclick="Status.set(99, Languages.get('friendsOnly'));return false;"><img src="/themes/dark/online.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-busy langinsert-post" onclick="Status.set(1, Languages.get('busy'));return false;"><img src="/themes/dark/away.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-beBackLater langinsert-post" onclick="Status.set(1, Languages.get('beBackLater'));return false;"><img src="/themes/dark/away.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-away langinsert-post" onclick="Status.set(1, Languages.get('away'));return false;"><img src="/themes/dark/away.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-custom langinsert-post" id="customMessage" style="border-top: 1px solid #bfbcb8;" onclick="Status.customAway();$('statusList').style.display='none';return false;"><img src="/themes/dark/away.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
   <a href="#" class="lang-invisible langinsert-post" style="border-top: 1px solid #bfbcb8;" onclick="Status.set(49, Languages.get('invisible'));return false;"><img src="/themes/dark/offline.png" style="border:0;" alt="" title="" />&nbsp;&nbsp;</a>
</div>
<div class="itemList" id="fontsList" style="display:none;" align="left">
   <a href="#" onclick="IM.active.setFont('Song');return false;">Song</a>
   <a href="#" onclick="IM.active.setFont('Italics');return false;">Italics</a>
   <a href="#" onclick="IM.active.setFont('Lishu');return false;">Lishu</a>   
   <a href="#" onclick="IM.active.setFont('Bold');return false;">Bold</a>
   <a href="#" onclick="IM.active.setFont('Arial');return false;">Arial</a>
   <a href="#" onclick="IM.active.setFont('Comic Sans MS');return false;">Comic Sans MS</a>
   <a href="#" onclick="IM.active.setFont('Courier New');return false;">Courier New</a>
   <a href="#" onclick="IM.active.setFont('Garamond');return false;">Garamond</a>
   <a href="#" onclick="IM.active.setFont('Georgia');return false;">Georgia</a>
   <a href="#" onclick="IM.active.setFont('Impact');return false;">Impact</a>
   <a href="#" onclick="IM.active.setFont('Tahoma');return false;">Tahoma</a>
   <a href="#" onclick="IM.active.setFont('Times New Roman');return false;">Times New Roman</a>
   <a href="#" onclick="IM.active.setFont('Verdana');return false;">Verdana</a>
</div>
<div class="itemList" id="fontSizeList" oncontextmenu="return false;" style="display:none;" align="left">
   <a href="#" onclick="IM.active.setFontSize(8);return false;">8</a>
   <a href="#" onclick="IM.active.setFontSize(10);return false;">10</a>
   <a href="#" onclick="IM.active.setFontSize(12);return false;">12</a>
   <a href="#" onclick="IM.active.setFontSize(14);return false;">14</a>
   <a href="#" onclick="IM.active.setFontSize(16);return false;">16</a>
   <a href="#" onclick="IM.active.setFontSize(18);return false;">18</a>
   <a href="#" onclick="IM.active.setFontSize(20);return false;">20</a>
   <a href="#" onclick="IM.active.setFontSize(22);return false;">22</a>
   <a href="#" onclick="IM.active.setFontSize(24);return false;">24</a>
</div>
<div class="itemList" id="fontColorList" style="cursor: pointer;display:none;" align="left">
   <table class="tTable">
      <tr>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#000000;" onclick="IM.active.setFontColor('#000000');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#b8b8b8;" onclick="IM.active.setFontColor('#b8b8b8');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#b4ad3b;" onclick="IM.active.setFontColor('#b4ad3b');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#bb5c54;" onclick="IM.active.setFontColor('#bb5c54');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#755a5c;" onclick="IM.active.setFontColor('#755a5c');"></td>
      </tr>
      <tr>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#a9b5ef;" onclick="IM.active.setFontColor('#a9b5ef');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#d65a20;" onclick="IM.active.setFontColor('#d65a20');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#e39230;" onclick="IM.active.setFontColor('#e39230');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#a71334;" onclick="IM.active.setFontColor('#a71334');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#590099;" onclick="IM.active.setFontColor('#590099');"></td>
      </tr>
      <tr>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#d40088;" onclick="IM.active.setFontColor('#d40088');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#0030ac;" onclick="IM.active.setFontColor('#0030ac');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#676f11;" onclick="IM.active.setFontColor('#676f11');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#769321;" onclick="IM.active.setFontColor('#769321');"></td>
         <td class="colorItem" style="width:13px;height:13px;border:1px solid #000;background-color:#3966fe;" onclick="IM.active.setFontColor('#3966fe');"></td>
      </tr>
   </table>
</div>
<div class="itemList" id="divContext" oncontextmenu="return false;" style="display:none;" align="left">
   <a href="#" class="lang-contextGetInfo" onclick="Context.profile();return false;"></a>
   <a href="#" class="lang-contextIM" onclick="Context.createIM();return false;"></a>
   <a href="#" id="contextBlock" class="lang-contextBlock" onclick="Context.blockBuddy();return false;"></a>
   <a href="#" class="lang-contextRemove" onclick="Context.removeBuddy();return false;"></a>
</div>
<div id="languageList" style="display:none;" align="left">
</div>
</div>ก่อน</body>เพิ่มเมนู
ค้นหา<li class="app-share"><a href="space.php?do=share"><img src="image/app/share.gif" alt="แชร์" />แชร์</a></li>เพิ่มโค๊ดนี้ในบรรทัดต่อไป<li class="app-chat"> <a href="javascript:"onclick="System.login('$_SGLOBAL','qwe');"><img src="image/app/chat.gif" alt="ห้องสนทนา" />ห้องสนทนา</a></li>บันทึกทั้งหมดทำการอัพเดทแคชไฟลล์
แล้วทดสอบครับ
((12))

Nuknan โพสต์ 2008-11-23 19:41:55

สิ่งที่รอมานาน ~:1:~

buachompoox โพสต์ 2008-11-23 20:35:16

ตอบกลับโพสของ หนึ่ง acaz

อันนี้เห็นแว้บๆที่ discuz.net ท่านโจ้เอามาจนได้อิๆ ขอบคุณมากมายครับ (~63~)

nakeo โพสต์ 2008-11-24 00:33:23

~:3:~



จะจิ๊กไปดีใหมนาาา

An_ant โพสต์ 2008-11-24 07:07:15

ใครจะอาสามาทำให้เป็นตัวธรรมดามั่ง เห็นแล้วอิจฉา

networkthai โพสต์ 2008-11-24 12:21:20

ปล่อยมาแล้ว ดีใจจัง

seasonchange โพสต์ 2008-11-24 13:33:02

ขอบคุงคร้าบ

ขอบคุงคร้าบบบบบบบบบบบบบบบบ

new2007 โพสต์ 2008-11-25 16:00:12

ขอบคุณมากงับ

น่าสนใจมาก ๆ

adman โพสต์ 2008-12-25 16:22:48

ใช้ db อันเดียวกับเว้บเราหรือเปล่าครับ
หรือว่าสร้าง db ขึ้นมาใหม่

pratoonap โพสต์ 2009-2-17 11:39:19

ขอบคุณครับ
หน้า: [1] 2 3 4
ดูในรูปแบบกติ: Ajax IM For UCenter Home มาทำห้องสนทนากัน