jlodwick Posted April 18, 2012 Share Posted April 18, 2012 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>   <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>   <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;} ?> Quote Link to comment https://forums.phpfreaks.com/topic/261153-cant-get-securimage-captcha-to-work-outside-securimage-folder/ Share on other sites More sharing options...
jlodwick Posted April 18, 2012 Author Share Posted April 18, 2012 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. <? 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>   <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" /> Quote Link to comment https://forums.phpfreaks.com/topic/261153-cant-get-securimage-captcha-to-work-outside-securimage-folder/#findComment-1338613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.