Hello Reader's!
If you are new to Wordpress and want to make a login custom page, then you can see an example below:-
First you have to create a page on the root, name it login.php
<?php
/*
* Template Name: Sign In
*/
if($_POST['submit'] == 'signin'){
$username = $_POST["username"];
$password = $_POST["password"];
$mysqli=mysqli_connect('localhost','root','admin','wordpress') or die("Database Error");
$sql="SELECT name FROM user WHERE email = '".$username."' and password = '".$password."' ORDER BY name";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error());
if($result)
{
while($row=mysqli_fetch_array($result))
{
echo $row['name']."\n";
}
}
}
get_header(); ?>
<section>
<form method = 'post' action ="#">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" name="submit" value="signin">
</form>
</section>
<?php
get_footer(); ?>
Now publish this page by using the template type = signin
Now as you can see the this page self having the login form and sending the two param username and password to itself. Now we can use mysqli_query function to get the result on this page only and you can code according to you.
![alt text](http://findnerd.s3.amazonaws.com/imagedata/3348/3348.png)
0 Comment(s)