Page Index Toggle Pages: 1
Topic Tools
Normal Topic What is the $uid variable for? (Read 1,643 times)
liuvincent19
YaBB Newcomer
*
Offline



Posts: 4

YaBB 2.6.0
Re: What is the $uid variable for?
Reply #2 - Oct 4th, 2011 at 2:53am
Post Tools
Im a pretty experienced perl programmer, and Im in the process of adding a simple ban/unban function in the forum that the moderators can use.
  
Back to top
 
IP Logged
 
Carsten
Ex Member


Re: What is the $uid variable for?
Reply #1 - Aug 21st, 2011 at 11:18am
Post Tools
$uid is a id to make the members (and boards) hash table pairs unique for the session. It consists of the last 3 digits in the unix time stamp - meaning it starts over every 1000 seconds.
« Last Edit: Aug 21st, 2011 at 3:37pm by »  
Back to top
 
IP Logged
 
sebastian nielsen
YaBB Newcomer
*
Offline



Posts: 3

YaBB 2.4
What is the $uid variable for?
Aug 1st, 2011 at 3:38pm
Post Tools
Hello. (I dont know if this is correctly placed, but I couldn't find any better place to place it)

Running Yabb 2.1 (I know theres a newer version but theres no swedish langpack for 2.5 so I just run a older version).

Im a pretty experienced perl programmer, and Im in the process of adding a simple ban/unban function in the forum that the moderators can use.

The position of user is set by using:

${$uid.$user}{'position'} = "[position name or position ID]";

Then I just run &UserAccount($user, "update") to write the changes.

The new ban function looks like this:

Position "" is normal user, position "2" is "banned user" (with no posting rights) and position "1" is a moderator group with rights to ban.

Code (Perl)
Select All
sub toggleban {

my $user = $INFO{'username'};
if (!${$uid.$username}{'password'}) { &LoadUser($username); }

if ((${$uid.$username}{'position'} eq "1")||(${$uid.$username}{'position'} eq "Administrator")||(${$uid.$username}{'position'} eq "Global moderator")) {

if (!${$uid.$user}{'password'}) { &LoadUser($user); }
if (${$uid.$user}{'position'} eq "") {

#Ban the user.

${$uid.$user}{'position'} = "2";
    $t = new Net::Telnet (Timeout => 10,
                          Prompt => '/:/');
    $t->open(Host => "minecraftserver.sebn.us.to", Port => 8765);
@crap = $t->cmd("ban $user");
$t->close;
}
else
{
if (${$uid.$user}{'position'} eq "2") {

#User is banned, unban user

${$uid.$user}{'position'} = "";
    $t = new Net::Telnet (Timeout => 10,
                          Prompt => '/:/');
    $t->open(Host => "minecraftserver.sebn.us.to", Port => 8765);
@crap = $t->cmd("pardon $user");
$t->close;
}
}
}
&UserAccount($user, "update");

$yySetLocation = qq~$scripturl?action=viewprofile;username=$user~;
&redirectexit;

} 




The question is, what is the porpose of $uid for? I printed the variable to screen and found out that its a sequatially increasing number that increases with each click.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top