trashbin/asciitrash.php

236 lines
7.7 KiB
PHP
Raw Normal View History

2014-07-07 08:54:45 +00:00
<?php
$BASE_DIR = "";
require("include/config.inc.php");
require("include/cleanup.inc.php");
include("geshi.php");
2016-07-18 17:50:43 +00:00
if(isset($_POST['action'])) {
if($_POST['action'] == "upload") {
if($_POST['textar'] != "") {
switch($_POST['validity']) {
case 1: $expire = time() + 30 * 60; break;
case 2: $expire = time() + 60 * 60; break;
case 3: $expire = time() + 12 * 60 * 60; break;
case 4: $expire = time() + 24 * 60 * 60; break;
case 5: $expire = time() + 7 * 24 * 60 * 60; break;
case 6: $expire = time() + 31 * 24 * 60 * 60; break;
case 7: $expire = time() + 3 * 31 * 24 * 60 * 60; break;
case 8: $expire = time() + 6 * 31 * 24 * 60 * 60; break;
case 9: $expire = time() + 12 * 31 * 24 * 60 * 60; break;
}
// eine id erstellen
$file_id = mkhash();
$pub = 0;
if($_POST['pub']=="1") $pub = 1;
// eigabe entschaerfen
$safe_string = $db->escape($_POST['textar']);
$safe_synt = $db->escape($_POST['synt']);
$db->query("INSERT INTO pastebin (pid,timest,expire,payload,syntax,pub) VALUES
2014-07-07 08:54:45 +00:00
('{$file_id}','".time()."','{$expire}','{$safe_string}','{$safe_synt}',
'{$pub}')");
2016-07-18 17:50:43 +00:00
header("Location: {$_SERVER['PHP_SELF']}?fileid=".$file_id);
}
else {
header("Location: {$_SERVER['PHP_SELF']}?code=2");
}
2014-07-07 08:54:45 +00:00
}
2016-07-18 17:50:43 +00:00
}
2014-07-07 08:54:45 +00:00
else if(isset($_GET['fileid'])) {
include("include/header.php");
$spid = $db->escape($_GET['fileid']);
$result = $db->query("SELECT * FROM pastebin WHERE pid = '{$spid}'");
if($db->num_rows($result)) {
$row = $db->fetch_assoc($result);
echo "<p>Hier die gew&uuml;nschte Datei:</p>";
$com_path = dirname($_SERVER['SCRIPT_NAME']);
if($com_path == "/") $com_path = "";
$compatible_url = $base_url."a/{$_GET['fileid']}";
echo "<a href=\"{$compatible_url}\">{$compatible_url}</a>";
}
else {
echo "Datei nicht gefunden!";
}
include("include/footer.php");
}
elseif(isset($_GET['download'])) {
include("include/header.php");
$spid = $db->escape($_GET['download']);
$result = $db->query("SELECT * FROM pastebin WHERE pid = '{$spid}'");
if($db->num_rows($result)) {
$row = $db->fetch_assoc($result);
$db->query("UPDATE pastebin SET downloads = '".($row['downloads']+1)."' WHERE id = '{$row['id']}'");
echo "<div id=\"binoutput\">";
$language = $row['syntax'];
$geshi = new GeSHi(stripslashes($row['payload']), $language, "geshi/");
echo $geshi->parse_code();
echo "</div>\n";
}
else {
echo "Datei nicht gefunden!";
}
include("include/footer.php");
}
else {
include("include/header.php");
switch($_GET['code']) {
case "1":
echo "<p>fehler 1</p>";
break;
case "2":
echo "<p>fehler 2</p>";
break;
}
?>
<form name="ul" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
onsubmit="document.ul.u.value='Bitte warten ...';document.ul.u.disabled=true" >
<input type="hidden" name="action" value="upload" />
<textarea name="textar" rows="25" style="width:100%"></textarea><br/><br/>
G&uuml;ltigkeit:
<select name="validity" size="1">
<option value="1">30 Minuten</option>
<option value="2" selected="selected">60 Minuten</option>
<option value="3">12 Stunden</option>
<option value="4">24 Stunden</option>
<option value="5">1 Woche</option>
<option value="6">1 Monat</option>
<option value="7">3 Monate</option>
<option value="8">6 Monate</option>
<option value="9">12 Monate</option>
</select>
Syntax:
<select name="synt" size="1">
<option value="">Plain</option>
<option value="abap">ABAP</option>
<option value="actionscript">ActionScript</option>
<option value="actionscript-french" class="sublang">&nbsp;&nbsp;ActionScript (French Doc Links)</option>
<option value="ada">Ada</option>
<option value="apache">Apache Log File</option>
<option value="applescript">AppleScript</option>
<option value="asm">ASM (NASM based)</option>
<option value="asp">ASP</option>
<option value="autoit">AutoIT</option>
<option value="bash">Bash</option>
<option value="blitzbasic">BlitzBasic</option>
<option value="bnf">Backus-Naur form</option>
<option value="c">C</option>
<option value="c_mac">C for Macs</option>
<option value="caddcl">CAD DCL</option>
<option value="cadlisp">CAD Lisp</option>
<option value="cfdg">CFDG</option>
<option value="cfm">ColdFusion</option>
<option value="cpp">C++</option>
<option value="cpp-qt" class="sublang">&nbsp;&nbsp;C++/QT</option>
<option value="csharp">C#</option>
<option value="css">CSS</option>
<option value="d">D</option>
<option value="delphi">Delphi</option>
<option value="diff">Diff</option>
<option value="div">DIV</option>
<option value="dos">DOS</option>
<option value="dot">GraphViz</option>
<option value="eiffel">Eiffel</option>
<option value="fortran">Fortran</option>
<option value="freebasic">FreeBasic</option>
<option value="genero">Genero (4GL)</option>
<option value="glsl">glSlang</option>
<option value="gml">GML</option>
<option value="groovy">Groovy</option>
<option value="haskell">Haskell</option>
<option value="html4strict">HTML (4.0.1)</option>
<option value="idl">Uno IDL</option>
<option value="inno">Inno</option>
<option value="io">IO</option>
<option value="java">Java</option>
<option value="java5" class="sublang">&nbsp;&nbsp;Java 5</option>
<option value="javascript">Javascript</option>
<option value="latex">LaTeX</option>
<option value="lisp">Lisp</option>
<option value="lua">Lua</option>
<option value="matlab">Matlab</option>
<option value="mirc">mIRC</option>
<option value="mpasm">MPASM</option>
<option value="mysql">MySQL</option>
<option value="nsis">NullSoft Installer</option>
<option value="objc">Objective C</option>
<option value="ocaml">OCaml</option>
<option value="ocaml-brief" class="sublang">&nbsp;&nbsp;OCaml (Brief)</option>
<option value="oobas">Openoffice.org BASIC</option>
<option value="oracle8">Oracle 8</option>
<option value="pascal">Pascal</option>
<option value="per">Per (4GL)</option>
<option value="perl">Perl</option>
<option value="php">PHP</option>
<option value="php-brief" class="sublang">&nbsp;&nbsp;PHP (Brief version)</option>
<option value="plsql">PL/SQL</option>
<option value="python">Python</option>
<option value="qbasic">QBasic/QuickBASIC</option>
<option value="rails">Rails</option>
<option value="reg">Windows Registry</option>
<option value="robots">robots.txt</option>
<option value="ruby">Ruby</option>
<option value="sas">SAS</option>
<option value="scheme">Scheme</option>
<option value="sdlbasic">SDLBasic</option>
<option value="smalltalk">Smalltalk</option>
<option value="smarty">Smarty</option>
<option value="sql">SQL</option>
<option value="tcl">TCL</option>
<option value="text">Plain text</option>
<option value="thinbasic">thinBasic</option>
<option value="tsql">T-SQL</option>
<option value="vb">VisualBasic</option>
<option value="vbnet">VB.NET</option>
<option value="vhdl">VHDL</option>
<option value="visualfoxpro">VisualFoxPro</option>
<option value="winbatch">Winbatch</option>
<option value="xml">XML</option>
<option value="xpp">X++</option>
<option value="z80">Z80 Assembler</option>
</select>
<input type="checkbox" name="pub" value="1">Public
<input name="u" type="submit" value="Speichern" />
</form>
<?php
include("include/footer.php");
}
?>