Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $count = 0;
- $serchNumb = 0;
- $userNumb = 0;
- if( isset($_POST['submit'])){
- $serchNumb = $_POST['serchNumb']+0;
- $count = $_POST['count']+0;
- $count++;
- } else {
- $serchNumb = rand(1, 100);
- }
- if (isset($_POST['reset'])){
- $serchNumb = rand(1, 100);
- $count = 0;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Insert title here</title>
- </head>
- <body>
- <form action="./httHpm.php" method="post">
- <label for="">Try to guess?!?!</label>
- <br/>
- <input type="number" name="userNumb" />
- <input type="hidden" name="count" value="<?= $count ?>" />
- <input type="hidden" name="serchNumb" value="<?= $serchNumb ?>" />
- <br/>
- <input type="submit" name="submit" value="click!" />
- <br/>
- <?php
- if (isset($_POST['userNumb']) && is_numeric($_POST['userNumb']) ){
- $userNumb = $_POST['userNumb']+0;
- if ($userNumb === $serchNumb){
- echo "<strong>Bravo, nameri chisloto!</strong> Uspeshno otkri chisloto za " . $count . " hoda!";
- echo "<br/>";
- echo " Sega opitaj da poznaesh novot ochislo ! :)";
- ?>
- <br>
- <input type="submit" name="reset" value="Try again!" />
- <?php
- echo "<br/>";
- }
- if ($userNumb > $serchNumb){
- echo "Opitai pak, chisloto e nadolu !";
- }
- if ($userNumb < $serchNumb){
- echo "Opitaj pak, Chisloto e nagore!" ;
- }
- }
- ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement