Welcome, Guest. Please Login or Register.
March 18, 2025, 12:21:04 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  |  Detecting Logged In Status In Perl « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Detecting Logged In Status In Perl  (Read 607 times)
ldk
Noobie
*
Posts: 3


I'm a llama!

Detecting Logged In Status In Perl
« on: September 08, 2003, 01:47:26 PM »
Reply with quote

YaBB SE Version: 1.5.3
PHP Version:
MySQL Version:
Server Platform:
Link to Forum:

Problem Description:
Hello!

I was using YaBB Gold and just converted to YaBBSE.  Thanks to an FAQ in other folder here, it was painless.  :D

Everything's working great with the forum but I had a separate little "upload graphics" utility that I wrote in PERL for members to easily upload graphics to their own folder to include in their posts.  Now this doesn't work because the cookie system is different for YaBBSE than YaBB Gold.

This is how I detected whether a member is logged in and if so what their username is:


$YaBBCookieName = "craftsterYaBBusername";

foreach (split(/; /,$ENV{'HTTP_COOKIE'}))
{
   ($cookie,$value) = split(/=/);
   $YaBBcookies{$cookie} = $value;
}

$USERNAME = $YaBBcookies{$YaBBCookieName} || "PleaseLogin";

if ($USERNAME eq "PleaseLogin")
{
...


Can someone help me rewrite this part for YaBBSE?

Thanks so much!
Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Detecting Logged In Status In Perl
« Reply #1 on: September 08, 2003, 03:05:41 PM »
Reply with quote

Take a peek at SSI.php, ssi_examples.php and ssi_examples.shtml  :)
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
ldk
Noobie
*
Posts: 3


I'm a llama!

Re:Detecting Logged In Status In Perl
« Reply #2 on: September 08, 2003, 07:11:58 PM »
Reply with quote

Hmmmmm... Thanks for the quick reponse.  I took a look at the example and I'm not sure how it will help me.

Sorry for being so thick.  I'm kinda self-taught at all this...
Logged
Metho
Sr. Member
****
Posts: 342


I'm a llama!

Re:Detecting Logged In Status In Perl
« Reply #3 on: September 08, 2003, 07:18:59 PM »
Reply with quote

Take a look at function welcome() ;) If you include that with SSI, if they're logged in (ie, cookie still good) it'll say Hey, *username*, you have X messages, X are new. And if a guest, it'll say Hey, Guest, please Login or Register. These txt's can, of course, be changed to whatever you'd like.

Methonis
Logged

Metho
Sr. Member
****
Posts: 342


I'm a llama!

Re:Detecting Logged In Status In Perl
« Reply #4 on: September 08, 2003, 07:27:38 PM »
Reply with quote

Re-reading your question, perhaps this is more specific. In whatever page you have this, just global $username. If they're logged in, $username will have their username. To check if they're logged in, just do if ($username != 'Guest')

Logged

ldk
Noobie
*
Posts: 3


I'm a llama!

Re:Detecting Logged In Status In Perl
« Reply #5 on: September 09, 2003, 01:47:04 PM »
Reply with quote

I'm still struggling with this.  I'm probably missing a key piece of knowledge but I think I'll try to explain the issue again and see if anyone has any more tips.

The Perl script I wrote for when I was using YaBBGold does quite a bit:

1. checks to see if the person running the script is logged if; if so reads the cookie to see exactly what the username is; and uses the username as the name of their unique "picture directory"

2. writes out all of the HTML/javascript for a complicated form which allows the user to do the following to the pictures in their "picture directory"

a. click on the name of any picture and see a preview of it and see the URL (which they can copy and paste it into their posting)

b. upload more graphics to their "picture directory"

c. delete any graphics in their "picture directory"

So... I really don't want to have to rewrite this whole thing in PHP since it took me a while to do.  It works in Perl and I think it's pretty secure and I don't have much experience in PHP.

What I really need is just to know is how, in Perl, to figure whether the current user is logged in an if so what their username is.

I took a look at YaBBSE's LoadCookie function and it looks like it reads the cookie data, calls "stripslashes" on it, and then calls "unserialize" on it.  I searched around for Perl equivalents of these two functions and found them and tried to recreate this code in Perl but it doesn't seem to work for me.

I don't know what to try next? ???
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Detecting Logged In Status In Perl « 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.172 seconds with 21 queries.