Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* --- formularz.php --- */
- <form action="check.php" method="post" name="formularz">
- <table>
- <tr>
- <td class="left">Nick:</td>
- <td><input type="text" class="input1" name="nick" maxlength="21"></td>
- </tr>
- <tr>
- <td class="left">Password</td>
- <td> <input type="text" class="input1" name="password" maxlength="21"></td>
- </tr>
- <tr>
- <td class="left">Password again:</td>
- <td><input type="text" class="input1" name="password2" maxlength="21"></td>
- </tr>
- <tr>
- <td class="left">E-mail:</td>
- <td><input type="text" class="input1" name="email" maxlength="21"></td>
- </tr>
- <tr>
- <td class="submit" colspan="2"><input type="submit" value="Submit" class="submit"></td>
- </tr>
- </table>
- </form>
- /* --- index.php --- */
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <link rel="Stylesheet" type="text/css" href="style.css" />
- <title>Sprawdzanie poprawnosci formularza</title>
- </head>
- <body>
- <?php
- include("check.php");
- include("formularz.php");
- ?>
- </body>
- </html>
- /* --- check.php --- */
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <link rel="Stylesheet" type="text/css" href="style.css" />
- </head>
- <body>
- <?php
- if (($_SERVER['REQUEST_METHOD'] == 'POST')) {// wejście postem
- $nick = $_POST['nick'];
- $password = $_POST['password'];
- $password2 = $_POST['password2'];
- $email = $_POST['email'];
- /* --- EMAIL --- */
- if(empty ($email))
- echo "Pole mail nie może być puste!<br>";
- else{
- if(!strstr($email,'@') || strlen($email)<7)
- echo "Nie poprawny adres email!<br>";
- else
- echo "Twoj mail $email<br>";
- }
- /* --- NICK --- */
- if(empty($nick))
- echo "Pole nick nie może być puste!<br>";
- else{
- if(strlen($nick)<4)
- echo "Nick powinien posiadać przynajmniej 4 znaki!<br>";
- else
- echo "Twój nick to: $nick<br>";
- }
- /* --- HASLO --- */
- if(empty($password))
- echo "Hasło nie może być puste!<br";
- else{
- if (strlen($password)<6)
- echo "Hasło powinno posiadać przynajmniej 6 znaków!<br>";
- else{
- if(strcmp($password,$password2) != 0)
- echo "Podane hasla różnią się!<br>";
- else
- echo "Twoje haslo to: $password<br>";
- }
- }
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment