I'm trying to make a login form, but select query isn't working. Is there another syntax in WordPress and in which way is password hashed? My code is:
if ( isset( $_POST['submit'] ) ) {
if ( !$_POST['username'] ) {
echo "You did not complete all of the required fields";
} else {
$username=$_POST['username'];
$password=$_POST['password'];
$query = $wpdb->get_row( "SELECT * FROM $wpdb->wp_users
WHERE user_login='@admin' && user_pass = 'some_pass'" );
if ( $query != null ) {
echo "Login success";
return true;
} else {
echo "incorrect pass or user";
return false;
}
}
}
?>
<form action="" method="post"/>
<input type="text" name="username" placeholder="Username"/>
<input type="text" name="password" placeholder="Password"/><br>
<input type="submit" name="submit" value="Submit">
</form>