tsbmusic
"myXOOPs"-Könner
Gepostet am:05.05.2010 14:14
#4
der Dateiname!
Aw:: Dateiupload in eigenem Modul?
05.05.2010 14:14 Zu der Frage was eingetragen werden soll:der Dateiname!
if($_POST['titel'] != "Gib einen Titel ein..."){
$xoopsTpl->assign('post_titel', $_POST['titel']);
}
redirect_header('index.php', 0, $message);
<?php
require('../../mainfile.php');
xoops_load('XoopsFormEditor');
$editor_configs=array();
$editor_configs['value'] = $_POST['post'];
$editor_configs['rows'] = 22;
$editor_configs['cols'] = 80;
$editor_configs['width'] = '100%';
$editor_configs['height'] = '300px';
$editor_configs['name'] = 'post';
$editor_configs['editor'] = ''; // Leer oder Name des Editors
$editor = new XoopsFormEditor('Caption', $editor_configs['name'], $editor_configs,'dhtmltextarea');
$xoopsOption['template_main'] = 'statusmeldung_neu.html';
require(XOOPS_ROOT_PATH.'/header.php');
$xoBreadcrumbs[] = array('title' => 'Home', 'link' => XOOPS_URL);
$xoBreadcrumbs[] = array('title' => 'Statusmeldung', 'link' => XOOPS_URL . '/modules/statusmeldung/');
$xoBreadcrumbs[] = array('title' => 'Neue Statusmeldung');
$xoopsTpl->assign('xoBreadcrumbs', $xoBreadcrumbs);
if($_POST['titel'] != "Gib einen Titel ein..."){
$xoopsTpl->assign('post_titel', $_POST['titel']);
}
$xoopsTpl->assign('htmlTextArea' , $editor->render());
if (isset($_POST['submit'])){
if(empty($_POST['titel']) || empty($_POST['post'])){
$xoopsTpl->assign('errorMsg', 'Alle Felder müssen ausgefüllt werden!');
}else {
$myts = myTextSanitizer::getInstance();
$poster_id=$xoopsUser->getVar('uid');
$poster_name=$xoopsUser->getVar('uname');
$titel=$myts->addslashes($_POST['titel']);
$post=$myts->addslashes($_POST['post']);
if(isset($_FILES['file']['tmp_name'])){
move_uploaded_file($_FILES['file']['tmp_name'], XOOPS_URL . "uploads/".$_FILES['file']['name']);
$attachment = $_FILES['file']['name'];
}
$query = "Insert into ".$xoopsDB->prefix("statusmeldung_database")." (poster_id, poster_name, titel, post, attachment) values ('$poster_id', '$poster_name', '$titel', '$post', '$attachment' )";
$res=$xoopsDB->query($query);
if(!$res) {
$message = "Fehler: <br />" . $query;
redirect_header('index.php', 0, $message);
} else {
$message = "Nachricht erfolgreich abgesendet";
redirect_header('index.php', 0, $message);
}
}
}
require(XOOPS_ROOT_PATH.'/footer.php');
?>
Forum | Thema | Antworten | Views | Letzter Beitrag |
---|---|---|---|---|
OffOffTopic | [Wichtig] Übernahme myXOOPS | 0 | 494 | 11.12.2023 18:57 alfred |
Die Installation und Administration von XOOPS 2.5.X | [Offen] Upgrade 2.5.11 | 3 | 2207 | 07.05.2023 07:03 Goffy |