Tutorial Webpage for

Lecture Cloud- and Web-Technologies

Loading...

Configuration

Login

Please use user and password as given in the lecture! Please copy the editor's content, as it will be lost due to reloading of the page for the purpose of login.

Username:

Password:

PHP - Simple Captcha

A captcha (short for 'Completely Automated Public Turing test to tell Computers and Humans Apart') is a type of challenge-response test used in computing to determine whether or not the user is human in order to e.g. prevent agent programs to misuse services provided at the web.
Write PHP code generating a simple captcha. The simple captcha should randomly formulate a simple question like what is the result of a simple math equation (e.g., what is the sum of 2 and 5?). There should be a text field in which the user can type the answer. Afterwards the answer is checked for correctness (via Javascript) and in case of success a 'Congratulations!' message is displayed.
Remarks:Coding the answer in Javascript could be parsed by agents, which then automatically could pass the captcha check. Hence the check should be executed also at server-side (via e.g. php-code). However, this scenario cannot be handled in this tutorial system...

Editor

Please use the following editor for your exercise. You can run the content of the editor by clicking on the tab 'Run'...

Output of Editor Content

The result of running the editor content is as follows:

Output of the Solution

The output of the solution is as follows:

Solution

Please have a look at the solution only after you have finished working on your own solution. Otherwise the learn effect is much less.