Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $v1 = rand(1,5);
  4. $v2 = rand(1,5);
  5. $_SESSION['soma'] = $v1+$v2;
  6.  
  7. if(isset($_POST['submit'])=="submit") {
  8. extract($_POST);
  9.  
  10. if($soma==$hidden) {
  11. echo "CORRETO";
  12. } else {
  13. echo "ERRADO";
  14. }
  15.  
  16. }
  17. ?>
  18.  
  19. <form action="" method="post">
  20. Soma: <?php echo "$v1+$v2="; ?>
  21. <input type="hidden" name="hidden" value="<?php echo $_SESSION['soma']; ?>">
  22. <input type="text" name="soma" value="" size="3">
  23. <input type="submit" name="submit">
  24. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement