<?php

	require_once 'dbconfig4.php';
	
	if(isset($_GET['adid']))
	{
		
		$stmt_select = $DB_con->prepare('DELETE image FROM investusers WHERE user_id =:adid');
		$stmt_select->execute(array(':adid'=>$_GET['adid']));
		$imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
		unlink("images/admin/".$imgRow['image']);
		
		$stmt_delete = $DB_con->prepare('DELETE FROM investusers WHERE user_id =:adid');
		$stmt_delete->bindParam(':adid',$_GET['adid']);
		$stmt_delete->execute();
		
		//header("Location: admin.php");
		echo"<script type='text/javascript'>window.location.href = 'admin.php';</script>";
	}

?>