Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- @session_start();
- if($_SERVER["REQUEST_METHOD"] == "POST") {
- // username and password sent from form
- $myusername = mysqli_real_escape_string($db,$_POST['username']);
- $mypassword = mysqli_real_escape_string($db,$_POST['password']);
- $sql = "SELECT id FROM users WHERE nick = '$myusername' and pass = '$mypassword'";
- $result = mysqli_query($db,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $count = mysqli_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- if($count == 1) {
- $_SESSION['login_user'] = $myusername;
- header("location: welcome.php");
- }else {
- $error = "Twoja hasło lub nazwa użytkownika są niepoprawne";
- }
- }
- ?>
- <html>
- <head>
- <style type = "text/css">
- body {
- font-family:Arial, Helvetica, sans-serif;
- font-size:14px;
- }
- label {
- font-weight:bold;
- width:100px;
- font-size:14px;
- }
- .box {
- border:#666666 solid 1px;
- }
- </style>
- </head>
- <body bgcolor = "#FFFFFF">
- <div style = "width:300px; border-right: solid 1px #e2dec8; margin-top: -145px; margin-left: 717px;">
- <div style = "background-color:#3F73BA; color:#fff; padding:8px;"><b>Logowanie</b></div>
- <table>
- <div style = "margin:15px">
- <td>
- <form action = "logowanie.php" method = "post">
- <label>Nazwa użytkownika:</label><input type = "text" name = "username" class = "box"/><br>
- <label>Hasło:</label><br><input type = "password" name = "password" class = "box" /><br/><br /></td>
- <td><input type = "submit" value = " Zaloguj "/></td>
- </form>
- </table>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement