Jump to content

Recommended Posts

Hi. This is my first post, won't be my last though. I found this site searching for help on my problem and decided to join up and get help here (and give it where I can.)

 

Anyways, on to my problem... (I've been at this one for a good four hours now, to no avail.)

 

I'm trying to create a hack for a chatroom I'm using (Flashchat 5.0.10) It's somewhat integrated with the phpfox 2 beta, the purpose of this hack is a "for-fun" filter where users can type a certain string ('xuserx' in this case) and the result would be, for the viewer, their own user name.

 

I.E:

input: xuserx is awesome

output: $username is awesome

 

So far, I've been able to retrieve data from the user's own cookie and have it print this into the chat. Would it be possible to have the chat read the viewer's cookie and print that data? or would it be better to actually use flashchat as a closed CMS integrated right into the phpfox database?

 

I'm trying to use cookies first as it would take less coding at this point. Any ideas (pseudo-code is fine for me :P)

Link to comment
https://forums.phpfreaks.com/topic/171215-echo-cookie-data-per-user-in-chatroom/
Share on other sites

Hello and welcome to PHPFreaks,

 

Personally I would do the replace xuserx for $username during the output stage, however I don't use Flashchat so I have no idea how it works, From what you have said I'm going to assume the user inputs a message the that's written to a database and then Flashchat read from the database to display the messages.

 

So really my question is where is PHP involved ?

as I'll need to know what entry points you have available, even if you Flashchat reads data from a data file for messages that would be a possible entry point.

I just downloaded a copy to take a peek, in the message.php file just update the parse function to something like this

	function parse($txt)
	{
		if($this->command != 'usrp')
		{
			$txt = $this->replaceBadWord(htmlspecialchars($txt));
			if($this->command == 'msg')
			{
				$txt = $this->parseURL($txt);
				$txt = $this->keyWords($txt);
			}
		}
		return $txt;
	}

	function keyWords($txt)
	{
		$txt = str_replace("xuserx",$_COOKIE['UserName'],$txt);
		return $txt;
	}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.