<?php
include("connect.php");
$Username = $_GET['Username'];
$login=mysql_connect("127.0.0.1","root",'');
	
mysql_selectDB("karaoke",$login);

$query=mysql_query("SELECT * from admin where Username='$Username'");


	$tmp_file_name = $_FILES['file']['tmp_name']; 
	$file_name = $_FILES['file']['name']; 
	$file_dir = './photos/'.$_POST['title'].'/';  
	if(is_dir($file_dir)) 
	{ 
	move_uploaded_file($tmp_file_name,$file_dir.$file_name); 
	$img_url = $file_dir.$file_name; 

	$query = "INSERT INTO image(Image)VALUES('$img_url')";
	$result = $db->query($query);

	$db->close();
	echo "<script language='javascript'>alert('Upload Success');window.location='adminaccount.php?Username=$Username'</script>";
}
?>