Nieuw lid |
|
Wat is hier fout aan? Ik kan hem niet vinden
<?php
mysql_connect('localhost','root','jahoor');
mysql_select_db('autos') or die (mysql_error());
if(isset($_POST['verzenden']))
{
$extensions = array();
$extensions['ext'][] = "image/gif";
$extensions['ext'][] = "image/jpg";
$extensions['ext'][] = "image/jpeg";
$extensions['ext'][] = "image/pjpeg";
$extensions['ext'][] = "image/png";
$extensions['ext'][] = "image/bmp";
$extensions['ext'][] = "image/x-png";
if(in_array($_FILES['file']['type'], $extensions['ext'])) {
if($_FILES['file']['size'] > 1048576) {
echo "Uw bestand is meer als 1 MB (1024 KB)!<br>Klik <a href='javascript:history.back(1)'>hier</a> om terug te gaan!";
} else {
if($_FILES['file']['type'] == "image/gif") {
$ext = ".gif";
} elseif($_FILES['file']['type'] == "image/jpg") {
$ext = ".jpg";
} elseif($_FILES['file']['type'] == "image/jpeg") {
$ext = ".jpg";
} elseif($_FILES['file']['type'] == "image/pjpeg") {
$ext = ".jpg";
} elseif($_FILES['file']['type'] == "image/bmp") {
$ext = ".bmp";
} elseif($_FILES['file']['type'] == "image/png") {
$ext = ".png";
} elseif($_FILES['file']['type'] == "image/x-png") {
$ext = ".png";
}
if(file_exists($mapnaam.$_SERVER['REMOTE_ADDR'].$ext)) {
unlink($mapnaam.$_SERVER['REMOTE_ADDR'].$ext);
}
if(is_uploaded_file($_FILES['file']['tmp_name'])) {
move_uploaded_file($_FILES['file']['tmp_name'], $mapnaam.$_FILES['file']['name']);
echo "Uw bestand is succesvol geupload!<br>De URL van uw bestand is: '".$url.$mapnaam.$_FILES['file']['name']."'<br><br>Klik <a href='".$url.$mapnaam.$_FILES['file']['name']."' target='_blank'>hier</a> voor een voorbeeld.";
} else {
echo "Er is iets fout gegaan tijdens het uploaden!<br>Probeert u het nogmaals..<br>Klik <a href='javascript:history.back(1)'>hier</a> om terug te gaan!";
$sNaam = addslashes($_POST['naam']);
$sInfo = addslashes($_POST['info']);
$iFoto = $url.$mapnaam.$_FILES['file']['name'];
mysql_query("INSERT INTO `autos` (naam, info, foto) VALUES ('".$sNaam."', '".$sInfo."', '".$iFoto."')") or die (mysql_error());
echo 'Je gegevens zijn succesvol in de database geplaatst';
}
else
{
?>
<form action=" <?=$_SERVER['PHP_SELF']?> " method="POST">
Naam: <input type="text" name="naam"><br /> <br />
Info: <textarea name="info" rows="8" cols="20" ></textarea><br /> <br />
Foto: <input type="file" name="foto"><br /> <br />
<input type="submit" name="verzenden" value="verzenden">
</form>
<?
}
?>
<?php if(isset($_POST['verzenden'])) { $extensions['ext'][] = "image/gif"; $extensions['ext'][] = "image/jpg"; $extensions['ext'][] = "image/jpeg"; $extensions['ext'][] = "image/pjpeg"; $extensions['ext'][] = "image/png"; $extensions['ext'][] = "image/bmp"; $extensions['ext'][] = "image/x-png"; if(in_array($_FILES['file']['type'], $extensions['ext'])) { if($_FILES['file']['size'] > 1048576) { echo "Uw bestand is meer als 1 MB (1024 KB)!<br>Klik <a href='javascript:history.back(1)'>hier</a> om terug te gaan!"; } else { if($_FILES['file']['type'] == "image/gif") { $ext = ".gif"; } elseif($_FILES['file']['type'] == "image/jpg") { $ext = ".jpg"; } elseif($_FILES['file']['type'] == "image/jpeg") { $ext = ".jpg"; } elseif($_FILES['file']['type'] == "image/pjpeg") { $ext = ".jpg"; } elseif($_FILES['file']['type'] == "image/bmp") { $ext = ".bmp"; } elseif($_FILES['file']['type'] == "image/png") { $ext = ".png"; } elseif($_FILES['file']['type'] == "image/x-png") { $ext = ".png"; } if(file_exists($mapnaam.$_SERVER['REMOTE_ADDR'].$ext)) { unlink($mapnaam.$_SERVER['REMOTE_ADDR'].$ext); } echo "Uw bestand is succesvol geupload!<br>De URL van uw bestand is: '".$url.$mapnaam.$_FILES['file']['name']."'<br><br>Klik <a href='".$url.$mapnaam.$_FILES['file']['name']."' target='_blank'>hier</a> voor een voorbeeld."; } else { echo "Er is iets fout gegaan tijdens het uploaden!<br>Probeert u het nogmaals..<br>Klik <a href='javascript:history.back(1)'>hier</a> om terug te gaan!"; $iFoto = $url.$mapnaam.$_FILES['file']['name']; mysql_query("INSERT INTO `autos` (naam, info, foto) VALUES ('".$sNaam."', '".$sInfo."', '".$iFoto."')") or die (mysql_error()); echo 'Je gegevens zijn succesvol in de database geplaatst'; } else { ?> <form action=" <?=$_SERVER['PHP_SELF']?> " method="POST"> Naam: <input type="text" name="naam"><br /> <br /> Info: <textarea name="info" rows="8" cols="20" ></textarea><br /> <br /> Foto: <input type="file" name="foto"><br /> <br /> <input type="submit" name="verzenden" value="verzenden"> </form> <? } ?>
Citaat: Parse error: parse error in f:phpdevwwwtesttoevoegen.php on line 51
Line 51:
49 echo 'Je gegevens zijn succesvol in de database geplaatst';
50 }
51 else
52 {
Bvb bedankt
|