1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54: | function write_event_to_db($date, $time, $tickets, $teaser, $content, $check, $title, $price, $url
{
$daba = new db_access();
$db = $daba->db_connect();
$teaser = str_replace("\r\n","
",$teaser);
$content = str_replace("\r\n","
",$content);
$SQL = "INSERT INTO `event` (`ID`, `Datum`, `Zeit`, `Teaser`, `Ticketanzahl`, `Beschreibung`, `Restkarten`,
`Titel`, `Preis`, `URL`
VALUES ('', '$date', '$time', '$teaser', '$tickets', '$content',
'$tickets', '$title', '$price', '$url')";
$daba->ExecSQL($SQL, $db);
$SQL = "SELECT id FROM event WHERE Titel LIKE '$title'";
$result = $daba->ExecSQL($SQL, $db);
$ident = mysql_result($result,0,0);
foreach($check as $value)
{
$SQL = "INSERT INTO `kat_event` (`kat_id`, `event_id`)
VALUES ('$value', '$ident')";
$daba->ExecSQL($SQL, $db);
}
$allowedfiletype = array('png', 'gif', 'jpg', 'jpeg');
$maxfilesize = 2;
$fieldname = 'datei';
$uploaddir = '../eventimages';
if($_POST['send'] == 'send'){
if($_FILES[$fieldname]['error'] == 1) die('Datei überschreitet die Uploadgröße('.ini_get('upload_max_filesize').')!');
elseif($_FILES[$fieldname]['error'] == 3) die('Datei nur teilweise hochgeladen!');
elseif($_FILES[$fieldname]['error'] != 0) die('Keine Datei ausgewählt!');
elseif(!in_array(strrev(substr(strrev($_FILES[$fieldname]['name']), 0,
strpos(strrev($_FILES[$fieldname]['name']), '.')))$allowedfiletype)) die('Endung nicht erlaubt!');
elseif(filesize($_FILES[$fieldname]['tmp_name'])/1024/1024 >= $maxfilesize) die('Datei zu groß!');
else{
move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploaddir.'/'.$_FILES[$fieldname]['name']);
$dirname = dirname($_SERVER['PHP_SELF']);
$fileurl = 'http://'.$_SERVER['SERVER_NAME'].(substr($dirname, 0, 1) == '\\' ? substr($dirname, 1):$dirname).'/'.$uploaddir.'/';
$href = $fileurl.urlencode($_FILES[$fieldname]['name']);
$anzeigen = $fileurl.$_FILES[$fieldname]['name'];
[b]$url = $uploaddir.'/'.$_FILES[$fieldname]['name'];[/b]
}
}
$daba->db_close($db);
} |