How can I check captcha with PHP?

Check captcha with lower and uppercase characters in php

  • I use codeigniter, i want make valid data for captcha, if captcha is mixed of lower and uppercase characters, user should insert in input like it lower or uppercase or mixed they. in following code i tried it, but it don't check lower and uppercase characters, how can fix it? my captcha image is as: dAwVJ //$cap = $this->input->post('captcha'); $cap = 'dAwVJ';// if i change this to dawvj return(output) is true, i don't want this // Then see if a captcha exists: $sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?"; $binds = array( $cap, $this->input->ip_address(), $expiration ); $query = $this->db->query($sql, $binds); $row = $query->row(); if ($row->count == 0) { return false; } else { return true; }

  • Answer:

    $sql = "SELECT COUNT(*) AS count FROM captcha WHERE BINARY word = ? AND ip_address = ? AND captcha_time > ?";

Kate Wintz at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

try this sql: $sql = "SELECT COUNT(*) AS count FROM captcha WHERE binary word = ? AND ip_address = ? AND captcha_time > ?";

Joel

You mean case sensitive string comparison in mysql? I think it would be something like this: WHERE word like binary ? Since you are using codeigniter, this may be useful: http://stackoverflow.com/questions/2538114/mysql-case-sensitive-compare-through-codeigniter

Bao Nhan

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.