Advertisement
terrance-

4chan tripcode code

Aug 31st, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.08 KB | None | 0 0
  1. $names=iconv("UTF-8", "CP932//IGNORE", $name); // convert to Windows Japanese #kami
  2.  
  3.   //start new tripcode crap
  4.     list ($name) = explode("#", $name);
  5.     $name = CleanStr($name);
  6.  
  7.     if(preg_match("/\#+$/", $names)){
  8.         $names = preg_replace("/\#+$/", "", $names);
  9.     }
  10.     if (preg_match("/\#/", $names)) {
  11.         $names = str_replace("&#","&&",htmlspecialchars($names)); # otherwise HTML numeric entities screw up explode()!
  12.         list ($nametemp,$trip,$sectrip) = str_replace("&&", "&#", explode("#",$names,3));
  13.         $names = $nametemp;
  14.         $name .= "</span>";
  15.  
  16.         if ($trip != "") {
  17.             if (FORTUNE_TRIP == 1 && $trip == "fortune") {
  18.                 $fortunes = array("Bad Luck","Average Luck","Good Luck","Excellent Luck","Reply hazy, try again","Godly Luck","Very Bad Luck","Outlook good","Better not tell you now","You will meet a dark handsome stranger","&#65399;&#65408;&#9473;&#9473;&#9473;&#9473;&#9473;&#9473;(&#65439;&#8704;&#65439;)&#9473;&#9473;&#9473;&#9473;&#9473;&#9473; !!!!","&#65288;&#12288;´_&#12445;`&#65289;&#65420;&#65392;&#65437; ","Good news will come to you by mail");
  19.                 $fortunenum = rand(0,sizeof($fortunes)-1);
  20.                 $fortcol = "#" . sprintf("%02x%02x%02x",
  21.                     127+127*sin(2*M_PI * $fortunenum / sizeof($fortunes)),
  22.                     127+127*sin(2*M_PI * $fortunenum / sizeof($fortunes)+ 2/3 * M_PI),
  23.                     127+127*sin(2*M_PI * $fortunenum / sizeof($fortunes) + 4/3 * M_PI));
  24.                 $com = "<font color=$fortcol><b>Your fortune: ".$fortunes[$fortunenum]."</b></font><br /><br />".$com;
  25.                 $trip = "";
  26.                 if($sectrip == "") {
  27.                     if($name == "</span>" && $sectrip == "")
  28.                         $name = S_ANONAME;
  29.                 else
  30.                     $name = str_replace("</span>","",$name);   
  31.         }
  32.         } else if($trip=="fortune") {
  33.         //remove fortune even if FORTUNE_TRIP is off
  34.         $trip="";
  35.                 if($sectrip == "") {
  36.                         if($name == "</span>" && $sectrip == "")
  37.                                 $name = S_ANONAME;
  38.                         else
  39.                                 $name = str_replace("</span>","",$name);
  40.                 }
  41.  
  42.         } else {
  43.  
  44.             $salt = strtr(preg_replace("/[^\.-z]/",".",substr($trip."H.",1,2)),":;<=>?@[\\]^_`","ABCDEFGabcdef");
  45.             $trip = substr(crypt($trip, $salt),-10);
  46.             $name.=" <span class=\"postertrip\">!".$trip;
  47.             }
  48.         }
  49.  
  50.  
  51.         if ($sectrip != "") {
  52.             $salt = "LOLLOLOLOLOLOLOLOLOLOLOLOLOLOLOL"; #this is ONLY used if the host doesn't have openssl
  53.                                                     #I don't know a better way to get random data
  54.         if (file_exists(SALTFILE)) { #already generated a key
  55.             $salt = file_get_contents(SALTFILE);
  56.         } else {
  57.             system("openssl rand 448 > '".SALTFILE."'",$err);
  58.             if ($err === 0) {
  59.                 chmod(SALTFILE,0400);
  60.                 $salt = file_get_contents(SALTFILE);
  61.             }
  62.         }
  63.             $sha = base64_encode(pack("H*",sha1($sectrip.$salt)));
  64.             $sha = substr($sha,0,11);
  65.                 if($trip=="") $name.=" <span class=\"postertrip\">";
  66.                 $name.="!!".$sha;
  67.         }
  68.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement