<?php

	require_once 'dbconfig.php';
	
	if(isset($_GET['user_id']))
	{
		$stmt_select = $DB_con->prepare('SELECT image FROM mobileusers WHERE user_id=:user_id');
		$stmt_select->execute(array(':user_id'=>$_GET['user_id']));
		$imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
		unlink("images/admin/".$imgRow['image']);
		
		$stmt_delete = $DB_con->prepare('DELETE FROM mobileusers WHERE user_id=:user_id');
		$stmt_delete->bindParam(':user_id',$_GET['user_id']);
		$stmt_delete->execute();

		echo"<script type='text/javascript'>window.location.href = 'userlists.php';</script>";
		
	}

?>