PHP gevorderde |
|
edit: lol.. beetje laat
<form method='post' action=''>
<?php
if (isset($_SESSION['code']))
{
echo $_SESSION['code'];
}
else
{
$code = rand(9,0).rand(9,0).rand(9,0);
echo $code;
$_SESSION['code'] = $code;
}
?>
<input type='text' name='key' value='' />
<input type='submit' name='submit' value='Check' />
</form>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if($_POST['key'] == $_SESSION['code'])
{
echo 'Code is correct';
}
else
{
echo 'Code is NOT correct';
}
}
?>
<form method='post' action=''> <?php if (isset($_SESSION['code'])) { } else { $_SESSION['code'] = $code; } ?> <input type='text' name='key' value='' /> <input type='submit' name='submit' value='Check' /> </form> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { if($_POST['key'] == $_SESSION['code']) { } else { echo 'Code is NOT correct'; } } ?>
zo zou het dan wel werken toch?:p |