<?php 
 session_start();
 
 date_default_timezone_set('Asia/Bangkok'); //set timezone ให้ตรงกับประเทศไทย
 
 $usid = $_GET["deid"];
 
 include "../../Connections/connect_mysql.php";

  	$sql = " select * from user_tb where userid={$usid}";
	$result = mysql_query($sql) or die(mysql_error());
	if(mysql_num_rows($result)==0){
		//	
	}else{
		$rsemp = mysql_fetch_array($result);
		$userpicpath = $rsemp['userpicpath'];
	}
 

	 //unlink("../uploads/" . $fname);

	if(unlink("../user/fileupload/" . $userpicpath)){
		//== update ชื่อไฟล์ ในฐานข้อมูล
			$sqlupp = " update user_tb set userpicpath='-' where userid={$usid}";
			$resultupp = mysql_query($sqlupp) or die(mysql_error());
		//=========================
		$data = 0;
	}else{
		$data = 1;
	}

	echo "{$data}";
?>
<?
 	mysql_close($c);
?>
