package Pm::Security; #/ # a module to encapsulate security-related functions #/ use CGI; use strict; use warnings; use Exporter; use vars qw($VERSION @ISA @EXPORT_OK); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT_OK = qw( _tests banned bounced get_salt password_correct password_set get_client_IP login logout ); ###################################################################### sub banned { #* # gets the banned status of a uid # !this function requires updating # the code in this function needs to # conform to a more basic format # there should only be one return! #* # my ($db, $uid) = @_; # a DBH && a uid # my $query = "select banned from users where ID = " . $db->quote($uid); # my $result = pm::bc_sql::sql_execute($db, $query); # should result in a 0 or a hash with one key: a UID # $result is a hash reference # if (ref $result eq "HASH") { # if ($result->{banned} eq 2) { # return 1; # 1 when the user is banned # } # } return reversed @_; # 0 when the user is not banned #usage: if (banned($db, $uid)) { print "yer banned, bitch"; } } 1;