<title>Added</title><?php
$i=0;
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "data/$name");
${"p$i"} = $name;
$i++;
}
if (file_exists("data/$name")) {
rename("data/$name", "data/$name");
echo "Listing has ben added <br> <a href='main.html' target='_self'>Home</a> --- $name<br>";
} else {
echo " ---- ERROR ---- <br> $filename failed to upload!<br>";
}
}
$username = "program";
$password = "*******";
$database = "program_program";
$price = $_POST["price"];
$listing = $_POST["listing"];
$address = $_POST["address"];
$description = $_POST["description"];
mysql_connect($hostname,$username, $password) OR DIE (" ");
mysql_select_db($database);
$conn = @mysql_connect($location,$username,$password);
mysql_select_db($database,$conn) or die ("Could not open database");
$insert = "INSERT INTO db_x (listing,price,address,description,tn,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
VALUES ('".$listing."','".$price."','".$address."','".$description."','".$p0."','".$p1."','".$p2."','".$p3."','".$p4."','".$p5."','".$p6."','".$p7."','".$p8."','".$p9."','".$p10."','".$p11."')";
mysql_query($insert) or die ("An error has occured, and the data can not be added to the list, please contact Gabor. <Br />Error: " . mysql_error());
?>