Solved

passing member.php username login cookie to flash chat login screen

Posted on 2004-08-07
9
336 Views
Last Modified: 2011-10-03
I'm trying to integrate a basic Flash chat into my site, have rudimentary knowledge of PHP and really nothing in Flash, but have, I think, a basic question.  

Can someone help just pass my main site username/NickName,  for which a cookie is set at main site login,  to a FlashChat login screen field and echo/print it in there?   Ideally I'd like to get rid of the FlashChat user name login field totally and simply have the room selection...but unless that is easy, the former solution would be fine for now.  I assume the latter would require a swf decompilation etc etc??....would certainly like to move towards that, but first things first......  

The cookie is set on the main login member.php page, which is in the root directory:
             setcookie( "imNick", $p_arr[NickName], 0, '/' );

The chat.php file which contains the login code below is in a /FlashChat subdirectory:


<?php
ob_start();
//

$nick = $HTTP_POST_VARS[nick];

$roomid = $HTTP_POST_VARS[roomid];


//

require "config.inc.php";

session_start();

dbget_dbopen();

//

$this_chatter_logged = false;

$onunload_action = "";

if($nick and $roomid){

      make_session_unregister();

      make_session_unregister_chat();

      $chatsession = chat_login_room($nick,$roomid);

      if($chatsession){

            $last_msg_id = $chatsession[lastid];

            $user_login = $chatsession[nick];

            $chat_room_id = $roomid;

            $uid = 0;            //Vulnerable

            $user_role = "";      //Vulnerable

            make_session_register();

            make_session_register_chat();

            $onunload_action = "onunload=\"javascript:hiddenScreen('chatout.php');\"";

            $this_chatter_logged = true;

      }

}

dbget_dbclose();

if($this_chatter_logged){

      $nick = urlencode($user_login);

      $this_swf = "chat.swf?chat_delay=$def_chat_delay&chat_nick=$nick&chat_ad_movie=chatad.php&chat_ad_x=$def_ad_x&chat_ad_y=$def_ad_y&chat_ad_width=$def_ad_width&chat_ad_height=$def_ad_height";

      include "tmp.chatrun.php";

}else{

      include "tmp.chatlogin.php";

}

?>

#########################################################
The associated html which is in tmp.chatlogin.php file in /FlashChat  is as follows :
#########################################################

<tr>

      <td valign=bottom class=tip bgcolor="<?=$def_bgc_head_sep?>" height=125>

      <form name=chat action=chat.php method=post onsubmit="return (document.chat.nick.value.length>0?true:false);">

      <table width=100% border=0 cellspacing=0 cellpadding=1>

      <tr>

            <td rowspan=3 width=5%>&nbsp;</td>

            <td rowspan=3 class=tipf valign=top width=35%><?=$msg_chat_tip?></td>

            <td align=right valign=middle class=tip width=30%>

                  <?=$msg_select_nick?>&nbsp;

            </td>

            <td align=left valign=middle class=tip width=30%>

                  <input class=textfield name=nick>

            </td>

      </tr>

      <tr>

            <td align=right valign=middle class=tip>

                  <?=$msg_select_room?>&nbsp;

            </td>

            <td align=left valign=middle class=tip>

                  <?include "selectroom.inc.php";?>

            </td>

      </tr>

#########################################################

Thanks.  Please let me know if I am leaving anything critical out that is needed.  

Steve

0
Comment
Question by:Steve_Newbie
  • 5
  • 4
9 Comments
 

Author Comment

by:Steve_Newbie
ID: 11756314
OK, not sure if this is harder than I think......and associated point value, so increasing to 200.  Still relatively new to the board overall.   Help please.
Thanks.
S
0
 
LVL 7

Expert Comment

by:fixitben
ID: 11758740
Well here is a link to setting and reading cookies inside of flash.
 http://www.permadi.com/tutorial/flashCookie/


But do you have the Fla's or just the swf's, because if you don't have the fla's then there really isn't anything that we can do.

But Basically in flash you would have
if (cookie=="false")
{}
else{textbox = cookie;}}


But first you would have to load the get cookie.php file that reads the cookie set and returns a value of the cookie or false if no cookie has been set that was set from your home page.

So Mainly it has to do with php and not so much the flash side because all you are going to do is call up the php page and get the value from it.

Hope this helps a little
Fixitben
0
 

Author Comment

by:Steve_Newbie
ID: 11759651
Thanks.  OK, I created a getcookie.php file, which is in the /FlashChat subdirectory where the php login files are and where chat.swf is,  and included the main site login file where the cookie was set (member.php)
The cookie is definitely set on the php side as I can echo it in the  tmp.chatlogin.php file just below the textfield where the login name is supposed to be entered.


<?php include "../member.php";?>
<?php
eval("\$p_arr[NickName]=\$$imNick;");
echo("cookieValue=$p_arr[NickName]");
?>


Also, here is the AS part of the FLA file that I think is relevant to the login:

// Frame 1 actions...

function process_client_message(msg) {
   get_users(false);
   msg = escape(msg);
   getURL(def_script_send + "?msg=" + msg + "&receiver_ip=" + this.chat_sendto_ip,this,"Error GetURL2" metod=194);
};
function process_server_message() {
   this.messages = Number (this.messages);
   if (this.messages > 0) {
         for (i = 1;  i <= this.messages; i ++) {
               this.chat.doReceiveMessage("cmsg" add i);
               }
         this.messages = 0;
         }
};
function chat_connect() {
   this.chat_interval = setInterval(this,"on_chat_interval",this.chat_interval_receive);
};
function chat_disconnect() {
   clearInterval(this.chat_interval);
};
function on_chat_interval() {
   getURL(def_script_receive,this,"Error GetURL2" metod=194);
   getURL(def_script_chatters,this.users_list,"Error GetURL2" metod=194);
};
function get_users(c) {
   if (c) {
         users_list.play();
         }
   else {
   users_list.gotoAndStop(1);
   }
};
function select_user(l , d) {
   if ( l <> this.chat_nick) {
         this.chat_sendto_nick = l;
         this.chat_sendto_ip = d;
         }
   else {
   this.chat_sendto_nick = ;
   this.chat_sendto_ip = ;
   }
};
function get_link() {
   this.chat_sendto_nick = ;
   this.chat_sendto_ip = ;
};
def_text_color = "0xFFFFFF";
def_script_send = "chatsend.php";
def_script_receive = "chatrec.php";
def_script_chatters = "chatusers.php";
this.error = ;
this.messages = 0;
this.chatters = 0;
this.chat_interval_receive = this.chat_delay;
this.chat_text_color = this.def_text_color;
this.chat_sendto_nick = ;
this.chat_sendto_ip = ;
this.chat_link_url = ;


Stuck from here on out......help?

Thanks.
S
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 7

Expert Comment

by:fixitben
ID: 11763121
Can you post the fla somewhere?  

Because those are just functions and they have to be used somewhere  I need to see how they are used and where.

fixitben
0
 

Author Comment

by:Steve_Newbie
ID: 11766091
OK, have a problem then. The files I extracted were by decompilation of the swf.  I don't think I can output the entire decompiled swf in fla format, at least with this software app.  So, we might be up against the problem you mentioned.  The product is available at   http://ecomstudio.net/sales/#9
and is basically a free GPL package app download (Flash Chat 1.9F GPL Package).  If you have the time to look at it, that would be great.  IF not, I understand and will just assign the points since you did answer the question I posed......I just can't get the final part done with my lack of knowledge in this area.  Please advise.
Thanks.
S  
0
 
LVL 7

Accepted Solution

by:
fixitben earned 200 total points
ID: 11766239
Steve_Newbie

Ok by decompiling it you probably broke the GPL.  Now if you purchased this product from the person you might just might recieve the Fla's.  The Fla is the orginal file that you created the flash thing in.  Such as a PSD in photoshop.  If you have the swf then I really can't help you much because with out it you really can't do anything.  The decompilers just break down everything so you can see what the other person did to create it or "borrow images or sounds" but that is illegal unless you have rights to them. So if you find a way to get the fla's then let me know.

Thanks
Fixitben
0
 

Author Comment

by:Steve_Newbie
ID: 11767708
I guess I need an education on this.  This is a free product. The GPL agreement that I read says that you can do anything with it as long as I display their copy-right on the product.  I spoke with the sales department (they sell other products for$$) and they had no problem with what I was trying to do....however, since this was sales and they do not have tech support for free products, they would not go any further to help in this regard.  So, I don't think I can get anything else from them.....but, am I wrong with all of the above? I can't see where the GPL is broken with all of this.  Please advise as a last comment.....
Thanks again.
Steve
0
 
LVL 7

Expert Comment

by:fixitben
ID: 11767772
I was just saying that You could have broken it.  Most of the time if you alter someone's stuff or use any of it in a way that they haven't said you could.  Which decompiling would normally be one of those?  You can break the agreement.  I was just warning you that it could be breaking the GPL.  Sorry I didn't put enought Emphasis on the Probably.  

Fixitben
0
 

Author Comment

by:Steve_Newbie
ID: 11767946
OK.  Thanks. Much appreciated.  I will see if they will send the FLA file.  They were very helpful before, except for any tech support.

Thanks again....learned a lot anyway re: cookies in Flash (might end up using another app for the same function).....and will repost if I can get the original FLA.

Steve
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Download slideshow or picture elements 16 437
Stock Videos 17 332
Adobe Flash Player - PPAPI plugin 6 648
Trying to contour a nose in a face portrait in After Effects 5 101
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question