GoDofAdeN Posted June 11, 2009 Share Posted June 11, 2009 Original script of conversion shared by Humordwarf. Some optimizations made by FidoW <? $id = antiinjection($_GET['id']); if(!$id) die("Error: No ID"); // db config $CONFIG['worlddbname'] = "lin2world"; // Database Name $CONFIG['dbaddress'] = "localhost"; // MSSQL IP $CONFIG['dbuser'] = ""; // MSSQL User $CONFIG['dbpass'] = ""; // MSSQL Password // db connection! $dbconnect = @mssql_connect ($CONFIG['dbaddress'], $CONFIG['dbuser'], $CONFIG['dbpass']); @mssql_select_db ($CONFIG['worlddbname'], $dbconnect); $query = "SELECT bitmap FROM Pledge_Crest WHERE crest_id = '$id'"; $result = mssql_query($query); $clan_crest = mssql_fetch_array($result); $rnd_file = tmpfile(); fwrite($rnd_file, $clan_crest['bitmap']); fseek($rnd_file, 0); $file = &$rnd_file; //fopen($filename,'rb'); $dds = fread($file,4); if ($dds!=='DDS ') die("Error: no hay imagen DDS"); //DDS header $hdrSize = readInt($file); $hdrFlags = readInt($file); $imgHeight = readInt($file)-4; $imgWidth = readInt($file); $imgPitch = readShort($file); //DXT1 header fseek($file, 84); $dxt1 = fread($file,4); if ($dxt1!=='DXT1') die("Error: no es formato DX1"); //here we go fseek($file, 128); header ("Content-type: image/png"); $img=imagecreatetruecolor($imgWidth,$imgHeight); for ($y=-1; $y<$imgHeight/4; $y++) { for ($x=0; $x<$imgWidth/4; $x++) { $color0_16 = readShort($file); $color1_16 = readShort($file); $r0 = ($color0_16 >> 11) << 3; $g0 = (($color0_16 >> 5) & 63) << 2; $b0 = ($color0_16 & 31) << 3; $r1 = ($color1_16 >> 11) << 3; $g1 = (($color1_16 >> 5) & 63) << 2; $b1 = ($color1_16 & 31) << 3; $color0_32 = imagecolorallocate($img,$r0,$g0,$b0); $color1_32 = imagecolorallocate($img,$r1,$g1,$b1); $color01_32 = imagecolorallocate($img,$r0/2+$r1/2,$g0/2+$g1/2,$b0/2+$b1/2); $black = imagecolorallocate($img,0,0,0); $data = readInt($file); for ($yy=0;$yy<4;$yy++) { for ($xx=0;$xx<4;$xx++) { $bb = $data & 3; $data = $data >> 2; switch ($bb) { case 0: $c = $color0_32; break; case 1: $c = $color1_32; break; case 2: $c = $color01_32; break; default: $c = $black; break; } imagesetpixel($img,$x*4+$xx,$y*4+$yy,$c); } } } } imagepng($img); ## Functions needed function readInt($file) { $b4 = ord(fgetc($file)); $b3 = ord(fgetc($file)); $b2 = ord(fgetc($file)); $b1 = ord(fgetc($file)); return ($b1<<24)|($b2<<16)|($b3<<8)|$b4; } function readShort($file) { $b2 = ord(fgetc($file)); $b1 = ord(fgetc($file)); return ($b1<<8)|$b2; } ?> Credits - FidoW this script can and MUST be used with this Share => http://www.maxcheaters.com/forum/index.php?topic=64006.0 Quote Link to comment Share on other sites More sharing options...
rej222 Posted June 11, 2009 Share Posted June 11, 2009 :P Nice share! Bello :D Adesso che postpacific fa scifo ce mxc per queste cose :P! Quote Link to comment Share on other sites More sharing options...
CriticalError Posted June 24, 2009 Share Posted June 24, 2009 ohhh interesting topic God downloading!!!! thanks a lot Quote Link to comment Share on other sites More sharing options...
maxicroma Posted September 18, 2009 Share Posted September 18, 2009 thx for the share Quote Link to comment Share on other sites More sharing options...
Elanius Posted November 16, 2009 Share Posted November 16, 2009 Hi:) if i use this it write me msg Fatal error: Call to undefined function antiinjection() in C:\Inetpub\wwwroot\phpscript\crest.php on line 4 where is the problem? 8) :) Heroes.php scrip workin fine.. but cest no:( Quote Link to comment Share on other sites More sharing options...
Elanius Posted November 16, 2009 Share Posted November 16, 2009 okej.. there was missing function... but when i add function antiinjection($str) { $allowedchars = "abcdefghijklmnopqrstuvwxyz1234567890?!.@_ "; $str=strtolower($str); if (strspn($str, $allowedchars) != strlen($str)) { $str = NULL; } return $str; } it still write to me "Error: No ID" Quote Link to comment Share on other sites More sharing options...
Syndrome69 Posted February 26, 2012 Share Posted February 26, 2012 complicated.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.