Timur: CODE - TEXTAREA TEIL 3

Beitrag lesen

skript1.php:

<?PHP
// VERBINDUNG

//UEBERSCHRIFT (SONDERZEICHEN)
$nhead1 = ereg_replace("'","&#39;",$_POST['ueberschrift']);
$nhead1 = ereg_replace("\"","&#34;",$_POST['ueberschrift']);

//NACHRICHT (SONDERZEICHEN)
$nnews1 = mysql_real_escape_string(str_replace("\r\n"," ",$_POST['nachricht']));
//$nnews2 = ereg_replace("\n", "<br />", $_POST['nachricht']);
$nnews2 = nl2br($_POST['nachricht']);

// DATUM
$date = mysql_real_escape_string($_POST['datum']);

// UEBERSCHRIFT
$headline = $nhead1;

// PFAD BILD 1
$pfad1 = $_FILES["bild1"]["name"];

// KURZE NACHRICHTENBESCHREIBUNG
$smalltext = substr($nnews1, 0, 180);

// NACHRICHT
$news = $nnews2;

// ARCHIVNUMMER
$archivenummber = mysql_real_escape_string($_POST['archivnummer']);

// PFAD BILD 2
$pfad2 = $_FILES["bild2"]["name"];

// PFAD BILD 3
$pfad3 = $_FILES["bild3"]["name"];

// PFAD BILD 4
$pfad4 = $_FILES["bild4"]["name"];

// PFAD BILD 5
$pfad5 = $_FILES["bild5"]["name"];

// NACHRICHT EINFUEGEN
mysql_query(
"INSERT INTO `haber` SET
tarih = '$date',
baslik = '$headline',
IMG1 = '$pfad1',
betimleme = '$smalltext ...',
haber = '$news',
haberarsivno ='$archivenummber',
IMG2 = '$pfad2',
IMG3 = '$pfad3',
IMG4 = '$pfad4',
IMG5 = '$pfad5'"
);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?PHP include "../tr/siteheader.php"; ?>
</head>
<body>
<form action="skript1.php" method="post" enctype="multipart/form-data">
	<div id="holepage">
		<div id="header">
			<?PHP include "../tr/header.php"; ?>
		</div>
		<div id="nav">
			<?PHP include "../tr/links.php"; ?>
		</div>
		<div id="content">
			<div class="style_1">Neue Nachricht</div>
			<div class="style_2" style="margin-top:6px;" align="center">
			<table align="center" cellspacing="0" cellpadding="0">
			<tr>
			<td colspan="3" align="center" style="color:green">Nachricht ERFOLGREICH übermittelt</td>
			</tr>
			<tr>
			<td colspan="3" align="center">&nbsp;</td>
			</tr>
			<?php
			echo "<tr>";
			if ($_FILES["bild1"]["error"] > 0)
			{
				echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:blue;\">Bild 1:</td>";
				echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
				echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:blue;\"><b>nicht ausgewählt</b></td>";
			}
			else
			{
				if (file_exists("../../fotograflarI/" . $_FILES["bild1"]["name"]))
				{
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:red;\">Bild 1:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:red;\"><b>".$_FILES["bild1"]["name"]."</b> existiert im Ordner <b>fotograflarI</b></td>";
				}
				else
				{
					move_uploaded_file($_FILES["bild1"]["tmp_name"], "../../fotograflarI/" . $_FILES["bild1"]["name"]);
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:green;\">Bild 1:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:green;\"><b>".$_FILES["bild1"]["name"]."</b> gespeichert im Ordner <b>fotograflarI</b></td>";
				}
			}
			echo "</tr>";
			echo "<tr>";
			if ($_FILES["bild2"]["error"] > 0)
			{
				echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:blue;\">Bild 2:</td>";
				echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
				echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:blue;\"><b>nicht ausgewählt</b></td>";
			}
			else
			{
				if (file_exists("../../fotograflarI/" . $_FILES["bild2"]["name"]))
				{
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:red;\">Bild 2:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:red;\"><b>".$_FILES["bild2"]["name"]."</b> existiert im Ordner <b>fotograflarI</b></td>";
				}
				else
				{
					move_uploaded_file($_FILES["bild2"]["tmp_name"], "../../fotograflarI/" . $_FILES["bild2"]["name"]);
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:green;\">Bild 2:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:green;\"><b>".$_FILES["bild2"]["name"]."</b> gespeichert im Ordner <b>fotograflarI</b></td>";
				}
			}
			echo "</tr>";
			echo "<tr>";
			if ($_FILES["bild3"]["error"] > 0)
			{
				echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:blue;\">Bild 3:</td>";
				echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
				echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:blue;\"><b>nicht ausgewählt</b></td>";
			}
			else
			{
				if (file_exists("../../fotograflarI/" . $_FILES["bild3"]["name"]))
				{
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:red;\">Bild 3:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:red;\"><b>".$_FILES["bild3"]["name"]."</b> existiert im Ordner <b>fotograflarI</b></td>";
				}
				else
				{
					move_uploaded_file($_FILES["bild3"]["tmp_name"], "../../fotograflarI/" . $_FILES["bild3"]["name"]);
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:green;\">Bild 3:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:green;\"><b>".$_FILES["bild3"]["name"]."</b> gespeichert im Ordner <b>fotograflarI</b></td>";
				}
			}
			echo "</tr>";
			echo "<tr>";
			if ($_FILES["bild4"]["error"] > 0)
			{
				echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:blue;\">Bild 4:</td>";
				echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
				echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:blue;\"><b>nicht ausgewählt</b></td>";
			}
			else
			{
				if (file_exists("../../fotograflarI/" . $_FILES["bild4"]["name"]))
				{
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:red;\">Bild 4:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:red;\"><b>".$_FILES["bild4"]["name"]."</b> existiert im Ordner <b>fotograflarI</b></td>";
				}
				else
				{
					move_uploaded_file($_FILES["bild4"]["tmp_name"], "../../fotograflarI/" . $_FILES["bild4"]["name"]);
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:green;\">Bild 4:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:green;\"><b>".$_FILES["bild4"]["name"]."</b> gespeichert im Ordner <b>fotograflarI</b></td>";
				}
			}
			echo "</tr>";
			echo "<tr>";
			if ($_FILES["bild5"]["error"] > 0)
			{
				echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:blue;\">Bild 5:</td>";
				echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
				echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:blue;\"><b>nicht ausgewählt</b></td>";
			}
			else
			{
				if (file_exists("../../fotograflarI/" . $_FILES["bild5"]["name"]))
				{
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:red;\">Bild 5:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:red;\"><b>".$_FILES["bild5"]["name"]."</b> existiert im Ordner <b>fotograflarI</b></td>";
				}
				else
				{
					move_uploaded_file($_FILES["bild5"]["tmp_name"], "../../fotograflarI/" . $_FILES["bild5"]["name"]);
					echo "<td width=\"250px\" height=\"24px\" align=\"right\" valign=\"middle\" style=\"color:green;\">Bild 5:</td>";
					echo "<td width=\"20px\" height=\"24px\" align=\"center\">&nbsp;</td>";
					echo "<td width=\"250px\" height=\"24px\" align=\"left\" valign=\"middle\" style=\"color:green;\"><b>".$_FILES["bild5"]["name"]."</b> gespeichert im Ordner <b>fotograflarI</b></td>";
				}
			}
			echo "</tr>";
			?>
			</table>
			</div>
		</div>
	</div>
</form>
</body>
</html>