pushing again due to previous error.
[10elotto.git] / index.php
CommitLineData
77721193 1<?php
10f3aa54 2function generator($howmany = 6) {
3 $numbers = array();
4 $i = 0;
5 $max = $howmany - 1;
6
7 while ($i <= $max) {
8 $rnd_num = random_int(1, 90);
9 if (! in_array($rnd_num, $numbers)) {
10 $numbers[] = $rnd_num;
11 }
12 $i++;
77721193 13 }
10f3aa54 14 sort($numbers);
15 return $numbers;
77721193 16}
77721193 17?>
18<!DOCTYPE html>
19<html lang="it_IT">
20<head>
21 <meta charset="UTF-8">
22 <title>I tuoi numeri fortunati&excl;&excl;</title>
23 <meta name="description" content="">
24 <meta name="viewport" content="width=device-width, initial-scale=1">
25
26 <!-- <link rel="stylesheet" href="assets/style/main.css"> -->
27 <!-- <link rel="icon" sizes="192x192" href="assets/img/favicon.png"> -->
28</head>
29<body>
30 <div id="wrapper">
31 <div id="header">
10f3aa54 32 <header>
33 <h1>GET LUCKY&excl;</h1>
34 <h2>generatore di numeri fortunati</h2>
35 </header>
36 </div> <!-- #header -->
77721193 37
38 <div id="main" role="main">
39
40 <div id="container">
41 <div id="content">
42 <article>
43 <header>
10f3aa54 44 <h3>Ecco i tuoi numeri</h3>
77721193 45 </header>
10f3aa54 46<?php
47 if (!empty($_POST["howmany"])) {
48 $num = $_POST["howmany"];
49 } else {
50 $num = 6;
51 }
52 $list = generator($num);
53?>
77721193 54 <div class="numbers">
10f3aa54 55 <?php
56 $num = $num -1;
57 for ($i=0; $i <= $num ; $i++) : ?>
58 <div id="<?php echo $i; ?>"><?php echo $list[$i]; ?></div>
59 <?php endfor; ?>
60 </div> <!-- .numbers -->
77721193 61 </article>
10f3aa54 62 </div> <!-- #content -->
77721193 63 </div> <!-- /#container -->
64
10f3aa54 65 <aside class="menu">
66 <form action="" method="POST">
67 <input type="number" min="1" max="10" step="1" name="howmany" required>
68 <input type="submit">
69 </form>
70 </aside>
77721193 71 </div> <!-- /#main -->
72
73 <footer id ="footer">
10f3aa54 74 </footer> <!-- #footer -->
77721193 75 </div> <!-- /#wrapper -->
77721193 76</body>
77</html>