<HTML>
<?PHP
/* Wichtige Variablen */
$hostname = 'localhost';
$password = 'pass';
$user = 'user';
/* Open the main Database. */
$conn_id = mysql_connect($hostname, $user, $password);
if (!$conn_id) {die('keine Verbindung möglich: ' . mysql_error());}
mysql_select_db("usrdb_maxxhdba_booking",$conn_id) or die("Select-Fehler: ".mysql_error());
/* The main screen. Printed when $state is empty. */
Function Main_Menu () {
echo "<body bgcolor=\"#FFFFFF\" topmargin=\"0\">
<table width=\"300\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../grafics/head.jpg\">
<tr>
<td width=\"60\"> </td>
<td width=\"215\" valign=\"middle\"><font size=\"-1\" face=\"Arial, Helvetica, sans-serif\"><strong>Booking-Admin</strong></font></td>
<td width=\"25\"> </td>
</tr>
</table><br><div align=\"center\"><b>Es gibt folgende Möglichkeiten:</b><br><br><br>";
echo "<table border=\" 0\" cellspacing=\" 0\" cellpadding=\" 0\" ><tr><td>";
echo "<FORM METHOD=\"POST\" ACTION=\"booking-admin.php\">";
echo "<INPUT TYPE=\"radio\" NAME=\"state\" VALUE=\"Create\"><B>DJ einfühgen<BR>";
echo "<INPUT CHECKED TYPE=\"radio\" NAME=\"state\" VALUE=\"Update\"><B>DJ ändern<BR>";
echo "<INPUT TYPE=\"radio\" NAME=\"state\" VALUE=\"Eraese\"><B>DJ löschen<P>";
echo "<INPUT TYPE=\"submit\" VALUE=\"Ausführen\"></div>";
echo "</td></tr></table>";
};
/* This function open a form to input the Information. */
Function Applicant_Form ($state, $uid){
$state = "Commit_Save";
echo "<body bgcolor=\"#FFFFFF\" topmargin=\"0\">
<table width=\"300\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"grafics/head.jpg\">
<tr>
<td width=\"60\"> </td>
<td width=\"215\" valign=\"middle\"><font size=\"-1\" face=\"Arial, Helvetica, sans-serif\"><strong>Onlie bewerben</strong></font></td>
<td width=\"25\"> </td>
</tr>
</table><br>
<table width=\"99%\" border=\"0\" align=\"center\">
<tr>
<td>
<div align=\"justify\" class=\"inhalt\">Die hier angegebenen Daten werden in unserer Datenbank gespeichert und ausschließlich für die Stellensuche in Ihrem Auftrag verwendet. Alle Dokumente, die Sie zum hochladen auswählen, bitte nur in folgenden Formaten: doc, pdf (Lebenslauf, Zeugnisse, etc.), jpg (Lichtbild)! Alle Daten werden nach diesem Vorgang oder bei nicht zu Stande kommen einer Vermittlung von uns gelöscht.</div>
</td>
</tr>
</table>
<form enctype='multipart/form-data' action='applicant.php' method='POST'>
<table border=\"0\" align=\"center\">
<tr>
<td><INPUT TYPE = \"hidden\" NAME = \"uid\" VALUE = \"$uid\"></td>
<td><INPUT TYPE = \"hidden\" NAME = \"state\" VALUE = \"$state\"></td>
</tr>
<tr>
<td class=\"inhalt\">Vorname: </td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"first_name\" VALUE = \"$first_name\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">Nachname: </td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"last_name\" VALUE = \"$last_name\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">Straße und Nr: </td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"street\" VALUE = \"$street\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">Plz und Ort:</td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"town\" VALUE = \"$town\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\"><br>Telefon: </td>
<td align=\"left\"><br><INPUT TYPE = \"TEXT\" NAME=\"phone\" VALUE = \"$phone\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">E-Mail: </td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"mail\" VALUE = \"$mail\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\"><br>Lebenslauf: </td>
<td align=\"left\"><br><INPUT TYPE = \"file\" NAME=\"personalrecord\" VALUE = \"$personalrecord\" size=\"25\"></td>
</tr>
<tr>
<td class=\"inhalt\"><br>Schulabschluß: </td>
<td align=\"left\"><br><INPUT TYPE = \"TEXT\" NAME=\"education\" VALUE = \"$education\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">Ausbildung: </td>
<td align=\"left\"><INPUT TYPE = \"TEXT\" NAME=\"vocational\" VALUE = \"$vocational\" size=\"46\"></td>
</tr>
<tr>
<td class=\"inhalt\">Abschlußurkunde: </td>
<td align=\"left\"><INPUT TYPE = \"file\" NAME=\"conclusiondocument\" VALUE = \"$conclusiondocument\" size=\"25\"></td>
</tr>
<tr>
<td class=\"inhalt\" valign=\"top\"><br><br>weiter Angaben: </td>
<td><br><textarea cols=\"35\" rows=\"7\" NAME=\"info\" VALUE = \"$info\">".$info."</textarea></td>
</tr>
<tr>
<td class=\"inhalt\"><br>Lichtbild: </td>
<td align=\"left\"><br><INPUT TYPE = \"file\" NAME=\"photo\" VALUE = \"$photo\" size=\"25\"></td>
</tr>
<tr>
<td class=\"inhalt\">aussagekräftiges Zeugnis: </td>
<td align=\"left\"><INPUT TYPE = \"file\" NAME=\"certification1\" VALUE = \"$certification1\" size=\"25\"></td>
</tr>
<tr>
<td class=\"inhalt\">aussagekräftiges Zeugnis: </td>
<td align=\"left\"><INPUT TYPE = \"file\" NAME=\"certification2\" VALUE = \"$certification2\" size=\"25\"></td>
</tr>
</table>
<p align=\"center\">
<br>
<INPUT TYPE=\"submit\" VALUE=\"Bewerbung senden\">
<br><br>
<span class=\"inhalt\"><font size=\"-2\">(Das Senden kann je nach Größe der angehangenen Dateien ein paar Minuten in Anspruch nehemen.)</font></span>
<br><br>
</p>";
};
/* Update & Erease the offers in the database. */
Function Update_Listing ($state) {
echo "<body bgcolor=\"#FFFFFF\" topmargin=\"0\">
<table width=\"300\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../grafics/head.jpg\">
<tr>
<td width=\"60\"> </td>
<td width=\"215\" valign=\"middle\"><font size=\"-1\" face=\"Arial, Helvetica, sans-serif\"><strong>Booking-Admin</strong></font></td>
<td width=\"25\"> </td>
</tr>
</table><br><br>";
if($state == "Update"){
$state = "Update_Now";
echo "<div align=\"center\" class=\"inhalt\"><br><b>DJ ändern:</b></div><br>";
}
else {
$state = "Eraese_Now";
echo "<div align=\"center\" class=\"inhalt\"><br><b>DJ löschen:</b></div><br>";
}
echo "<FORM METHOD=\"POST\" ACTION=\"booking-admin.php\">";
$result = mysql_query("SELECT * FROM content ORDER BY nickname, style ASC");
echo "<TABLE align=\"center\" BORDER = 1 CELLPADDING = 2 CELLSPACING = 3>";
$total_rows = mysql_num_rows($result); $counter = 0;
echo "<TR><TD class=\"inhalt\"><B>Auswahl</TD>
<TD class=\"inhalt\"><B>Nickname</TD>
<TD class=\"inhalt\"><B>Style</TD>
</TR>";
while($counter < $total_rows):
$uid = mysql_result($result,$counter,"uid");
echo "<TR><TD class=\"inhalt\"><div align=\"center\">";
echo "<INPUT TYPE=\"radio\" NAME=\"uid\" VALUE=\"$uid\">";
echo "</TD>";
echo "<TD WIDTH=\"160\" VALIGN=\"top\" class=\"inhalt\">";
echo mysql_result($result,$counter,"nickname")." ";
echo "</TD>";
echo "<TD class=\"inhalt\">";
echo mysql_result($result,$counter,"style");
echo "</TD></TR>";
$counter = $counter + 1;
endwhile;
echo "</TABLE><br>";
if($state == "Update_Now"){
echo "<div align=\"center\"><br><INPUT TYPE = \"hidden\" NAME = \"state\" VALUE = \"Update_Now\">\n";
echo "<INPUT TYPE=\"submit\" VALUE=\"DJ Bearbeiten\"></div>";
}
else {
echo "<div align=\"center\"><br><INPUT TYPE = \"hidden\" NAME = \"state\" VALUE = \"Eraese_Now\">\n";
echo "<INPUT TYPE=\"submit\" VALUE=\"DJ Löschen\"></div>";
}
};
/* Eraese One in database. */
Function Eraese_Now ($state, $uid){
$result = mysql_query("SELECT * FROM content WHERE uid = '".$uid."';");
while($row = mysql_fetch_assoc($result)){
unlink("../booking/".$row['thumbpic']);
unlink("../booking/".$row['pic']);
}
$result = mysql_query("DELETE FROM content WHERE uid = '".$uid."';");
$state = "";
Main_Menu();
};
/* Save updates to database. Call Print_Contact to list new statusrmation for updated contact entry. */
Function Commit_Update ($state, $uid, $nickname, $style, $thumbpic, $pic, $info, $references) {
$result = mysql_query("UPDATE content SET nickname = '$nickname', style = '$style', thumbpic = '$thumbpic', pic ='$pic', info ='$info', references ='$references' WHERE uid = '".$uid."';") OR die(mysql_error());
$state = "";
$status = "Datensatz erfolgreich geändert!";
Print_DJ($uid, $status);
};
/* This function displays the offers statusrmation in a form. */
Function Offers_Form ($state, $uid){
if($state == "Update_Now"){
$state = "Commit_Update";
$result = mysql_query("SELECT * FROM content WHERE uid = '".$uid."';");
$nickname = mysql_result($result,0,"nickname");
$style = mysql_result($result,0,"style");
$thumbpic = mysql_result($result,0,"thumbpic");
$pic = mysql_result($result,0,"pic");
$info = mysql_result($result,0,"info");
$references = mysql_result($result,0,"references");
}
else {
$state = "Commit_Save";
}
echo "<body bgcolor=\"#FFFFFF\" topmargin=\"0\">
<table width=\"300\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../grafics/head.jpg\">
<tr>
<td width=\"60\"> </td>
<td width=\"215\" valign=\"middle\"><font size=\"-1\" face=\"Arial, Helvetica, sans-serif\"><strong>Booking-Admin</strong></font></td>
<td width=\"25\"> </td>
</tr>
</table><br><br><div align=\"center\"><b>DJ bearbeiten:</b></div>
<FORM METHOD = \"POST\" ACTION=\"booking-admin.php\">
<table border=\"0\" align=\"center\">
<tr>
<td><INPUT TYPE = \"hidden\" NAME = \"uid\" VALUE = \"$uid\"></td>
<td><INPUT TYPE = \"hidden\" NAME = \"state\" VALUE = \"$state\"></td>
</tr>
<tr>
<td class=\"inhalt\">Nickname: </td>
<td align=\"center\"><INPUT TYPE = \"TEXT\" NAME=\"first_name\" VALUE = \"$nickname\" size=\"40\"></td>
</tr>
<tr>
<td class=\"inhalt\">Pic Auswahl: </td>
<td align=\"center\"><INPUT TYPE = \"TEXT\" NAME=\"street\" VALUE = \"$thumbpic\" size=\"40\"></td>
</tr>
<tr>
<td class=\"inhalt\">Pic Info: </td>
<td align=\"center\"><INPUT TYPE = \"TEXT\" NAME=\"last_name\" VALUE = \"$pic\" size=\"40\"></td>
</tr>
<tr>
<td class=\"inhalt\" valign=\"top\"><br><br>Info: </td>
<td><br><textarea cols=\"31\" rows=\"7\" NAME=\"info\" VALUE = \"$info\">".$info."</textarea></td>
</tr>
<tr>
<td class=\"inhalt\" valign=\"top\"><br><br>Referenzen: </td>
<td><br><textarea cols=\"31\" rows=\"7\" NAME=\"info\" VALUE = \"$references\">".$references."</textarea></td>
</tr>
</table>
<br>
<br>
<p align=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Speichern\"></p>";
};
/* Save new contact statusrmation to database. Call Print_Contact to display new contact entry. */
Function Commit_Save($nickname, $style, $thumbpic, $pic, $info, $references){
$result = mysql_query("INSERT INTO content (nickname, style, thumbpic, pic, info, references) VALUES ('$nickname', '$style', '$thumbpic', '$pic', '$info', '$references')");
$uid = mysql_insert_id();
$state = "";
$status = "Datensatz erfolgreich gespeichert!";
$tempname = $_FILES['personalrecord']['tmp_name'];
$name = $_FILES['personalrecord']['name'];
$pfad_info_1 = pathinfo($name);
copy("$tempname", "applicant/$uid-$last_name-personalrecord.".$pfad_info_1["extension"]);
$ext_1 = $pfad_info_1["extension"];
$tempname = $_FILES['conclusiondocument']['tmp_name'];
$name = $_FILES['conclusiondocument']['name'];
$tempname = $_FILES['conclusiondocument']['tmp_name'];
$pfad_info_2 = pathinfo($name);
copy("$tempname", "applicant/$uid-$last_name-conclusiondocument.".$pfad_info_2["extension"]);
$ext_2 = $pfad_info_2["extension"];
$result = mysql_query("UPDATE gzg_applicant SET ext_1 = '$ext_1', ext_2 = '$ext_2', ext_3 = '$ext_3', ext_4 = '$ext_4', ext_5 ='$ext_5' WHERE uid = '".$uid."';") OR die(mysql_error());
Print_DJ($uid, $status);
};
/* Print address and comments for a contact. Also give option to update. */
Function Print_DJ ($uid, $status) {
$result = mysql_query("SELECT * FROM content WHERE uid = '".$uid."';");
while($row = mysql_fetch_assoc($result)){
echo "<body bgcolor=\"#FFFFFF\" topmargin=\"0\">
<table width=\"300\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../grafics/head.jpg\">
<tr>
<td width=\"60\"> </td>
<td width=\"215\" valign=\"middle\"><font size=\"-1\" face=\"Arial, Helvetica, sans-serif\"><strong>Bokking-Admin</strong></font></td>
<td width=\"25\"> </td>
</tr>
</table><br><br><div align=\"center\" class=\"inhalt\"><b>". $status ."</b></div><br><br>";
$status = "";
echo "<TABLE align=\"center\" BORDER = 0 CELLPADDING = 2 CELLSPACING = 2>";
echo "<TR><TD VALIGN=\"top\" class=\"inhalt\">";
echo "DJ: ";
echo "</TD>";
echo "<TD class=\"inhalt\">";
echo "<b>Nickname:</b> ". $row['nickname'];
echo "<br><b>Style:</b> ". $row['style'];
echo "<br><b>Info:</b> ". $row['Info'];
echo "<br><b>Referenzen:</b> ". $row['references'];
echo "<br><br><br></TD></TR>";
echo "</TABLE>";
echo "<table border=\"0\" align=\"center\" cellspacing=\"7\"><tr>";
if($row['ext_1'] == ""){} else {
echo "<td><a href=\"http://www.maxx-hell.de/booking/". $row['thumbpic'] ."\" target = \"_blank\">Pic Auswahl</a></td>";
}
if($row['ext_2'] == ""){} else {
echo "<td><a href=\"http://www.maxx-hell.de/booking/". $row['pic'] ."\" target = \"_blank\">Pic Info</a></td>";
}
echo "</tr></table>";
}
echo "<br><br>";
echo "<FORM METHOD = \"POST\" ACTION=\"booking-admin.php\">";
echo "<INPUT TYPE = \"HIDDEN\" NAME = \"state\" VALUE = \"\">\n";
echo "<CENTER><INPUT TYPE=\"submit\" VALUE=\"Hauptmenü\">";
};
/* The main loop. Call functions based on the value of $state, which gets set via a hidden INPUT TYPE. */
switch($state):
case "";
Main_Menu();
break;
case "Update";
Update_Listing ($state, $uid);
break;
case "Eraese";
Update_Listing ($state, $uid);
break;
case "Update_Now";
Offers_Form ($state, $uid);
break;
case "Eraese_Now";
Eraese_Now ($state, $uid);
break;
case "Commit_Update";
Commit_Update ($state, $uid, $nickname, $style, $thumbpic, $pic, $info, $references);
break;
case "Commit_Save";
Commit_Save ($state, $nickname, $style, $thumbpic, $pic, $info, $references);
break;
case "Print_DJ";
Print_DJ ($uid, $status);
endswitch;
?>