<?php
	include ("../inc/koneksi.php");

	$nama = $_POST['nama'];
	//$fas = $_POST['fas'];
	$ket = $_POST['ket'];
	//$lat = $_POST['lat'];
	//$lang = $_POST['lang'];
	
	$wrong = "";
	
	//upload foto
	$temp_foto = explode(".", $_FILES['foto']['name']);
	$newfilefoto = generateRandomString() . '.' . end($temp_foto);
	move_uploaded_file($_FILES['foto']['tmp_name'], "../img/rent/" . $newfilefoto);

	//simpan ke dalam mhs
	$query = "INSERT INTO rent (nama,keterangan,foto) 
								VALUES ('$nama','$ket','$newfilefoto')";		
	mysql_query($query) or die (mysql_error());


	if($wrong == "")
		$url = "index.php?act=rent_input&ket=berhasil";
	else
		$url = "index.php?act=rent_input&ket=$wrong";

	echo "<script language=\"javascript\">
		window.location='../$url';
	</script>";

?>