Jump to content

can't get securimage captcha to work outside securimage folder


jlodwick

Recommended Posts

My form works within the secureimage folder but when I try to use the code on securimage's website to place my file outside the securimage folder it does not work. Below is my code relevant to the securimage captcha.  Please let me know if you need to see more of my code.

 

This works when my php form is in the securimage folder:

 

<?

include_once 'securimage.php';

$securimage = new Securimage();

?>

 

<img id="captcha" src="securimage_show.php" alt="CAPTCHA Image" />

<br>

<br>

<br>

<object type="application/x-shockwave-flash" data="securimage_play.swf?audio_file=securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" width="32" height="32">

 

<param name="movie" value="securimage_play.swf?audio_file=securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" />

 

</object>

&nbsp

<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('captcha').src = 'securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="images/refresh.png" alt="Reload Image" onclick="this.blur()" align="bottom" border="0"></a><br />

 

    <strong>Enter Code*:</strong><br />

<?

if ($securimage->check($_POST['captcha_code']) == false)

{ echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>The security code entered was incorrect.</b></span><br /><br />";

echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>Please go</b></span> <a href='javascript:history.go(-1)'><span style='font-family:Verdana; font-size: 12px; color: red;'><b>back</b></span></a> and try again.";

exit;}

?>   

 

This does not work with my php form outside the securimage folder:

 

<?

include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

$securimage = new Securimage();

?>

 

<img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" />

<br>

<br>

<br>

<object type="application/x-shockwave-flash" data="/securimage/securimage_play.swf?audio_file=/securimage/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" width="32" height="32">

 

<param name="movie" value="/securimage/securimage_play.swf?audio_file=/securimage/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" />

 

</object>

&nbsp

<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="images/refresh.png" alt="Reload Image" onclick="this.blur()" align="bottom" border="0"></a><br />

 

    <strong>Enter Code*:</strong><br />

<?

if ($securimage->check($_POST['captcha_code']) == false)

{ echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>The security code entered was incorrect.</b></span><br /><br />";

echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>Please go</b></span> <a href='javascript:history.go(-1)'><span style='font-family:Verdana; font-size: 12px; color: red;'><b>back</b></span></a> and try again.";

exit;}

?>   

Well I figured out how to get it to work but it's kind of frustrating.  If I remove the first slash out of everything and remove "$_SERVER['DOCUMENT_ROOT'] . " it works.  Below shows my new code that works.  :wtf:

 

<?

include_once 'securimage/securimage.php';

$securimage = new Securimage();

?>

 

<img id="captcha" src="securimage/securimage_show.php" alt="CAPTCHA Image" />

<br>

<br>

<br>

<object type="application/x-shockwave-flash" data="securimage/securimage_play.swf?audio_file=securimage/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" width="32" height="32">

 

<param name="movie" value="securimage/securimage_play.swf?audio_file=securimage/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" />

 

</object>

&nbsp

<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('captcha').src = 'securimage/securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="securimage/images/refresh.png" alt="Reload Image" onclick="this.blur()" align="bottom" border="0"></a><br />

 

    <strong>Enter Code*:</strong><br />

<?

if ($securimage->check($_POST['captcha_code']) == false)

{ echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>The security code entered was incorrect.</b></span><br /><br />";

echo "<span style='font-family:Verdana; font-size: 12px; color: red;'><b>Please go</b></span> <a href='javascript:history.go(-1)'><span style='font-family:Verdana; font-size: 12px; color: red;'><b>back</b></span></a> and try again.";

exit;}

?>   

    <input type="text" name="ct_captcha" size="12" maxlength="8" />

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.