This topic is locked
[SOLVED]

 Can I use CAPTCHA in my login screen?

6/12/2008 8:02:26 AM
PHPRunner General questions
T
thesofa author

Can I?

If so, How?

TIA

T
thesofa author 6/13/2008

57 peeps have read this, can no-one help me please?

So many sites now use Captcha as part of the login process, has no-one been able to get it sorted for the login screen?

S
swanside 6/14/2008

57 peeps have read this, can no-one help me please?

So many sites now use Captcha as part of the login process, has no-one been able to get it sorted for the login screen?


A lot of sites use it to register, as it stops the bots getting into the sites.
Once registared there is no need to use the captcha.
Unless I am mistaken, if so, Put up a url of a site that uses it once you have regitesterd

X
xliner 6/14/2008

Can I?

If so, How?

TIA


Hello,
I am absolutely sure that SERGEY´s team is able to something similar to the following login code changes to be used on the HK competition product. HTH Hajo
quote
I have altered the login.php file in both the graphical and text templates to enable CAPTCHA on the login page with 3 sets of replacements as below:-

  1. --------------------------

    After the first occurrence of:-
    $bValidate = TRUE;
    Insert the following:-
    // Get captcha value

    $captcha = ew_StripSlashes(@$_POST["captcha"]);
    // Check captcha value from form

    if ($captcha <> $_SESSION["EW_CAPTCHA_CODE"]) { // Captcha unmatched

    $_SESSION[EW_SESSION_MESSAGE] = "Please enter the validation code shown"; // Set message

    $bValidate = FALSE; // Reset action, do not login if captcha unmatched

    }
  2. ---------------------------

    Replace the javascript function:-
    function ew_ValidateForm(fobj) {

    if (!ew_HasValue(fobj.username)) {

    if (!ew_OnError(fobj.username, "<!--##@EnterUid##-->"))

    return false;

    }

    if (!ew_HasValue(fobj.password)) {

    if (!ew_OnError(fobj.password, "<!--##@EnterPwd##-->"))

    return false;

    }

    return true;

    }
    With the following function:-
    function ew_ValidateForm(fobj) {

    if (!ew_HasValue(fobj.username)) {

    if (!ew_OnError(fobj.username, "<!--##@EnterUid##-->"))

    return false;

    }

    if (!ew_HasValue(fobj.password)) {

    if (!ew_OnError(fobj.password, "<!--##@EnterPwd##-->"))

    return false;

    }

    if (fobj.captcha && !ew_HasValue(fobj.captcha)) {

    if (!ew_OnError(fobj.captcha, "Please enter the validation code shown"))

    return false;

    }

    return true;

    }
  3. ---------------------------

    Replace the line:-
    <td colspan="2" align="center"><span class="phpmaker"><input type="submit" name="submit" id="submit" value="<!--##=ewBtnCaption(LANG.Phrase("Login"))##-->"></span></td>
    With the following lines:-
    <td colspan="2" align="center">

    <!-- captcha html (begin) -->

    <table>

    <tr>

    <td>

    <?php

    if (phpversion() < "4.3.2") {

    echo "<p class=\"ewmsg\">Warning: CAPTCHA extension is enabled but PHP version on this server is " . phpversion() . " only. The extension requires PHP >= 4.3.2.</p>";

    }

    ?>

    <div><img src="ewcaptcha.php" alt="Security Image" width="130" height="40" /></div>
    <span class="phpmaker">Please enter the validation code shown<span class='ewmsg'>&nbsp;*</span></span>
    <input type="text" name="captcha" id="captcha" size="30">

    </td>

    </tr>

    </table>



<!-- captcha html (end) -->

<span class="phpmaker"><input type="submit" name="submit" id="submit" value="<!--##=ewBtnCaption(LANG.Phrase("Login"))##-->"></span></td>
unquote