Hallo an alle,
Ich habe ein kleines php Problem. Bisher habe ich mir alles selbst beigebracht und / oder ergoogelt, jetzt komme ich aber leider definitiv nicht mehr weiter ohne Unterstützung
Ich habe ein Mail Kontaktformular erstellt (ohne MySQL Anbindung) und möchte das zumindest das Feld "E-Mail" auf Inhalt überprüft wird. Wäre super nett wenn jemand mir einen entsprechenden Code einbauen würde im nachfolgenden Quellcode.
Danke schonmal vorab für eure Bemühungen.
Quellcode:
Datei 1:
Datei 2:
Ich habe ein kleines php Problem. Bisher habe ich mir alles selbst beigebracht und / oder ergoogelt, jetzt komme ich aber leider definitiv nicht mehr weiter ohne Unterstützung
Ich habe ein Mail Kontaktformular erstellt (ohne MySQL Anbindung) und möchte das zumindest das Feld "E-Mail" auf Inhalt überprüft wird. Wäre super nett wenn jemand mir einen entsprechenden Code einbauen würde im nachfolgenden Quellcode.
Danke schonmal vorab für eure Bemühungen.
Quellcode:
Datei 1:
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="menu.css">
<title>Krüger Internet und Grafik Design</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
if (window.mm_menu_0726234452_0) return;
window.mm_menu_0726234452_0 = new Menu("root",140,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#FFEC00","#990000","center","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0726234452_0.addMenuItem("Webdesignpakete","location='/Webdesignpakete.php'");
mm_menu_0726234452_0.addMenuItem("Zusatzleistungen","location='/Zusatzleistungen.php'");
mm_menu_0726234452_0.addMenuItem("Banner","location='/Banner.php'");
mm_menu_0726234452_0.hideOnMouseOut=true;
mm_menu_0726234452_0.bgColor='#FFFFCC';
mm_menu_0726234452_0.menuBorder=1;
mm_menu_0726234452_0.menuLiteBgColor='#FFFFFF';
mm_menu_0726234452_0.menuBorderBgColor='#990000';
window.mm_menu_0726235225_0 = new Menu("root",140,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#FFEC00","#990000","center","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0726235225_0.addMenuItem("Logodesign","location='Logodesign.php'");
mm_menu_0726235225_0.addMenuItem("Flyer","location='Flayer.php'");
mm_menu_0726235225_0.addMenuItem("Geschäftsausstattung","location='Geschaeftsausstattung.php'");
mm_menu_0726235225_0.addMenuItem("Bildbearbeitung","location='Bildbearbeitung.php'");
mm_menu_0726235225_0.hideOnMouseOut=true;
mm_menu_0726235225_0.bgColor='#555555';
mm_menu_0726235225_0.menuBorder=1;
mm_menu_0726235225_0.menuLiteBgColor='#FFFFFF';
mm_menu_0726235225_0.menuBorderBgColor='#990000';
window.mm_menu_0726235703_0 = new Menu("root",140,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#FFEC00","#990000","center","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0726235703_0.addMenuItem("Panorama Bilder","location='Panoramabilder.php'");
mm_menu_0726235703_0.addMenuItem("Panorama Slideshow","location='Panoramaslideshow.php'");
mm_menu_0726235703_0.hideOnMouseOut=true;
mm_menu_0726235703_0.bgColor='#555555';
mm_menu_0726235703_0.menuBorder=1;
mm_menu_0726235703_0.menuLiteBgColor='#FFFFFF';
mm_menu_0726235703_0.menuBorderBgColor='#990000';
window.mm_menu_0726235826_0 = new Menu("root",140,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#FFEC00","#990000","center","middle",3,0,1000,-5,7,true,true,true,0,false,true);
mm_menu_0726235826_0.addMenuItem("Referenzen","location='Referenzen.php'");
mm_menu_0726235826_0.addMenuItem("Kontakt","location='Kontakt.php'");
mm_menu_0726235826_0.addMenuItem("AGB","location='AGB.php'");
mm_menu_0726235826_0.addMenuItem("Impressum","location='Impressum.php'");
mm_menu_0726235826_0.hideOnMouseOut=true;
mm_menu_0726235826_0.bgColor='#555555';
mm_menu_0726235826_0.menuBorder=1;
mm_menu_0726235826_0.menuLiteBgColor='#FFFFFF';
mm_menu_0726235826_0.menuBorderBgColor='#990000';
mm_menu_0726235826_0.writeMenus();
}
function MM_reloadPage(init) {
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body background="/Bilder/Absoluter%20Hintergrund%20gro%DF.jpg" leftmargin="0,0" topmargin="20" marginwidth="0.0" marginheight="20" onLoad="MM_preloadImages('Bilder/Rollover%20Link%20Home.jpg','Bilder/Rollover%20Link%20Internetdesign.jpg','Bilder/Rollover%20Link%20Grafikdesign.jpg','Bilder/Rollover%20Link%20Panorama.jpg','Bilder/Rollover%20Link%20Service.jpg')">
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="800" height="848" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" background="/Bilder/Absoluter%20Hintergrund.jpg" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td height="20" colspan="3" valign="top"><img src="/Bilder/Leiste%20oben.jpg" width="800" height="20" /></td>
</tr>
<tr>
<td width="20" rowspan="4" valign="top" nowrap background="/Bilder/Leiste Links.jpg"><!--DWLayoutEmptyCell--> </td>
<td width="760" height="147" valign="top" nowrap="nowrap" bordercolor="#000000" background="/Bilder/Header klein.jpg">
<div align="left"></div></td>
<td width="20" rowspan="4" valign="top" nowrap background="/Bilder/Leiste Links.jpg"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="25" valign="middle" background="/Bilder/Hintergrund Links.jpg" bgcolor="#AA0000"><div align="center"><a href="Home.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Bilder/Rollover%20Link%20Home.jpg',1)"><img src="Bilder/Link Home.jpg" name="Home" width="150" height="25" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Internetdesign','','Bilder/Rollover%20Link%20Internetdesign.jpg',1);MM_showMenu(window.mm_menu_0726234452_0,0,25,null,'Internetdesign')"><img src="Bilder/Link Internetdesign.jpg" name="Internetdesign" width="150" height="25" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Grafikdesign','','Bilder/Rollover%20Link%20Grafikdesign.jpg',1);MM_showMenu(window.mm_menu_0726235225_0,0,25,null,'Grafikdesign')"><img src="Bilder/Link Grafikdesign.jpg" name="Grafikdesign" width="150" height="25" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Panorama','','Bilder/Rollover%20Link%20Panorama.jpg',1);MM_showMenu(window.mm_menu_0726235703_0,0,25,null,'Panorama')"><img src="Bilder/Link Panorama.jpg" name="Panorama" width="150" height="25" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Service','','Bilder/Rollover%20Link%20Service.jpg',1);MM_showMenu(window.mm_menu_0726235826_0,0,25,null,'Service')"><img src="Bilder/Link Service.jpg" name="Service" width="150" height="25" border="0"></a></div></td>
</tr>
<tr>
<td height="789" valign="top" background="/Bilder/Hintergrund Bildbearbeitung.jpg">
<blockquote>
<p><br>
<font size="6">Kontakt<br>
<br>
<font size="3">Schreiben Sie uns eine E-Mail und wir werden Ihnen schnellst
möglich Ihre Fragen beantworten oder uns mit Ihnen telefonisch
in Kontakt setzen.</font></font></p>
<p> <form method="post" action="sendeail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<p>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
*Vorname & Name: <br />
<input type="text" name="name" size="35" />
<br />
*Telefon: <br>
<input type="text" name="tele" size="35" />
<br>
*E-mail: <br />
<input type="text" name="email" size="35" />
<br />
*Ihre Firma:<br />
<input type="text" name="firma" size="35" />
<br />
<br />
*Betreff:<br />
<select name="attn" size="1">
<option value=" Anfrage ">Anfrage </option>
<option value=" Kundensupport ">Kundensupport </option>
<option value=" Laufender Auftrag ">Laufender Auftrag </option>
<option value=" Angebote ">Angebote </option>
</select>
<br />
<br />
Ihre Nachricht: <br />
<textarea name="notes" rows="10" cols="50"></textarea>
<br>
* sind Pflichtfelder<br />
<input type="submit" value="Senden" />
</p>
</form>
<font size="3"><em><br />
</em></font>
<p></p>
</blockquote></td>
</tr>
<tr>
<td height="19" valign="top" background="/Bilder/Leiste Unten.jpg"><div align="center">|
<a href="/Kontakt.php">Kontakt</a> | © 2007 Krüger-Design |
<a href="/Impressum.php">Impressum</a> | </div></td>
</tr>
<tr>
<td height="20" colspan="3" valign="top"><img src="Bilder/Leiste%20unten%202.jpg" width="800" height="20" /></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
</tr>
</table>
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
new menu (MENU_ITEMS, MENU_POS);
</script>
</body>
</html>
Datei 2:
PHP:
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sendemail Script</title>
</head>
<body background="/Bilder/Absoluter%20Hintergrund%20gro%DF.jpg">
<table width="760" height="559" border="3" align="center" cellpadding="0" cellspacing="0" bordercolor="#B40100">
<tr>
<td height="116"><img src="/Bilder/Header%20gesendete%20Nachricht.jpg" width="760" height="150" /></td>
</tr>
<tr>
<td height="401" align="center" valign="top">
<div align="center"><br />
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(empty($name) || empty($email) || empty($notes )) {
echo "<h2></h2>\n";
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " Betreff: $attn \n
Von: $name ($email)\n
Firma: $firma \n
Telefon: $tele \n
Nachricht:
$notes \n
";
$from = "From: $email\r\n";
mail("info@krueger-internetdesign.de", $subject, $message, $from);
?>
</div>
<p align="center"> <strong>Datum:</strong> <script type='text/javascript'>
<!--
var curDateTime = new Date();
document.write(curDateTime.toLocaleString());
//-->
</script>
<br /><center>
<br />
Danke für Ihre Nachricht
<?php echo $name ?>
(
<?php echo $email ?>
) <br />
Wir werden Ihnen so schnell wie möglich eine Antwort zukommen lassen.<br />
Mit freundlichem Gruß,<br />
<br />
Ihr Krüger Design Team<br />
<br />
<strong>Firma:</strong>
<?php echo $firma ?>
<strong><br />
Betreff:</strong>
<?php echo $attn ?>
<br />
<br />
<strong>Nachricht:</strong><br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<br />
<br />
<a href="Home.php"> Zurück zur Startseite </a><br />
<br />
<br />
</center>
</p>
</td>
</tr>
</table>
</body>
</html>