#!/usr/bin/perl
#------------------------------------------------------------------------------
# UltraThreads
# Copyright (c) 2000 Kelvin Wu
#
# 2000.10
#------------------------------------------------------------------------------
use strict;
# Imports
use CGI::Carp qw(fatalsToBrowser);
BEGIN{ ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); }
use DBI;
use UTConfig;
use UTLanguage;
use UTMain;
use UTCGI;
#------------------------------------------------------------------------------
# Get user
connectDb();
my $user = authUser();
# Get CGI parameters
my $cgi = new UTCGI;
my $boardId = $cgi->param('boardId');
my $a = $cgi->param('a');
my $username = $cgi->param('username');
my $id = $cgi->param('id');
$boardId or paramError($lng{'errBrdIdMiss'});
# Check if user is admin or moderator of the board
my $boardAdmin = boardAdmin($user->{'id'}, $boardId) || $user->{'admin'} || $user->{'superMod'};
$boardAdmin or adminError();
if ($a eq "a") {
#Check username
my $query = "SELECT id FROM ut_users WHERE userName = '$username'";
my $sth = query($query);
my $dbUserId = $sth->fetchrow_array();
#$sth->finish;
#!$dbUserId || $dbUserId == my $optUserId or userError($lng{'errNameGone'});
if($dbUserId)
{$query = "INSERT INTO ut_members SET userId = $dbUserId, boardId = $boardId";
$dbh->do($query) or dbError();
}
}
if ($a eq "d") {
my $query = "DELETE FROM ut_members WHERE userId = $id AND boardId = $boardId";
$dbh->do($query) or dbError();
}
# Redirect
redirect("board_admmember.cgi?id=$boardId");
Wyszukiwarka
Podobne podstrony:
board?mmember cgiwwwboard cgi board=DHTML&id=5wwwboard cgi board=dhtmlwwwboard cgi board=DHTML&id=4wwwboard cgi board=dhtml&send=1wwwboard cgi board=DHTML&id=6wwwboard cgi board=DHTML&id=7wwwmail cgi board=dhtmlBoarddemo cgi 850listart cgi id=3więcej podobnych podstron