#!/usr/bin/perl
#------------------------------------------------------------------------------
# UltraThreads
# Copyright (c) 2000 Kelvin Wu
#
# 2000.08
#------------------------------------------------------------------------------
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();
# Check if forum is closed
printMessage("$lng{'forumClosedLb'}", "$lng{'forumClosed'}")
if $cfg{'forumClosed'} && !$user->{'admin'};
# Print HTTP header
printHttpHeader();
# Check if request is coming from this site
checkReferer();
# Get CGI parameters
my $cgi = new UTCGI;
my $topicId = int($cgi->param('id'));
my $a = $cgi->param('a');
$topicId or paramError($lng{'errTpcIdMiss'});
# Get topic data
my $query = "SELECT boardId FROM ut_topics WHERE id = $topicId";
my $sth = query($query);
my ($boardId) = $sth->fetchrow_array();
$boardId or entryError($lng{'errTpcNotFnd'});
$sth->finish;
# Check if user is forum/board admin
$user->{'admin'} || $user->{'superMod'} || boardAdmin($user->{'id'}, $boardId) or adminError();
# verify topic
#print "Content-type: text/html\n\n";
#print $a;
#exit;
if ($a eq "o")
{
print "test";
$query = "update ut_topics set verify = 1 where id = $topicId";
}
if ($a eq "c")
{$query = "update ut_topics set verify = 0 where id = $topicId";}
$dbh->do($query) or dbError();
# Redirect back
my $age = $user->{'defaultUser'} ? $cfg{'postsAge'} : $user->{'postsAge'};
redirect("board_show.cgi?id=$boardId&msg=TpcDelete&age=$age");
Wyszukiwarka
Podobne podstrony:
417066 post verify x cgidemo cgi 850listart cgi id=3demo cgi 648demo cgi 992demo cgi 54więcej podobnych podstron