Welcome, Guest. Please Login or Register.
October 02, 2024, 02:30:08 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  English Help  |  Extract username from cookie « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Extract username from cookie  (Read 594 times)
stewade
Noobie
*
Posts: 12


I wish I was a Llama!

Extract username from cookie
« on: February 17, 2004, 12:28:19 PM »
Reply with quote

YaBB SE Version: 1.5.5

Problem Description:
I'm running a shout box on top of my new forum with 15 sec auto refresh inside an iframe. I picked up the $username var to auto load user into shout box. Works cool...

BUT, I am developing a "BIG CHAT" box using similar techniques but cannot grab the $username in my popup for some reason (despite global var).

see http://www.fishep.com/fep/forum

I noticed that the YaBB SE forum cookie has the username as first value and I am wondering if anyone has or could work an extraction for the username in js. That way I can pinch it from the cookie instead of wasting hours as I already have.

Any help greatly appreciated.  ;)
Logged
B
Noobie
*
Posts: 26


Silence is golden.

WWW
Re:Extract username from cookie
« Reply #1 on: February 17, 2004, 03:41:45 PM »
Reply with quote

Just fyi....the cookie saves the users member number, not their username. You would then have to use that number to get their info from the db table. I've done it on one of my sites...it's pretty simple. :) I did it with php, though....dunno much about js. Sorry.

B
« Last Edit: February 17, 2004, 03:42:31 PM by B » Logged
stewade
Noobie
*
Posts: 12


I wish I was a Llama!

Re:Extract username from cookie
« Reply #2 on: February 17, 2004, 07:03:54 PM »
Reply with quote

I see what you're saying but the chat box popup is totally independent of yaBB when running and doesn't link to the tables. So I don't want to write a function in the shout box simply to extract a username. As you can see from the example, it works OK in TINY CHAT but I can not pick up the user in BIG CHAT...

I spose I'm looking to set a single string value cookie from BoardIndex.php and read the cookie from the chat box but doing this elonquently is my problem.

A solution in php would be great too...

My Plan...
Essentially I want to write a cookie from BoardIndex, read it from my popup so that it can be used as the username in a <form> that writes to a text file for the chat box in a popup. The popup uses an iFrame that calls a PHP file that formats a text file and loads it.

(The reason: simply by calling a different text file I can effectively have rooms. This method has proven to be very FAST and without needing full screen refresh...)

That all makes sense I'm sure...  (doesn't it?) :-\
Logged
stewade
Noobie
*
Posts: 12


I wish I was a Llama!

Re:Extract username from cookie
« Reply #3 on: February 17, 2004, 08:46:56 PM »
Reply with quote

No need to worry anymore.

Got it working (YIPPEE !!)  8)

Used

<input type="hidden" name="name" value="<?php echo $_COOKIE["feptmp"] ?>">

setcookie is called from template.php using this...

setcookie("feptmp", $username);

Quite simple really  :-[

« Last Edit: February 17, 2004, 08:47:29 PM by stewade » Logged
B
Noobie
*
Posts: 26


Silence is golden.

WWW
Re:Extract username from cookie
« Reply #4 on: February 17, 2004, 11:23:04 PM »
Reply with quote

lol It's always the simple things that seem to elude us. ::) Glad ya got it working.

B
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Extract username from cookie « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.067 seconds with 20 queries.