$val) { CloseTicket($id); } } break; case "reopen": if (count($_POST[t])) { foreach ($_POST[t] as $id => $val) { ReopenTicket($id); } } break; case "post": if ($_POST[message]) { $iid = PostMessage($_POST[id], $_POST[message]); $ext = preg_replace("/.*\.(.{3,4})$/", "$1", $_FILES[attachment][name]); if ($_FILES[attachment][name]) { if ($config[attachment_dir] and stristr($config[filetypes], ".$ext;")) { mt_srand(time()); $rand = mt_rand(100000, 999999); $filename = $rand . "_" . $_FILES[attachment][name]; copy($_FILES[attachment][tmp_name], "$config[attachment_dir]/$filename"); mysql_query("INSERT INTO ticket_attachments (ticket, ref, filename, type) VALUES ('$_POST[id]', '$iid', '$filename', 'q')"); } else { $err = "We don't accept the file type '$ext'.

"; } } $inc = "viewticket"; } else { $err = "Required fields missing."; } break; case "logout": session_destroy(); $inc = "user_login"; break; } } else { $err = 1; $inc = "user_login"; } } $inc = !$inc ? "main": $inc; include(INCLUDE_DIR."/header.php"); include(INCLUDE_DIR."/$inc.php"); include(INCLUDE_DIR."/footer.php"); ?>