require_once(“logging.php”);
require_once(“connect.php”);
$zz=mysql_query(“SELECT z FROM zaehler WHERE id LIKE ‘1’”);
while($ID=mysql_fetch_array($zz))
{
$zzz=”$ID[z]”;
}
$zzz++;
$queryz =”UPDATE zaehler SET z = $zzz WHERE id LIKE ‘1’”;
mysql_query($queryz)
or die (”
Error: Couldn’t increment z. – “.mysql_error());
require_once(“passwortgenerator.php”);//Externe Daten Einbinden
$i=0;
$mail_empfaenger=”info@tselepidis.de”;
$mail_absender = $_POST[‘Email’];
$betreff=”TIA Kerpen: Registration”;
$zwischenspeicherName=””;
$zwischenspeicherVorname=””;
$zwischenspeicherAnrede=””;
$zwischenspeicherEmail=””;
$zwischenspeicherPasswort=””;
$SR=0;
$text=””;
$Passwort=generatePW(10);//Variablen Deklaration
if(empty($_POST[‘Firma’]))
{$SR++;}
if(empty($_POST[‘Anrede’]))
{$SR++;}
if(empty($_POST[‘Vorname’]))
{$SR++;}
if(empty($_POST[‘Name’]))
{$SR++;}
if(empty($_POST[‘Tel’]))
{$SR++;}
if(empty($_POST[‘Email’]))
{$SR++;}
if(isset($_POST[‘Maschinenstillstand’]))
{$Maschinenstillstand=$_POST[‘Maschinenstillstand’];}
else
{$Maschinenstillstand=””;}
if(isset($_POST[‘ServiceProgrammierer’]))
{$ServiceProgrammierer=$_POST[‘ServiceProgrammierer’];}
else
{$ServiceProgrammierer=””;}
if(isset($_POST[‘ErwarteAnruf’]))
{$ErwarteAnruf=$_POST[‘ErwarteAnruf’];}
else
{$ErwarteAnruf=””;}
//Werte Übergabe der Textfelder
$Name=$_POST[‘Name’];
$zIP=mysql_query(“SELECT id FROM kunden WHERE name LIKE ‘$Name'”);
while($ID=mysql_fetch_array($zIP))
{
$zName=mysql_query(“SELECT name FROM kunden WHERE id LIKE ‘$ID[id]'”);
while($Name=mysql_fetch_array($zName))
{
$zwischenspeicherName=”$Name[name]”;
}
$zVorname=mysql_query(“SELECT vorname FROM kunden WHERE id LIKE ‘$ID[id]'”);
while($Vorname=mysql_fetch_array($zVorname))
{
$zwischenspeicherVorname=”$Vorname[vorname]”;
}
$zAnrede=mysql_query(“SELECT anrede FROM kunden WHERE id LIKE ‘$ID[id]'”);
while($Anrede=mysql_fetch_array($zAnrede))
{
$zwischenspeicherAnrede=”$Anrede[anrede]”;
}
$zEmail=mysql_query(“SELECT email FROM kunden WHERE id LIKE ‘$ID[id]'”);
while($Email=mysql_fetch_array($zEmail))
{
$zwischenspeicherEmail=”$Email[email]”;
}
$zPasswort=mysql_query(“SELECT password FROM kunden WHERE id LIKE ‘$ID[id]'”);
while($Passwort=mysql_fetch_array($zPasswort))
{
$zwischenspeicherPasswort=”$Passwort[password]”;
}
}//Werte aus DB Auslesen
if($SR!=0)
{
if(!empty($_POST[‘Absenden’]))
{
$Fehler=”
You didn’t enter all required information, please try again.“;
}
}
else
{
if(!empty($zwischenspeicherAnrede))
{$i++;}
else{}
if(!empty($zwischenspeicherVorname))
{$i++;}
else{}
if(!empty($zwischenspeicherName))
{$i++;}
else{}
//Überprüfen ob felder doppelt belegt sind
if($i==3)
{
$Fehler=”
You’re already registered, we’ll send you your password again.“;
mail($mail_absender, $betreff, $text . “\n\nYour password is: $Passwort”, “from:$mail_empfaenger”);
}
elseif (!filter_var($_POST[‘Email’], FILTER_VALIDATE_EMAIL))
{
$Fehler=”
Invalid Email address.“;
}
else
{
$query =
“INSERT INTO kunden (firma,anrede,vorname,name,abteilung,position,strasse,plz,ort,tel,fax,email,land,password) values
(
‘$_POST[Firma]’,
‘$_POST[Anrede]’,
‘$_POST[Vorname]’,
‘$_POST[Name]’,
‘$_POST[Abteilung]’,
‘$_POST[Position]’,
‘$_POST[Strasse]’,
‘$_POST[PLZ]’,
‘$_POST[Ort]’,
‘$_POST[Tel]’,
‘$_POST[Fax]’,
‘$_POST[Email]’,
‘$_POST[Land]’,
‘$Passwort’
)”;
mysql_query($query)
or die (”
Error: Couldn’t add account or Email address is already in use, please try using other data.“);
$Fehler=”
Registration was sucessful, you’ll receive an Email with your password soon.“;//Daten in DB Übertragen
$text = “Original message:\n”;
$text .= “> There was a registration from:\n”;
$text .= “> $_POST[Anrede] $_POST[Vorname] $_POST[Name]\n”;
$text .= “> From the company: $_POST[Firma].\n”;
$text .= “> He is $_POST[Position]\n”;
$text .= “> In the division $_POST[Abteilung].\n”;
$text .= “> He lives in $_POST[Strasse]\n”;
$text .= “> At $_POST[PLZ], $_POST[Ort], $_POST[Land].\n”;
$text .= “> He’s available\n”;
$text .= “> Via telephone at: $_POST[Tel],\n”;
$text .= “> Via fax at: $_POST[Fax]\n”;
$text .= “> And via Email at: $_POST[Email].\n\n”;
$text .= “> Further information:\n”;
$text .= “> $_POST[Bemerkung]\n”;
$text .= “> Expecting immediate call: $ErwarteAnruf\n”;
$text .= “> Needing service programmer: $ServiceProgrammierer\n”;
$text .= “> Having machine downtime: $Maschinenstillstand\n\n”;
mail($mail_empfaenger, $betreff, $text, “From: $mail_absender”);
mail($mail_absender, $betreff, $text . “Your password is: $Passwort”, “From: $mail_empfaenger”);
}
}
mysql_close($verbindung);
$i=0;
$SR=0;
?>