akiyamaSM / laravel-5-Captcha

This is very simple and lightweight mathematical captcha class. You can easily configure it in your laravel 5 project

Home Page:http://learn24bd.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

laravel-5-Captcha

This is very simple and lightweight mathematical captcha class. You can easily configure it in your laravel 5 project.

Documentation

  1. First download the Mc.php file and put this file in your App/Http/Controllers directory
  2. Now in your controller method implement like as
public function index()
  {
  	Mc::putMcData();
  	$question=Mc::getMcQuestion();
  	return view('test',compact('question'));
  }
  1. In your view
  <p>Question: {{$question}}</p>
  		<form action="{{route('postTestRoute')}}" method="POST">
  			<input type="hidden" name="_token" value="{{ csrf_token() }}">
  			<p>Put your answer: <input type="text" name="answer"></p>
  			<input type="submit">
  		</form>
  	</div>
  ```
  ![alt tag](https://raw.githubusercontent.com/haruncpi/laravel-5-Captcha/master/screenshot/mc-view.jpg)
  
4. Now check the given captcha is right or wrong in your controller method.
    
   ```PHP
    public function postMc()
	 {
		$answer=Input::get('answer');
		if($answer==Mc::getMcAnswer())
		 {
			return "Correct answer";
		 }
		else
		 {
			return "Incorrect";
		 }
	 }

About

This is very simple and lightweight mathematical captcha class. You can easily configure it in your laravel 5 project

http://learn24bd.com


Languages

Language:PHP 100.0%