Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- mysql_connect ('localhost', 'robin_1', 'banaan');
- mysql_select_db ('robin_test');
- ?>
- <html>
- <head><link rel="stylesheet" type="text/css" href="style.css" /></head>
- <body>
- <div id="container">
- <?php
- if ( isset($_POST["submit"]) ) {
- if( empty($_POST['username']) or empty($_POST['password']) ) {
- echo 'Oeps, iets vergeten invullen';
- } else {
- $query = mysql_query("SELECT * FROM user WHERE username = '" . $_POST['username'] . "' AND password = '".$_POST['password'] ."' LIMIT 1");
- $_SESSION['username'] = $_POST['username'];
- if(mysql_num_rows($query)==0) {
- echo "jij bestaat niet sukkeltje:)";
- } else {
- $row = mysql_fetch_assoc($query);
- echo "Login succesful. <br />";
- echo $row['username'] . ' en ' . $row['password'];
- }
- }
- }
- ?>
- <form method="post">
- Username: <input type="text" name="username" /><br />
- Password: <input type="password" name="password" /><br />
- <input type="submit" name="submit" value="Log in" />
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement