Example:
$query = $connection->query("SELECT `password` FROM `users` WHERE `userID` = ".$_SESSION['user'].";") or die("error in the query");
if (mysql_num_rows($query) < 1) {
die("Error: no such user");
}
while ($row = $query->fetch_assoc()) {
if ($row['password'] != $_SESSION['pass']) {
die("Error: incorrect password");
}
}
The above code is my only protection in a PHP script. Is there anything else that can make it more secure? I know that the $_SESSION array can not be changed on the client side. So in my opinion it should be enough. The session is controlled by WordPress.