
נכתב במקור על ידי
gts2
index.php:
<?php
if (array_key_exists('username', $_POST) and array_key_exists('password', $_POST)) {
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$result = $mysqli->mysqli_query("SELECT * FROM Users WHERE `username`='".$_POST['username']."' AND `password`='".$_POST['password']."'");
if ($result->field_count > 0) {
echo 'Logged successfully!';
}
} else {
?>
<form action="index.php" method="post">
<input type="text" name="username">
<input type="text" name="password">
<input type="submit" value="Login Now">
</form>
<?php
}