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 webpage WHERE username = '$myusername' and passwort = '$mypassword'";
- $sql = "SELECT id FROM webpage WHERE username = '$myusername' and passwort = MD5($mypassword);"
- $result = mysqli_query($db,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $active = $row['active'];
- $count = mysqli_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- if($count == 1) {
- session_register("myusername");
- $_SESSION['login_user'] = $myusername;
- header("location: welcome.php");
- }else {
- $error = "Passwort oder Nutzername falsch!";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement