Location: PHPKode > projects > WebAddressBook > webaddressbook/db_delete_user.php
<?

session_start();
if(isset($_SESSION['username']))
{
    include('smarty_init.inc.php');
    include('language.inc.php');
    include('header.inc.php');
    include('db_functions.inc.php');
    include('footer.inc.php');
    
    $time = 0;
    
    if($_POST['del_user'] == 1) {
        // delete photos if exist
        $data = db_get_persons($_POST['id'], "all");
        for($i=0; $i<sizeof($data); $i++) {
            if($data[$i]['PICTURE'] != "") {
                unlink($PHOTO_DIR.$data[$i]['PICTURE']);
            }
        }
        
        $success = db_del_user($_POST['id']);
        $smarty->assign("message", $lang['user_deleted']);
        if( is_bool($success) ) {
            if($success) {
                $smarty->assign("result", $lang['done']);
            } else {
                $smarty->assign("result", $lang['failed']);
            }   
        } else {
            $smarty->assign("result", $lang['failed']."<br>".$success);
        }
    }
    
    $smarty->display('result_page.tpl');
}
else
{
    include('unauthorized.inc.php');   
}

?>
Return current item: WebAddressBook