PDA

View Full Version : login? help please



rodeo_cowboy
08-17-2002, 06:01 AM
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?

wolfpower
08-17-2002, 11:49 PM
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.



$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";
}
}