Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-17-2002, 06:01 AM   PM User | #1
rodeo_cowboy
New Coder

 
Join Date: Aug 2002
Location: OR USA
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
rodeo_cowboy is an unknown quantity at this point
login? help please

Yes I use scarecrow version 2.02 for my message board software (available at http://scarecrow.sourceforge.net) and I was wondering how do I make it so that if the user is logged in, that on everypage it says something like "Welcome, User_name" can someone please help me?
rodeo_cowboy is offline   Reply With Quote
Old 08-17-2002, 11:49 PM   PM User | #2
wolfpower
New to the CF scene

 
Join Date: Aug 2002
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
wolfpower is an unknown quantity at this point
OK first you have to find out where the user data is being held then you have to call that data to the script. Then display the string that has the username in it.

Code:
$datafile = "/path/to/your/user/data/data.txt";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/~!/ ~!/g;
  $FORM{$name} = $value;
}
$string = $FORM{'id'};

open(INF,$datafile);
@mydata = <INF>;
close(INF);

$count = 0;
foreach $i (@mydata) {
   chomp($i);
   ($id,$login,$email,$whatever,$whatever1,$whatever2) = split(/\&&/,$i); ## change && to what ever is between the strings
   if (uc($id) eq uc($string)) {
  print "$login\n";
   }
}
__________________
WolfPower Script And Programs
WolfPower
wolfpower is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:39 PM.


Advertisement
Log in to turn off these ads.