Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <fieldset>
- <legend>LOG IN</legend>
- <form id="login" name="login" method="POST" action="index.php?pagina=login">
- Username:<input type="text" name="username"/><br />
- Password:<input type="password" name="password"/>
- <input type="submit" name="submit" />
- </form>
- </fieldset>
- <?php
- //include Connect
- include 'connect.php';
- //variabelen
- $submit = ($_POST['submit']);
- $username = ($_POST['username']);
- $password = md5($_POST['password']);
- //LOGIN
- if ($username&&$password)
- {
- $sql_query = mysql_query ("SELECT * FROM user WHERE username='$username'");
- $numrow = mysql_num_rows($sql_query);
- if($numrow!=0)
- {
- while($row = mysql_fetch_array($sql_query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- //check to see if they match
- if($username==$dbusername&&$password==$dbpassword)
- {
- //login succes, SESSIED AANMAKEN
- $_SESSION['recht']=$row['recht'];
- $_SESSION['user_id']=$row['user_id'];
- if($_SESSION['recht']==1)
- {
- header("Location: index.php?pagina=admin");
- }
- if($_SESSION['recht']==2)
- {
- header("Location: index.php?pagina=medewerker");
- }
- if($_SESSION['recht']==3)
- {
- header("Location: index.php?pagina=klant");
- }
- }
- else
- {
- die ("De gegevens Kloppen niet");
- }
- }
- }
- else die ("Deze gebruiker is niet aanwezig in onze Database");
- }
- ?>
Add Comment
Please, Sign In to add comment