{ global $font; $chars = array_keys($font); return $chars[rand(0, count($font) - 2)]; } kotoba_session_start(); if (Config::LANGUAGE != $_SESSION['language']) { require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php"; } locale_setup(); $im = imagecreate(100, 30); if (isset($_SESSION['stylesheet']) && $_SESSION['stylesheet'] == 'kusaba.css') { $bg = imagecolorallocate($im, 238, 255, 238); } elseif (isset($_SESSION['stylesheet']) && $_SESSION['stylesheet'] == 'futaba.css') { $bg = imagecolorallocate($im, 255, 255, 238); } elseif (isset($_SESSION['stylesheet']) && $_SESSION['stylesheet'] == 'kotoba.css') { $bg = imagecolorallocate($im, 236, 255, 208); } else { $bg = imagecolorallocate($im, 255, 100, 255); } $textcolor = imagecolorallocate($im, 0, 0, 0); $word = ""; for ($i = 0; $i < 5; $i++) { $word .= getrandchar(); } drawtext($im, 10, 10, $word, $textcolor); imageline($im, rand(0, 100), rand(0, 30), rand(0, 100), rand(0, 30), $textcolor); header('Content-type: image/png'); imagepng($im); imagedestroy($im); $_SESSION['captcha_code'] = $word;
echo "</select>\n\t <input type='submit'>\n</form>\n"; if ($createimg) { $overlay = imagecreatetruecolor($image_width, $image_height); imagealphablending($overlay, false); imagesavealpha($overlay, true); $black = imagecolorallocatealpha($overlay, 0, 0, 0, 64); $white = imagecolorallocatealpha($overlay, 255, 255, 255, 64); $trans = imagecolorallocatealpha($overlay, 255, 255, 255, 127); imagefilledrectangle($overlay, 0, 0, $image_width, $image_height, $trans); imagealphablending($img, true); $idx = 0; for ($pos = $gridsize; $pos <= $image_width; $pos += $gridsize) { $xtext = chr(65 + $idx); $ytext = $idx + 1; drawtext($overlay, $pos - $gridsize / 2, 16, $xtext, $contrast); drawtext($overlay, 14, $pos - $gridsize / 2 + 1, $ytext, $contrast); if ($pos < $image_width) { imageline($overlay, $pos, 0, $pos, $image_height, $contrast); imageline($overlay, 0, $pos, $image_width, $pos, $contrast); } $idx++; } function drawtext(&$overlay, $xofs = 0, $yofs = 0, $text = '', $colors = array(), $font = '/usr/share/fonts/msttcore/arial.ttf', $font_size = 11, $angle = 45) { if (!is_array($colors)) { $colors = array($colors); } $text_box = imagettfbbox($font_size, $angle, $font, $text); $text_width = $text_box[2] - $text_box[0]; $text_height = $text_box[3] - $text_box[1]; $tx = $xofs - $text_width / 2;
ORDER BY ipaddr LIMIT 4', array($deviceid))) { if (isset($devip[0])) { drawtext($px + 16, $py - (isset($devip[1]) ? 16 : 8), $devip[0], 0, 0, 255); } if (isset($devip[1])) { drawtext($px + 16, $py - 8, $devip[1], 0, 0, 255); } if (isset($devip[2])) { drawtext($px + 16, $py + 16, $devip[2], 0, 0, 255); } if (isset($devip[3])) { drawtext($px + 16, $py + 24, $devip[3], 0, 0, 255); } } drawtext($px + 16, $py + 0, $d['name'], 0, 0, 0); drawtext($px + 16, $py + 8, $d['location'], 0, 128, 0); } header("Content-type: application/x-shockwave-flash"); // Note: this line avoids a bug in InternetExplorer that won't allow // downloads over https header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); $m->output(); } else { makemap($map, $seen, $start); foreach ($map as $idx => $x) { if (!$minx) { $minx = $idx; } elseif ($idx < $minx) { $minx = $idx;
imagestring($image, $hfont, $offsetx, $offsety, $text, $color); } return array('HEIGHT' => $height, 'WIDTH' => $width); } //draw line one $ttftext = $chardata['FIRST_NAME'] . " " . $chardata['LAST_NAME']; $ttfreturn = drawtext($image, $ttftext, $sizeone, $fontone, $colorone, $line_start_x, $line_start_y, $shadowone); $line_start_y += $ttfreturn['HEIGHT']; //draw line two $ttftext = $chardata['LEVEL'] . " " . $chardata['RACE'] . " " . $chardata['CLASS']; $ttfreturn = drawtext($image, $ttftext, $sizetwo, $fonttwo, $colortwo, $line_start_x, $line_start_y, $shadowtwo); $line_start_y += $ttfreturn['HEIGHT']; //draw line three if ($chardata['GUILD_NAME']) { $ttftext = $chardata['GUILD_RANK'] . " of " . $chardata['GUILD_NAME']; $ttfreturn = drawtext($image, $ttftext, $sizetwo, $fonttwo, $colortwo, $line_start_x, $line_start_y, $shadowtwo); $line_start_y += $ttfreturn['HEIGHT']; } // draw stats and boxes if ($statbg) { $i = 0; $statcolor = imagecolorallocate($image, $statcolor['r'], $statcolor['g'], $statcolor['b']); foreach ($statdisplay as $key => $value) { if ($value > "") { if (array_key_exists($value, $stats)) { $stattext = $value . " " . $stats[$value]; $tempimage = imagecreatefrompng($statbg); imagecopy($image, $tempimage, $stat_start_x + $stat_step_x * $i, $stat_start_y, 0, 0, $stat_width, $stat_height); imagestring($image, 2, $stat_text_x + $stat_start_x + $stat_step_x * $i, $stat_text_y + $stat_start_y, $stattext, $statcolor); imagedestroy($tempimage); }