mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-03 23:17:07 +03:00
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@536 c66351dc-e62f-0410-b875-e3a5c0b9693f
3 lines
20 KiB
PHP
3 lines
20 KiB
PHP
<code><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/**<br />Securimage Test Script<br />Version 1.0 - 01/02/2008<br /><br />Upload this PHP script to your web server and call it from the browser.<br />The script will tell you if you meet the requirements for running Securimage.<br /><br />http://www.phpcaptcha.org<br />*/<br /><br /><br /></span><span style="color: #007700">if (isset(</span><span style="color: #0000BB">$_GET</span><span style="color: #007700">[</span><span style="color: #DD0000">'testimage'</span><span style="color: #007700">]) && </span><span style="color: #0000BB">$_GET</span><span style="color: #007700">[</span><span style="color: #DD0000">'testimage'</span><span style="color: #007700">] == </span><span style="color: #DD0000">'1'</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreate</span><span style="color: #007700">(</span><span style="color: #0000BB">225</span><span style="color: #007700">, </span><span style="color: #0000BB">225</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$white </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$black </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /> <br /> </span><span style="color: #0000BB">$red </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$green </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$blue </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /><br /> </span><span style="color: #FF8000">// draw the head<br /> </span><span style="color: #0000BB">imagearc</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">120</span><span style="color: #007700">, </span><span style="color: #0000BB">200</span><span style="color: #007700">, </span><span style="color: #0000BB">200</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">360</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// mouth<br /> </span><span style="color: #0000BB">imagearc</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">120</span><span style="color: #007700">, </span><span style="color: #0000BB">150</span><span style="color: #007700">, </span><span style="color: #0000BB">150</span><span style="color: #007700">, </span><span style="color: #0000BB">25</span><span style="color: #007700">, </span><span style="color: #0000BB">155</span><span style="color: #007700">, </span><span style="color: #0000BB">$red</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// left and then the right eye<br /> </span><span style="color: #0000BB">imagearc</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">60</span><span style="color: #007700">, </span><span style="color: #0000BB">95</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">360</span><span style="color: #007700">, </span><span style="color: #0000BB">$green</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagearc</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">140</span><span style="color: #007700">, </span><span style="color: #0000BB">95</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">360</span><span style="color: #007700">, </span><span style="color: #0000BB">$blue</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">15</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">'Securimage Will Work!!'</span><span style="color: #007700">, </span><span style="color: #0000BB">$blue</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">, </span><span style="color: #DD0000">':) :) :)'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">30</span><span style="color: #007700">, </span><span style="color: #DD0000">':) :)'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">40</span><span style="color: #007700">, </span><span style="color: #DD0000">':)'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">150</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">, </span><span style="color: #DD0000">'(: (: (:'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">168</span><span style="color: #007700">, </span><span style="color: #0000BB">30</span><span style="color: #007700">, </span><span style="color: #DD0000">'(: (:'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">186</span><span style="color: #007700">, </span><span style="color: #0000BB">40</span><span style="color: #007700">, </span><span style="color: #DD0000">'(:'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /> exit;<br />}<br /><br />function </span><span style="color: #0000BB">print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$supported</span><span style="color: #007700">)<br />{<br /> if (</span><span style="color: #0000BB">$supported</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"<span style=\"color: #00f\">Yes!</span>"</span><span style="color: #007700">;<br /> } else {<br /> echo </span><span style="color: #DD0000">"<span style=\"color: #f00; font-weight: bold\">No</span>"</span><span style="color: #007700">;<br /> }<br />}<br /><br /></span><span style="color: #0000BB">?><br /></span><html><br /><head><br /> <title>Securimage Test Script</title><br /></head><br /><br /><body><br /><br /><h2>Securimage Test Script</h2><br /><p><br /> This script will test your PHP installation to see if Securimage will run on your server.<br /></p><br /><br /><ul><br /> <li><br /> <strong>GD Support:</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">= </span><span style="color: #0000BB">extension_loaded</span><span style="color: #007700">(</span><span style="color: #DD0000">'gd'</span><span style="color: #007700">)); </span><span style="color: #0000BB">?><br /></span> </li><br /> <span style="color: #0000BB"><?php </span><span style="color: #007700">if (</span><span style="color: #0000BB">$gd_support</span><span style="color: #007700">) </span><span style="color: #0000BB">$gd_info </span><span style="color: #007700">= </span><span style="color: #0000BB">gd_info</span><span style="color: #007700">(); else </span><span style="color: #0000BB">$gd_info </span><span style="color: #007700">= array(); </span><span style="color: #0000BB">?><br /></span> <span style="color: #0000BB"><?php </span><span style="color: #007700">if (</span><span style="color: #0000BB">$gd_support</span><span style="color: #007700">): </span><span style="color: #0000BB">?><br /></span> <li><br /> <strong>GD Version:</strong><br /> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'GD Version'</span><span style="color: #007700">]; </span><span style="color: #0000BB">?><br /></span> </li><br /> <span style="color: #0000BB"><?php </span><span style="color: #007700">endif; </span><span style="color: #0000BB">?><br /></span> <li><br /> <strong>TTF Support (FreeType):</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'FreeType Support'</span><span style="color: #007700">]); </span><span style="color: #0000BB">?><br /></span> <span style="color: #0000BB"><?php </span><span style="color: #007700">if (</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'FreeType Support'</span><span style="color: #007700">] == </span><span style="color: #0000BB">false</span><span style="color: #007700">): </span><span style="color: #0000BB">?><br /></span> <br />No FreeType support. Cannot use TTF fonts, but you can use GD fonts<br /> <span style="color: #0000BB"><?php </span><span style="color: #007700">endif; </span><span style="color: #0000BB">?><br /></span> </li> <br /> <li><br /> <strong>JPEG Support:</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'JPG Support'</span><span style="color: #007700">]); </span><span style="color: #0000BB">?><br /></span> </li><br /> <li><br /> <strong>PNG Support:</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'PNG Support'</span><span style="color: #007700">]); </span><span style="color: #0000BB">?><br /></span> </li><br /> <li><br /> <strong>GIF Read Support:</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'GIF Read Support'</span><span style="color: #007700">]); </span><span style="color: #0000BB">?><br /></span> </li><br /> <li><br /> <strong>GIF Create Support:</strong><br /> <span style="color: #0000BB"><?php print_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$gd_support </span><span style="color: #007700">&& </span><span style="color: #0000BB">$gd_info</span><span style="color: #007700">[</span><span style="color: #DD0000">'GIF Create Support'</span><span style="color: #007700">]); </span><span style="color: #0000BB">?><br /></span> </li><br /> <br /></ul><br /><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">if (</span><span style="color: #0000BB">$gd_support</span><span style="color: #007700">): </span><span style="color: #0000BB">?><br /></span>Since you can see this...<br /><br /><br /><img src="<span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'PHP_SELF'</span><span style="color: #007700">]; </span><span style="color: #0000BB">?></span>?testimage=1" alt="Test Image" align="bottom" /><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">else: </span><span style="color: #0000BB">?><br /></span>Based on the requirements, you do not have what it takes to run Securimage :(<br /><span style="color: #0000BB"><?php </span><span style="color: #007700">endif; </span><span style="color: #0000BB">?><br /></span><br /></body><br /></html><br /></span>
|
|
</code> |