Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    OR USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •