You are here: Re: how to verify the code? « PHP Programming Language « IT news, forums, messages
Re: how to verify the code?

Posted by ptdorf on 09/16/07 14:30

> Now I can make my webpage generates a random combination. All I need
> next is to creat a text area to compare with the randon code
> generated, as what I said in my first article.

something like this:

<!-- create the form -->

<form method="POST">
Please, write down the following code: <?php
$code = Pass(4);
$_SESSION['Captcha'] = $code;
echo $code; ?>
<input type="text" name="code" />
<input type="submit" />
</form>

<!-- check the code -->
<?php

$valid = 0;
if (isset($_POST['code'])) {
if (isset($_SESSION['code'])) {
$valid = $_POST['code'] == $_SESSION['code'];
}
}
echo 'The code is ', ($valid ? 'valid' : 'invalid');
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация