Skip to content

Instantly share code, notes, and snippets.

@marvin
Created February 16, 2012 12:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marvin/1844487 to your computer and use it in GitHub Desktop.
Save marvin/1844487 to your computer and use it in GitHub Desktop.
1kb forum
<html><body><h1>1KB Forum</h1><?mysql_connect('localhost','username','********');mysql_select_db('d');extract($_REQUEST);$v=intval($v);$i=0;$q='mysql_query';$f='mysql_fetch_row';$n='mysql_num_rows';$x='<input type="';$s="SELECT*FROM";$t='CREATE TABLE IF NOT EXISTS t(i INT AUTO_INCREMENT,a INT,b TEXT,KEY(i))';$h='htmlspecialchars';$q($t);$q(str_replace('t','p',$t));$l=' ORDER BY';$o='';$u='INSERT INTO';$c="b)VALUES('";if($b){if(!$v)$q("$u t($c$e')");$v=max($v,mysql_insert_id());$q("$u p(a,$c$v','$b')");}if($v){$t=$q("$s p WHERE a=$v$l i");echo'<a href="f.php">Back</a>';for(;$i<$n($t);++$i){$r=$f($t);echo'<hr/>'.nl2br($h($r[2]));}}else{$t=$q("$s t$l-i");for(;$i<$n($t);++$i){$r=$f($t);echo'<a href="f.php?v='.$r[0].'">'.$h($r[2]).'</a><br/>';}$o='Title:'.$x.'text"name="e"/><br/>';}echo'<hr/>Post:<form action="f.php"method="post">'.$x.'hidden"name="v"value="'."$v\"/>$o<textarea name=\"b\"></textarea>$x";?>submit"name="w"value="Post"/></form></body></html>
<html><body><h1>1KB Forum</h1><?php
mysql_connect('localhost','username','********');
mysql_select_db('d');
extract($_REQUEST);
$v=intval($v);
$i=0;
$q='mysql_query';
$f='mysql_fetch_row';
$n='mysql_num_rows';
$x='<input type="';
$s="SELECT*FROM";
$t='CREATE TABLE IF NOT EXISTS t(i INT AUTO_INCREMENT,a INT,b TEXT,KEY(i))';
$h='htmlspecialchars';
$q($t);
$q(str_replace('t','p',$t));
$l=' ORDER BY';
$o='';
$u='INSERT INTO';
$c="b)VALUES('";
if($b){
if(!$v)$q("$u t($c$e')");
$v=max($v,mysql_insert_id());
$q("$u p(a,$c$v','$b')");
}
if($v){
$t=$q("$s p WHERE a=$v$l i");
echo'<a href="f.php">Back</a>';
for(;$i<$n($t);++$i){
$r=$f($t);
echo'<hr/>'.nl2br($h($r[2]));
}
} else{
$t=$q("$s t$l-i");
for(;$i<$n($t);++$i){
$r=$f($t);
echo'<a href="f.php?v='.$r[0].'">'.$h($r[2]).'</a><br/>';
}
$o='Title:'.$x.'text"name="e"/><br/>';
}
echo'<hr/>Post:<form action="f.php"method="post">'.$x.'hidden"name="v"value="'."$v\"/>$o<textarea name=\"b\"></textarea>$x";
?>submit"name="w"value="Post"/></form></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment