private function drawLines($image, $amount) { $amount = $amount ? $amount : 1; while ($amount) { imagesetthickness($image, rand(1, 2)); $line_color = imagecolorallocate($image, rand(0, 152), rand(0, 152), rand(0, 152)); imageline($image, rx(), ry(), rx(), ry(), $line_color); $amount--; } }
/* Create the maroon bars */ // echo ha().'<img // '.createComIcon($root_path,'qbar_'.$event['maroon'].'_maroon.gif','0').' alt="Maroon" name="maroon'.'" '.mx(); /* Create the green bars */ /* Note $h is used here as counter */ for ($h = 1; $h < 8; $h++) { echo ha() . '<img ' . createComIcon($root_path, 'qbar_' . $event['rose_' . $h] . '_green.gif', '0') . ' alt="' . $LDFullDayName[$h] . '" name="green_' . $h . '" ' . gx(); } echo '<img ' . createComIcon($root_path, 'qbar_trans.gif', '0') . '>'; /* Create the rose bars*/ /* Note $h is used here as counter */ for ($h = 1; $h < 25; $h++) { echo ha() . '<img ' . createComIcon($root_path, 'qbar_' . $event['rose_' . $h] . '_rose.gif', '0') . ' alt="' . $h . ' ' . $LDHour . '" name="rose_' . $h . '" ' . rx(); if ($h == 6 || $h == 12 || $h == 18) { echo '<img ' . createComIcon($root_path, 'qbar_trans.gif', '0') . '>'; } } echo ' <tr bgcolor="#696969" > <td colspan=3 background="' . createBgSkin($root_path, 'folderskin2.jpg') . '"> </td> </tr>' . '' . ''; echo '</nobr></td></tr>'; echo '<tr bgcolor="#696969" > <td background="' . createBgSkin($root_path, 'folderskin2.jpg') . '" width="10px"> </td> <td valign="top" bgcolor="#ffffff">'; echo '<img src="' . $root_path . 'main/imgcreator/barcode_label_single_large.php?sid=' . $sid . '&lang=' . $lang . '&fen=' . $full_en . '&en=' . $pn . '&pid=' . $pid . '" width=282 height=178 align="left" hspace=5 vspace=5>'; echo '
return rand(0, 100); } function ry() { return rand(0, 30); } //Generate captcha and set in session. $start = rand(0, 25); $captcha = strtoupper(substr(md5(microtime()), $start, $length)); $_SESSION['capkey'] = $captcha; //Create image. $image = @imagecreatetruecolor(100, 30) or die("Cannot Initialize new GD image stream"); while ($lines) { imagesetthickness($image, rand(1, 2)); $line_color = imagecolorallocate($image, rand(153, 255), rand(153, 255), rand(153, 255)); imageline($image, rx(), ry(), rx(), ry(), $line_color); $lines--; } //Write out each letter individually. $index = 0; $x = $padding; while ($index < strlen($captcha)) { $text_color = imagecolorallocate($image, rand(153, 255), rand(153, 255), rand(153, 255)); //Calculate position. $f = rand(3, 5); $x = $x + imagefontwidth($f) + rand(2, 6); $y = rand(4, 30 - imagefontheight($f) - 4); imagestring($image, $f, $x + 1, $y + 1, substr($captcha, $index, 1), $text_color); imagestring($image, $f, $x, $y, substr($captcha, $index, 1), $text_color); $index++; }