Íîâåíüêèé
Ðåãèñòðàöèÿ: 27.01.2007
Ñîîáùåíèé: 3
|
Íà ñàéòå åñòü 2 ñòðàíèöû.
Çàãðóçêà ïðîèñõîäèò ñî ñòðàíèöû ¹1. Òàì åñòü HTML êîíòåíò, â êîòîðîì åñòü òîëüêî îäíà ñòðîêà:
<img src="2.php">
Ñòðàíèöà ¹2: íàçûâàåòñÿ "2.php" è ñîäåðæèò PHP êîíòåíò, â êîòîðîì íàõîäèòñÿ ñëåäóþùèé êîä:
<?php
header('Content-type: image/png');
function RandCharImage($code)
{
$font = "font.ttf";
$img = ImageCreate (320, 50);
$color = array();
$color[] = ImageColorAllocate ($img, 0, 0, 0);
$color[] = ImageColorAllocate ($img, 0, 0, 127);
$color[] = ImageColorAllocate ($img, 127, 0, 0);
$color[] = ImageColorAllocate ($img, 0, 127, 0);
$color[] = ImageColorAllocate ($img, 127, 127, 0);
$color[] = ImageColorAllocate ($img, 127, 0, 127);
$color[] = ImageColorAllocate ($img, 0, 127, 127);
$color[] = ImageColorAllocate ($img, 127, 127, 127);
$color[] = ImageColorAllocate ($img, 0, 0, 255);
$color[] = ImageColorAllocate ($img, 255, 0, 0);
$color[] = ImageColorAllocate ($img, 0, 255, 0);
$color[] = ImageColorAllocate ($img, 255, 255, 0);
$color[] = ImageColorAllocate ($img, 255, 0, 255);
$color[] = ImageColorAllocate ($img, 0, 255, 255);
$color[] = ImageColorAllocate ($img, 255, 255, 255);
$sx = ImageSX ($img) - 1;
$sy = ImageSY ($img) - 1;
$sc = count ($color) - 1;
// Background noise:
for ($i = 0; $i < 1024; $i++)
{
$x = mt_rand (0, $sx);
$y = mt_rand (0, $sy);
$c = $color[mt_rand(1,$sc)];
ImageSetPixel ($img, $x, $y, $c);
}
// Output of a code:
$xpos = mt_rand (4, 16);
$height = $sy - mt_rand (0, $sy / 4);
for ($i = 0; $i < strlen($code); $i++)
{
$angle = mt_rand (0, 45) - 22;
$size = mt_rand (0, 10) + 30;
$ypos = $sy - mt_rand (4, $sy - $height);
$c = $color[mt_rand(9,$sc)];
$rect = ImageTTFtext ($img, $size, $angle, $xpos, $ypos, $c, $font, $code[$i]);
$width = $rect[2] - $rect[0];
$height = $rect[1] - $rect[7];
$xpos += $width + mt_rand (0, 32) - 8;
}
//Forward noise:
for ($i = 0; $i < 256; $i++)
{
$x = mt_rand (0, $sx);
$y = mt_rand (0, $sy);
$c = $color[mt_rand(1,$sc)];
ImageSetPixel ($img, $x, $y, $c);
}
for ($i = 0; $i < mt_rand (2, 8); $i++)
{
$x1 = mt_rand (0, $sx);
$y1 = mt_rand (0, $sy);
$x2 = mt_rand (0, $sx);
$y2 = mt_rand (0, $sy);
$c = $color[mt_rand(0,$sc)];
ImageLine ($img, $x1, $y1, $x2, $y2, $c);
}
ImagePng ($img);
ImageDestroy ($img);
}
session_start();
RandCharImage($_SESSION['code_chars']);
?>
Åñëè ãðóçèòñÿ ñî ñòðàíèöû ¹1-òî êàðòèíêà íå âûâîäèòñÿ, åñëè ñî ñòðàíèöû ¹2 - âûâîäèòñÿ ñëåäóþùåå:
‰PNG IHDR@2ÓòæÕPLTEÿÿÿÿÿÿÿÿÿÿÿÿ?_ß¿Ÿ ___ŸŸŸ???ßßß¿¿¿??ÿßß??ŸÏÏŸÿÿŸŸ?ßÿÿ?ÿÿ¿ÿŸ_?¿¿? ¯ÿßÏ/??Ÿ__ÿ??ÿŸÿŸÿ?ŸŸÿ_¯¯¿¿¿ßÿ_ÿßÏ¿?¿??Ÿ_ÿ¿ßß ŸŸ__??¿¿ßï¿ÿŸŸ_FêŒE ‰IDATxœ[‡²ë¸ ¥ä¢jY²%[v’MvÓ&uR&“êÛ6ÉÿR°,²îËÃ쾫B‘ÀÁR²íF(1E)¬d""?ü oNZÑîÃÛRr<(ÕaL¢} QWºxCqH\žÝõ{,–׽ǶɆ‹²å§>DFÛÝB)\˜©ä‡t %ð÷¥µÕÕxÚG®‹«éf©JœDNöOîó–¹õZt¼èÏ?žOų-¦è.tÆ.BðÆê ÓW9µ,ÅZI[¼k–ˆ’Û±âRGÜjŒ*üˆ‹bH|ŒRý¿¥ÑÒdÏ7> è ò.ä.
|