<?php
if ($_POST) {
define("IN_MYBB", 1);
include ('./global.php');
require_once MYBB_ROOT."inc/datahandlers/post.php";
require_once MYBB_ROOT."inc/functions_upload.php";
$attachedfile = upload_attachment($_FILES['attachment']);
if($attachedfile['error'])
{
eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
$mybb->input['action'] = "newthread";
}
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";
//$posthandler->admin_override = true; // Optional, ich habe es lieber drin ^^
$uid = 2;
$username = 'Testuser';
if ($mybb->input['absu'] == "Zu vermitteln...")
{
$fid = 2; // Forum in das der Thread gepostet werden soll
} else {
$fid = 3;
}
$message = "Zu vermitteln ist ".$mybb->input['NameH'].
", ".$mybb->input['mw'].
", ".$mybb->input['alter'].
", mit der Haarart: ".$mybb->input['haar'].
".\n\n".$mybb->input['beschreibung'].
"\n\nKontakt bei:\n\n".$mybb->input['NameP'].
"\n".$mybb->input['PLZ']." ".$mybb->input['Ort'].
"\nTel: ".$mybb->input['Tel'].
"\nEmail: ".$mybb->input['Email'].
"\n".$mybb->input['Domain'];
$subject = $mybb->input['kurzb'];
$new_thread = array(
"fid" => $fid,
"subject" => $subject,
"uid" => $uid,
"username" => $username,
"message" => $message,
"ipaddress" => get_ip(),
);
$posthandler->set_data($new_thread);
$validate = $posthandler->validate_thread();
if ($validate)
{
$tinfo = $posthandler->insert_thread();
$tid = $tinfo[tid];
redirect("Danke.html");
}
else
{
error("Es ist ein Fehler während der Threaderstellung aufgetreten");
}
}
?>
<html>
<head>
<title>Neuer Eintrag</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<center>
<form action="<?php print $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<table border="0">
<tr>
<td>Abgeben/Suchen:</td>
<td>
<select name="absu" size="1">
<option>Zu vermitteln...</option><option>Ich suche...</option>
</select>
</td>
</tr>
<tr>
<td>Name des Hundes:</td>
<td><input name="NameH" type="text" size="30"></td>
</tr>
<tr>
<td>Haarart</td>
<td>
<select name="haar" size="1">
<option>Rauhaar</option>
<option>Langhaar</option>
<option>Kurzhaar</option>
<option>Dackelmix</option>
<option>Andere Rasse</option>
</select>
</td>
</tr>
<tr>
<td>Hündin / Rüde</td>
<td>
<select name="mw" size="1">
<option>Hündin</option><option>Rüde</option>
</select>
</td>
</tr>
<tr>
<td>Alter des Tieres:</td>
<td><input name="alter" type="text" size="30"></td>
</tr>
<tr>
<td>Überschrift Kurzbeschreibung:</td>
<td><input name="kurzb" type="text" size="30"></td>
</tr>
<tr>
<td>Beschreibung:</td>
<td><textarea name="beschreibung" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td>Vorname - Nachname / Organisation:</td>
<td><input name="NameP" type="text" size="30"></td>
</tr>
<tr>
<td>PLZ:</td>
<td><input name="PLZ" type="text" size="30"></td>
</tr>
<tr>
<td>Ort:</td>
<td><input name="Ort" type="text" size="30"></td>
</tr>
<tr>
<td>Telefon mit Vorwahl:</td>
<td><input name="Tel" type="text" size="30"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="Email" type="text" size="30"></td>
</tr>
<tr>
<td>Domain:</td>
<td><input name="Domain" type="text" size="30"></td>
</tr>
<tr>
<td>Bild</td>
<td><input name="attachment" size="30" type="file"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value=" Absenden "></td>
</tr>
</table>
</form>
</center>
</body>
</html>