Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
After help, can anyone understand this?
Old 08-13-2007, 11:14 AM After help, can anyone understand this?
Junior Talker

Posts: 2
Trades: 0
Hey everyone

I'm not a programmer by any means, I just edit and run a few hobby sites and quite like php. Any who I have ran into a slight problem with a script I purchased. It's a smiley sign generator script. A part of the code somewhere automatically deletes temp files that are created, but I haven't the slightest idea where this evil piece of code is (though quite useful, just I want the images to remain hosted on the server). Alternatively If I knew more I'd could use a copy command to copy the temp image to another directory upon its creation, which wouldn't get deleted. However that seems a little silly, doesn't it?

This is the totally strange and weird php page I understand none of. If anyone's good at reading php you might be able to tell me, or show me which part to edit to stop the script deleting temp created files. I am not certain that it's this page, but there's only one other. I will post the code that references to this too.

This is smiley.php

Code:
<?php 
 $x0b="\141\142s"; $x0c="c\154\x6f\x73\x65\x64\151\x72"; $x0d="\143o\x75\x6et"; $x0e="\146\151\x6ce\137\145xi\163\x74s"; $x0f="\x66\x69\154e\x6d\164\151\155\145"; $x10="\x67\x64_\151n\146o"; $x11="getc\x77\x64"; $x12="\150e\141\144\x65\162"; $x13="h\145\170\x64\145\143"; $x14="\151\x6da\147\145\x63\157lora\154\154\x6fca\x74\145"; $x15="\151\x6d\141\147\x65\x63o\154\157rt\162\141\x6e\163\160ar\x65\156t"; $x16="\x69\155\141\147\145\143\x72e\141\164e\x66r\x6f\155\x70n\x67"; $x17="im\141ge\x66\151\154\x6c"; $x18="\x69m\141ge\143r\145\141\x74e"; $x19="\x69\x6d\x61\147\145\143\157\x70\171"; $x1a="\x69\x6d\x61g\x65f\x69\x6c\154\x65\144\x72\x65\x63\x74\141\x6eg\154\x65"; $x1b="\x69\x6d\141g\x65\143r\145a\164\x65\x66\162\x6f\155\x67\x69\146"; $x1c="\x69\155a\147\x65d\x65s\164\162\157\171"; $x1d="\151\155ag\145\143op\171\x6de\162\x67e"; $x1e="\x69ma\147\x65\151\x6et\x65r\154\x61ce"; $x1f="\x69ma\147\145\147i\146"; $x20="im\141\x67e\x74\164f\x62\x62\157\x78"; $x21="\151\x6d\141\x67\x65s\164\162i\x6eg"; $x22="im\x61ge\x74t\146\x74\x65\x78\x74"; $x23="\x69m\141\147\x65\x73x"; $x24="\x69mag\x65\163y"; $x25="i\x6e\x69\x5fs\x65\164"; $x26="\151\x73\137dir"; $x27="i\163_a\162ra\x79"; $x28="\157\x70e\156\x64\151\162"; $x29="re\x61d\144\151\162"; $x2a="re\x61\x64\x66i\x6c\x65"; $x2b="\163\x68\x611"; $x2c="\163\160\x6ci\164"; $x2d="\163\164\x72_\x72\145\160l\141\x63\145"; $x2e="\163trip\x73l\x61\x73\150\x65\x73"; $x2f="\163t\162\x6c\145n"; $x30="\x73\164r\x70\157\163"; $x31="\163u\142\x73\x74r"; $x32="t\x69\x6d\145"; $x33="t\x72\x69m"; $x34="\x75n\x6cink"; 
$path = $x11();function x0b($txt, $fface, $fsize) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26,$x27,$x28,$x29,$x2a,$x2b,$x2c,$x2d,$x2e,$x2f,$x30,$x31,$x32,$x33,$x34;  $res = $x20($fsize, 0, $fface, $txt);return $x0b($res[2]-$res[0]);;}function x0c($txt, $fface, $fsize) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26,$x27,$x28,$x29,$x2a,$x2b,$x2c,$x2d,$x2e,$x2f,$x30,$x31,$x32,$x33,$x34;  $res = $x20($fsize, 0, $fface, $txt);return $x0b($res[5]-$res[3]);;} if ($x26("\164e\155\x70\x2f")) {$handle=$x28("\164\145mp\x2f");while (false!==($file = $x29($handle))) { if ($file != "\056" && $file != "..") {$Diff = ($x32() - $x0f("\164e\155\x70\x2f$file"))/60/60/240;if ($Diff > 1) $x34("\x74\145\x6d\160\057$file");}}$x0c($handle); } $x12("C\x6f\156\164ent\x2d\164\171\x70e:\x20\x69m\141\x67\145/\147if"); $x25('magic_quotes_gpc', OFF); $x25('magic_quotes_sybase', OFF); $path = $x11(); if ($_REQUEST['s']!='') $smiley = $_REQUEST['s']; else $smiley = 'drool'; if ($_REQUEST['fc']!='') {$fontcolor = $_REQUEST['fc'];$fontcolor = $x2d("\x23", "", $fontcolor); } else $fontcolor = '000000'; if ($_REQUEST['f']!='') $fontface = $path."\x2ffo\156\164s/".$_REQUEST['f']; else $fontface = $path."/\146ont\x73/c\157\x6d\151\x63.\164\164\146"; if ($_REQUEST['sc']!='') $signcolor = $_REQUEST['sc']; else $signcolor = 'FFFFFF'; if ($_REQUEST['t']!='') $text = $x2e($_REQUEST['t']); else $text = "\110\x65l\154o\x21"; if ($_REQUEST['shc']!=''){$shadowcolor = $_REQUEST['shc'];$shadowcolor =$x2d("\x23", "", $shadowcolor); } else $shadowcolor = ''; $base = $x2b("$text$smiley$fontcolor$fontface$shadowcolor$signcolor"); $file = "t\145\x6d\x70/".$base."\056g\151\x66"; if($x0e($file)) {$file = $x2a($file);exit($file); } $text = $x2e($text); if($phpversion_nr >= 4.30)$gd_info = $x10(); else$gd_info["\106\162e\145\x54y\x70\145\x20S\165\160\x70\x6f\162\x74"] = 1; if((!$gd_info["\106\x72\145\145\124y\160\x65 \x53u\x70p\x6f\x72\x74"]) || (!$x0e($fontface))){$txtwidth = 6;$txtheight = 8; } else {$txtheight = x0c("A", $fontface, 8.0); }$txtheight += 3; while ($x30($text, " \040")==true)$x2d("\040\040", "\x20", $text); if($x2f($text) > 30) {$words = $x2c("\x20", $text);if($x27($words)){ $i = 0;$maxw = 0; $output[$i] = ""; foreach($words as $word) { if ($i>20) break;if(($x2f($output[$i]." ".$word) < 30)) $output[$i] .= "\x20".$word;else { $output[$i] = $x33($output[$i]); if ($output[$i]=="" && $x2f($word)>30) { $output[$i] = $x33( $x31($word, 0, 27)."\056\x2e." );$tmpw = x0b($output[$i], $fontface, 8.0);if($maxw < $tmpw) $maxw = $tmpw;$i++;if ($x2f($word) > 30) $output[$i] = $x31($word, 0, 27)."\x2e\x2e.";else$output[$i] = $word;$tmpw = x0b($output[$i], $fontface, 8.0);if($maxw < $tmpw) $maxw = $tmpw; } else {$tmpw = x0b($output[$i], $fontface, 8.0);if($maxw < $tmpw) $maxw = $tmpw;$i++;if ($x2f($word) > 30) $output[$i] = $x31($word, 0, 27)."...";else$output[$i] = $word;$tmpw = x0b($output[$i], $fontface, 8.0);if($maxw < $tmpw) $maxw = $tmpw;}} }} else { $output[0] = $x31($text, 0, 27)."\x2e\056\x2e"; $maxw = x0b($output[0], $fontface, 8.0);} } else {$output[0] = $text;$maxw = x0b($output[0], $fontface, 8.0); } if($x0d($output) > 12) $output[12] = $x31($output[12], 0, 30)."\x2e.."; $width = $maxw + 20; $height = ($x0d($output) * $txtheight) + 34; if($width < 60) $width = 60; $sign = $x16("s\x69\147\156/\163\x69g\x6e.\x70\156\x67"); $trans2 = $x14($sign, 111, 252, 134); $x17($sign, 0, 0, $trans2); $x15($sign, $trans2); $x1e( $sign, 1 ); $img = $x18($width,$height); $bgcolor = $x14($img, 111, 252, 134); $fontcolor = $x14($img, $x13($x31($x2d("\043","",$fontcolor),0,2)), $x13($x31($x2d("\043","",$fontcolor),2,2)), $x13($x31($x2d("\043","",$fontcolor),4,2))); $txt2color = $x14($img, $x13($x31($x2d("#","",$shadowcolor),0,2)), $x13($x31($x2d("#","",$shadowcolor),2,2)), $x13($x31($x2d("#","",$shadowcolor),4,2))); $bocolor = $x14($img, 0, 0, 0);if($_REQUEST['sc']!=''){$signcolor = $_REQUEST['sc'];$signcolor = $x14($img, $x13($x31($signcolor ,0,2)), $x13($x31($signcolor,2,2)), $x13($x31($signcolor,4,2))); } else {$signcolor = $x14($img, 255, 255, 255); } $shadowcolor1 = $x14($img, 235, 235, 235); $shadowcolor2 = $x14($img, 219, 219, 219); require("\x73\155\x69l\145\171s\x2f$smiley\057\x64at\141\056p\x68\160"); $x19($img, $sign, ($width / 2 - 3), 0, 0, 0, 6, 4); $x19($img, $sign, ($width / 2 - 3), ($height - 24), 0, 5, 9, 17); $x1a($img, 0, 4, $width, ($height - 25), $bocolor); $x1a($img, 1, 5, ($width - 2), ($height - 26), $signcolor); $i = 0; while($i < $x0d($output)){if(((!$gd_info["\x46\162\145\145T\x79\160\x65\x20S\165\x70\160\x6f\162\164"]) || (!$x0e($fontface)))){ if($shadowcolor <>''){$x21($img, 2, (($width - ($x2f($x33($output[$i])) * $txtwidth) - 2) / 2 + 1), ($i * $txtheight + 6), $x33($output[$i]), $txt2color); } $x21($img, 2, (($width - ($x2f($x33($output[$i])) * $txtwidth) - 2) / 2), ($i * $txtheight + 5), $x33($output[$i]), $fontcolor);}else{ if($shadowcolor <>''){$x22($img, 8.0, 0, (($width - x0b($output[$i], $fontface, 8.0) - 2) / 2 + 1), ($i * $txtheight + $txtheight + 5), $txt2color, $fontface, $output[$i]); } $x22($img, 8.0, 0, (($width - x0b($output[$i], $fontface, 8.0) - 5) / 2), ($i * $txtheight + $txtheight + 5), $fontcolor, $fontface, $output[$i]);}$i++; } $x15($img, $bgcolor); $x1e($img, 1); $restmp = $x1b("\163\x6d\x69\x6cey\x73/$smiley/$smiley\x2e\x67\x69\146"); $resw = $x23($restmp); $resh = $x24($restmp); $x1c($restmp); $smiley2 = $x1b("s\x6d\151\154e\x79\163\057$smiley/$smiley\x2e\x67\151\x66"); $canvas = $x18($width, $height); $trans = $x14($canvas, 111, 252, 134); $x15($canvas, $trans); $x1e($canvas, 1); $x1d($canvas, $img, 0, 0, 0, 0, $width, $height, 100); $x1d($canvas, $smiley2, ($width / 2 + 3 - $placementx), ($height - $placementy), 0, 0, $resw, $resh, 100); $x1f($canvas, "\x74e\x6d\x70/$base\x2eg\x69\x66", 100); $x1c($smiley2); $x1c($canvas); $x1c($img); $x1c($sign); $img = $x2a("t\x65\155\x70\x2f".$base."\x2eg\x69\146");print($img);?>
This is a part of index.php that references to smiley.php

Code:
  $base = sha1("$text$smiley$fontcolor$fontface$shadowcolor$signcolor");

  $file = "temp/".$base.".gif";

  if(file_exists($file)) print("<img src=\"$file\" alt=\"\">");
  else print("<img src=\"smiley.php?t=".urlencode($text)."&s=$smiley&fc=$fontcolor&ssh={$_REQUEST['ssh']}&f={$_REQUEST['f']}&shc=$shadowcolor&sc=$signcolor\">\n");
I'll be very appreciative of any help. I think the temp file deleter is in smiley.php somewhere, but I could be wrong.

Thanks,
croc

Resolved: The other script was responsible for deleting the images in the temp folder. This occurs everytime someone used my other script live on my website *doh*

Last edited by croc; 08-13-2007 at 11:36 PM..
croc is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-13-2007, 01:49 PM Re: After help, can anyone understand this?
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
You are encoding the url as sha1 if I am not mistaken and the url is based on those variables.
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 08-13-2007, 09:33 PM Re: After help, can anyone understand this?
Junior Talker

Posts: 2
Trades: 0
Quote:
Originally Posted by goheadtry View Post
You are encoding the url as sha1 if I am not mistaken and the url is based on those variables.
Thanks for the reply.

If that just encodes the url, then that wouldn't be responsible for clearing out the temp folder?

Unencoded urls look like this:
.../smiley.php?t=Hello%21&s=happy&fc=000000&ssh=&f=Ari al%20Black.ttf&shc=&sc=FFFFFF

Encoded urls look like this:
.../temp/df4bf6b162643ed15ce9a26ba7dfeca26e954511.gif


Edit1: The temp folder is being shared by another script, which I think is responsible for clearing it. Will report back shortly :O

Edit2: The other script was responsible for deleting the images in the temp folder. This occurs everytime someone used my other script live on my website *doh*

Last edited by croc; 08-13-2007 at 11:37 PM..
croc is offline
Reply With Quote
View Public Profile
 
Old 08-14-2007, 01:08 PM Re: After help, can anyone understand this?
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Maybe something like this would help you
http://www.weberdev.com/get_example-4163.html
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Reply     « Reply to After help, can anyone understand this?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49792 seconds with 12 queries