Location: PHPKode > scripts > Linker IMG > linker-img/del.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : del.php
// Path  : Main directory
// last update : 2002/05/08
// Desc : Delete links 
//=====================================

//=====================================
// 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( edit_check => "pass_check.html" ));


$tpl->assign(array(
TEMPLATE	=> $Stemplate,
DOMAIN			=> $Sdomain,
CHARSET		=> $Scharset,
BGCOLOR		=> $Sbgcolor,
MWIDTH			=> $Smain_width,
ALIGN			=> $Salign,
SID				=> $sid,
SNAME			=> $l_del_link,
RECAT			=> $recat
));

show_menu();
show_here("","",$l_del_link);
show_search();

//===============================================
// 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.php?switch=submit"
));

$tpl->parse("MAIN","edit_check");
$tpl->simprint("MAIN");

//====================================
// Establish Time
//====================================

if ($Stime == "Y") check_time($time1);
exit;
}


//===============================================
// Password submit and Delete link
//===============================================

// 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,upfile from LINKER_LINK where passwd='$passwd' and sid='$sid'");
if (!$db->numrow) errmsg($l_error_misspass);
$row = $db->nrecord();
$recat = $row[parent];

 // Minu LINK num 
if (isset($row[parent])) $db->query("update LINKER_CAT set sub_link = sub_link-1 where sid='$row[parent]'");


// File Delete
$upfile = @unserialize(stripslashes($row[upfile]));
@unlink("./upfile/$upfile[1]");
@unlink("./upfile/thumb_" .$upfile[1]);

// Comment, Link Delete
$db->query("delete from LINKER_COM where parent='$sid'");
$db->query("delete from LINKER_LINK where sid='$sid'");

header("Location: index.php?cat=$recat"); 

?>
Return current item: Linker IMG