Kan er iemand me nog tips geven hoe ik deze script om aan te melden kan beveiligen?
<?php
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("<center>Kan niet verbinden met de database.</center>");
mysql_select_db("$db_name")or die("Kan geen databank selecteren.");
// username and password sent from form
$email=$_POST['email'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection
$email = stripslashes($email);
$mypassword = stripslashes($mypassword);
$email = mysql_real_escape_string($email);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE email='$email' and wachtwoord='$mypassword'";
$result=mysql_query($sql);
$row_Recordset1 = mysql_fetch_assoc($result);
$gebruiker = $row_Recordset1['voornaam'];
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $email and $mypassword, table row must be 1 row
if($count==1){
// Register $email, $mypassword and redirect to file "login_success.php"
session_start();
$_SESSION["email"] = $email;
$_SESSION["mypassword"] = $mypassword;
$_SESSION["voornaam"] = $gebruiker;
header("location:login_success.php");
}
else {
require("header.php");
echo "<center>Verkeerd email of wachtwoord.</center>";
}
?>
Mvg
1.297 views