Advertisement
Guest User

Untitled

a guest
Jan 30th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /*includes*/
  5. include("config.php");
  6. include("database.class.php");
  7. include("user.class.php");
  8.  
  9. /*vars*/
  10. $allowed = array("png", "ico", "jpeg", "jfif", "exif", "tiff", "raw", "png", "gif", "bmp", "ppm", "pgm", "pbm", "pnm", "webp", "tag", "ilmb", "pcx", "ecw", "img", "sid", "cd5", "fits", "pgf", "xcf", "psd", "psp", "cmg", "svg", "ai", "xgl", "iges", "vrml", "step", "dwf", "xaml", "x3d", "xvrml", "jt", "3dxml", "ipa", "prc", "3d", "3df", "hsf", "xvl", "stl", "u3d", "imml", "skp", "cdr", "eps", "hvif", "hpgl", "myv", "odg", "pict", "pdf", "pgf", "regis", "swf", "vml", "wmf", "xaml", "xar", "xps", "jpg");
  11. $db = new database($config['host'], $config['user'], $config['pass'], $config['db']);
  12.  
  13. /*function*/
  14. function bb2html($text) {
  15. $bbcode = array("<", ">", "[list]", "[*]", "[/list]", "[img]", "[/img]", "[b]", "[/b]", "[u]", "[/u]", "[i]", "[/i]", "[color=\"", "[/color]", "[size=\"", "[/size]", "[url=\"", "[/url]", "[mail=\"", "[/mail]", "[code]", "[/code]", "[quote]", "[/quote]", "\"]");
  16. $htmlcode = array("&lt;", "&gt;", "<ul>", "<li>", "</ul>", "<img src=\"", "\">", "<b>", "</b>", "<u>", "</u>", "<i>", "</i>", "<span style=\"color", "</span>", "<span style=\"font-size:", "</span>", "<a href=\"", "</a>", "<a href=\"mailto:", "</a>", "<code>", "</code>", "<table width=100% bgcolor=lightgray><tr><td bgcolor=white>", "</td></tr></table>", "\">");
  17. $newtext = str_replace($bbcode, $htmlcode, $text);
  18. $newtext = nl2br($newtext);
  19. return $newtext;
  20. }
  21. function random($length){
  22. $newcode = "";
  23. $x = "";
  24. while($x < $length){
  25. $part = rand(1, 3);
  26. $a = ($part == 1) ? 48 : ($part == 2) ? 65 : 097;
  27. $b = ($part == 1) ? 57 : ($part == 2) ? 90 : 122;
  28. $code_part = chr(rand($a, $b));
  29. $x = $x + 1;
  30. $newcode = $newcode.$code_part;
  31. }
  32. return $newcode;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement