|
1 | 1 | <?php
|
| 2 | +include"db.php"; |
2 | 3 |
|
| 4 | +$username = $password = $confirmPassword = ""; |
| 5 | +$username_err = $password_err = $confirmPassword_err = ""; |
3 | 6 | if ( isset($_POST['completed']) ) {
|
4 | 7 | //un champ obligatoire
|
5 | 8 | if ( !empty($_POST['username']) )
|
|
12 | 15 | }
|
13 | 16 |
|
14 | 17 | if ( !empty($_POST['email'])){
|
15 |
| - if (filter_var($email, FILTER_VALIDATE_EMAIL)) { |
16 | 18 | $email = trim($_POST['email']) ;
|
17 |
| - } |
18 | 19 | }
|
19 | 20 | else
|
20 | 21 | {
|
21 | 22 | $mistakes['email'] = true;
|
22 | 23 | }
|
23 | 24 |
|
24 | 25 |
|
25 |
| - if ( !empty($_POST['password']) AND isset($_POST['confirmPassword'])){ |
26 |
| - if ($_POST["password"]== $_POST["confirmPassword"]) { |
| 26 | + if ( !empty($_POST['password']) AND isset($_POST['cpassword'])){ |
| 27 | + if ($_POST["password"]== $_POST["cpassword"]) { |
27 | 28 | $password = trim($_POST['password']);
|
28 | 29 | $passhash = sha1($password);
|
29 | 30 | }
|
|
76 | 77 | <link rel="stylesheet" href="Custom/css/login.css">
|
77 | 78 | </head>
|
78 | 79 | <body>
|
| 80 | + <h1>Registration</h1> |
79 | 81 |
|
80 |
| - <form method="POST" class='login-form' action="signin.php"> |
| 82 | + <form method="post" class='login-form' action="signin.php"> |
81 | 83 |
|
82 | 84 | <div class="flex-row">
|
83 | 85 | <label class="lf--label" for="username">
|
84 | 86 | <svg x="0px" y="0px" width="12px" height="13px">
|
85 | 87 | <path fill="#B1B7C4" d="M8.9,7.2C9,6.9,9,6.7,9,6.5v-4C9,1.1,7.9,0,6.5,0h-1C4.1,0,3,1.1,3,2.5v4c0,0.2,0,0.4,0.1,0.7 C1.3,7.8,0,9.5,0,11.5V13h12v-1.5C12,9.5,10.7,7.8,8.9,7.2z M4,2.5C4,1.7,4.7,1,5.5,1h1C7.3,1,8,1.7,8,2.5v4c0,0.2,0,0.4-0.1,0.6 l0.1,0L7.9,7.3C7.6,7.8,7.1,8.2,6.5,8.2h-1c-0.6,0-1.1-0.4-1.4-0.9L4.1,7.1l0.1,0C4,6.9,4,6.7,4,6.5V2.5z M11,12H1v-0.5 c0-1.6,1-2.9,2.4-3.4c0.5,0.7,1.2,1.1,2.1,1.1h1c0.8,0,1.6-0.4,2.1-1.1C10,8.5,11,9.9,11,11.5V12z"/>
|
86 | 88 | </svg>
|
87 | 89 | </label>
|
88 |
| - <input id="username" name="username" class='lf--input' placeholder='Username' type='text' |
89 |
| - <?php if(isset($username)) echo 'value="',$username,'"';?>> |
| 90 | + <input type="text" name="username" class="lf--input" id="username" required="" placeholder="Username"> |
90 | 91 | </div>
|
91 | 92 |
|
92 | 93 | <div class="flex-row">
|
|
95 | 96 | <path fill="#B1B7C4" d="M8.9,7.2C9,6.9,9,6.7,9,6.5v-4C9,1.1,7.9,0,6.5,0h-1C4.1,0,3,1.1,3,2.5v4c0,0.2,0,0.4,0.1,0.7 C1.3,7.8,0,9.5,0,11.5V13h12v-1.5C12,9.5,10.7,7.8,8.9,7.2z M4,2.5C4,1.7,4.7,1,5.5,1h1C7.3,1,8,1.7,8,2.5v4c0,0.2,0,0.4-0.1,0.6 l0.1,0L7.9,7.3C7.6,7.8,7.1,8.2,6.5,8.2h-1c-0.6,0-1.1-0.4-1.4-0.9L4.1,7.1l0.1,0C4,6.9,4,6.7,4,6.5V2.5z M11,12H1v-0.5 c0-1.6,1-2.9,2.4-3.4c0.5,0.7,1.2,1.1,2.1,1.1h1c0.8,0,1.6-0.4,2.1-1.1C10,8.5,11,9.9,11,11.5V12z"/>
|
96 | 97 | </svg>
|
97 | 98 | </label>
|
98 |
| - <input id="email" name="email" class='lf--input' placeholder='Email' type='text' |
99 |
| - <?php if(isset($email)) echo 'value="',$email,'"';?>> |
| 99 | + <input type="email" name="email" class="lf--input" id="email" required="" placeholder="Email"> |
100 | 100 | </div>
|
101 | 101 |
|
102 | 102 | <div class="flex-row">
|
|
107 | 107 | </g>
|
108 | 108 | </svg>
|
109 | 109 | </label>
|
110 |
| - <input id="password" name="password" class='lf--input' placeholder='Password' type='password' |
111 |
| - <?php if(isset($password)) echo 'value="',$password,'"';?>> |
| 110 | + <input type="password" name="password" class="lf--input" id="password" required="" placeholder="Password"> |
112 | 111 | </div>
|
113 | 112 |
|
114 | 113 | <div class="flex-row">
|
|
119 | 118 | </g>
|
120 | 119 | </svg>
|
121 | 120 | </label>
|
122 |
| - <input id="confirmPassword" name="confirmPassword" class='lf--input' placeholder='Confirm the password' type='password' |
123 |
| - <?php if(isset($confirmPassword)) echo 'value="',$confirmPassword,'"';?>> |
| 121 | + <input type="password" name="cpassword" class="lf--input" id="cpassword" required="" placeholder="Password confirmation"> |
124 | 122 | </div>
|
125 | 123 |
|
126 | 124 | <input class='lf--submit' type='submit' name="completed" value='SIGN IN'>
|
|
0 commit comments