Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $host="bakkerijdeclercq.be.mysql"; // Host name
- $Gebruikersnaam="Gebruikersnaam"; // Mysql username
- $Wachtwoord="Wachtwoord"; // Mysql password
- $db_name="bakkerijdeclerc"; // Database name
- $tbl_name="Gegevens"; // Table name
- // Connect to server and select databse.
- mysql_connect( "bakkerijdeclercq.be.mysql", "bakkerijdeclerc", "pssword") or die ('ERROR: ' .mysql_error());
- mysql_select_db( "bakkerijdeclerc" );
- // username and password sent from form
- $Gebruikersnaam=$_POST['Gebruikersnaam'];
- $Wachtwoord=$_POST['Wachtwoord'];
- // To protect MySQL injection
- $Gebruikersnaam = stripslashes($Gebruikersnaam);
- $Wachtwoord = stripslashes($Wachtwoord);
- $Gebruikersnaam = mysql_real_escape_string($Gebruikersnaam);
- $Wachtwoord = mysql_real_escape_string($Wachtwoord);
- $sql="SELECT * FROM $tbl_name WHERE Gebruikersnaam='$Gebruikersnaam' and Wachtwoord='$Wachtwoord'";
- $result=mysql_query($sql);
- // Mysql_num_row is counting table row
- $count=mysql_num_rows($result);
- // If result matched $Gebruikersnaam and $Wachtwoord, table row must be 1 row
- if($count==1){
- // Register $Gebruikersnaam, $Wachtwoord and redirect to file "login_succes.php"
- $_SESSION['logedin'] = true;
- $_SESSION['username'] = $Gebruikersnaam;
- header("location:gelukt.php");
- }
- else {
- header("location:niet_gelukt.php");
- }
- ob_end_flush();
- ?>
Add Comment
Please, Sign In to add comment