<?php
//=====================================
// LINKER Category Engine
//=====================================
// Filename : del_link.php
// Path : Manage directory
// last update : 2002/07/13
// Desc : Delete Link
//=====================================
//=====================================
// File include part
//=====================================
include ("./authen.php");
include ("../function/$Sdb_type.php");
include ("../function/main_func.php");
include ("../$Slang/m_common.php");
$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);
//=====================================
// Delete part
//=====================================
while(list($key, $val)=each($HTTP_POST_VARS))
{
if ($val=='delete')
{
$a++;
// Minus Sub link number
$db->query("select path,parent,upfile from LINKER_LINK where sid='$key'");
$row = $db->nrecord();
if (isset($row[parent]))
$db->query("update LINKER_CAT set sub_link = sub_link-1 where sid='$row[parent]'");
//
$upfile = @unserialize(stripslashes($row[upfile]));
@unlink("../upfile/$upfile[1]");
@unlink("../upfile/thumb_" . $upfile[1]);
$db->query("delete from LINKER_COM where parent='$key'");
$db->query("delete from LINKER_LINK where sid='$key'");
}
}
if ($dup=='yes')
$meta = "<meta http-equiv='refresh' content='2; url=./dup_link.php'>";
else
$meta = "<meta http-equiv='refresh' content='2; url=./view_link.php?type=delete'>";
//=====================================
// Print result
//=====================================
print <<<EOF
<head>
$meta
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>
<body bgcolor="#E9E9E9">
<table width="500" border="1"><tr><td bgcolor="#000066" align="center">
<font color="white" size="2"><b>$a $l_del_link</b></font>
</td></tr></table>
EOF;
?>