<?php
//=====================================
// LINKER Category Engine
//=====================================
// Filename : del_comment.php
// Path : Main directory
// last update : 2002/03/13
// Desc : Delete comment
//=====================================
//=====================================
// Info File include
//=====================================
$time1 = microtime();
include ("./function/base_info.php");
include ("./function/main_func.php");
include ("./function/$Sdb_type.php");
include ("./function/template.php");
$lan_dir = $HTTP_COOKIE_VARS[cook_lan];
if ($lan_dir && file_exists("./$lan_dir/u_common.php"))
include ("./$lan_dir/u_common.php");
else include ("./$Slang/u_common.php");
//=====================================
// DB_LAYER / TEMPLATE
//=====================================
$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);
$tpl = new Stemplate($Stemplate);
$tpl->define (array( del_check => "pass_check.html" ));
$tpl->assign(array(
TEMPLATE => $Stemplate,
DOMAIN => $Sdomain,
CHARSET => $Scharset,
MWIDTH => $Smain_width,
BGCOLOR => $Sbgcolor,
ALIGN => $Salign,
SID => $sid,
SNAME => $l_del_comment,
REPATH => $repath
));
show_menu();
show_here("","",$l_del_comment);
//===============================================
// Password check part
//===============================================
if (!$switch) {
$tpl->assign(array(
L_INPUT => $l_submit,
L_NOPASS => $l_error_nopass,
PAGE_HEADER => implode("",file("$Stemplate/header.html")),
PAGE_FOOTER => implode("",file("$Stemplate/footer.html")),
EDIT_FORM => "del_comment.php?switch=submit"
));
$tpl->parse("MAIN","del_check");
$tpl->simprint("MAIN");
//====================================
// Establish Time
//====================================
if ($Stime == "Y") check_time($time1);
exit;
}
//===============================================
// Password submit and Delete comment
//===============================================
// error check
if (!$sid) errmsg($l_error_nolink);
if (!$passwd) errmsg($l_error_nopass);
// trim post data
while (list($key,$val) = each($HTTP_POST_VARS))
$$key = trim($val) ;
//=====================================
// Password check and delete link
//=====================================
$db->query("select passwd,parent from LINKER_COM where passwd='$passwd' and sid='$sid'");
if (!$db->numrow) errmsg($l_error_misspass);
$row = $db->nrecord();
// Minu Comment num
$db->query("update LINKER_LINK set comment = comment-1 where sid='$row[parent]'");
$db->query("delete from LINKER_COM where sid='$sid'");
header("Location: review.php?sid=$repath");
?>