I have written a script which has an error. The first file gets uploaded and the second gets not ...
I don't see anything wrong with the code so I am requesting help ...
here is the script:
<?php
require("http://www.gtacenter.com/admin/config.php");
if ($submit) {
$extension = substr($image_name,strpos($image_name,"."));
if (is_uploaded_file($image) && ($extension == ".gif" or $extension == ".jpg" or $extension == ".png")) {
copy($image, "cars/image/$image_name");
echo "<img src=\"graphics/icons/lightbulb.gif\"> Bestand '$image_name' met de grootte: $image_size bytes is succesvol geupload!<br>";
$correct = "1";
}
else {
echo "<img src=\"graphics/icons/attention.gif\"> Er is een fout bij het uploaden van bestand: '$image_name'!<br>";
}
$extensiontwo = substr($zip_name,strpos($zip_name,"."));
if (is_uploaded_file($zip) && ($extensiontwo == ".zip" or $extensiontwo == ".rar" or $extensiontwo == ".tar")) {
copy($zip, "cars/zip/$zip_name");
echo "<img src=\"graphics/icons/lightbulb.gif\"> Bestand '$zip_name' met de grootte: $zip_size bytes is succesvol geupload!<br>";
$correcttwo = "1";
}else {
echo "<img src=\"graphics/icons/attention.gif\"> Er is een fout bij het uploaden van bestand: '$zip_name'!<br>";
}
if ($author <> "" && $carname <> "" && $correct == "1" && $correcttwo == "1") {
mysql_query("INSERT INTO cars (date, author, carname, img, url) VALUES (now(''), '$author', '$carname', '$image_name', '$zip_name')") or die("<img src=\"graphics/icons/attention.gif\"> MySQL error");
echo "<img src=\"graphics/icons/lightbulb.gif\"> user data has been inserted into database";
}else{
echo "<img src=\"graphics/icons/attention.gif\"> you made a mistake in the form or either your file extensions were inappropriate";
}
}else {
echo "We suggest you register before sending in cars.<br><form method=\"post\" enctype=\"multipart/form-data\">
name: <input type=\"text\" name=\"author\" class=\"button\" size=\"15\"><br>
car name: <input type=\"text\" name=\"carname\" class=\"button\" size=\"15\"><br>
image: <input type=\"file\" name=\"image\" class=\"button\"><br>
zip: <input type=\"file\" name=\"zip\" class=\"button\"><br>
<input type=\"submit\" value=\"submit my car\" name=\"submit\" class=\"button\">
</form>";
}
?>
Thanks in advance!!