mibew/site/login/login/server_test.php
2009-06-05 18:06:09 +00:00

3 lines
20 KiB
PHP

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