我已经为前端创建了注册表单,并在wordpress中创建了用于存储详细信息的表。 现在我想登录表单
我已创建登录表单
<?php
/**
* Template Name: Login
*/
get_header(); ?>
<!-- Login -->
<div class="login">
<h2>Login</h2>
<form name="login_form" method="post" action="<?php echo get_stylesheet_directory_uri(); ?>/login_action.php">
<table>
<tbody>
<tr>
<td>User Name : </td>
<td><input type="text" name="user_name"></td>
</tr>
<tr>
<td>Password : </td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" value="Login"></td>
</tr>
</tbody>
</table>
</form>
</div>
<?php get_footer(); ?>
和login_action.php
<?php
include '../../../wp-load.php';
if (isset($_POST['user_name'])&& isset($_POST['password'])) {
$username=$_POST['user_name'];
$password=$_POST['password'];
$sql = "SELECT * FROM wp_profile WHERE name ='$username'";
$results = $wpdb->get_results($sql) or die(mysql_error());
foreach( $results as $result ) {
if($password==$result->password){
$status="found";
}
else{
$status="notfound";
}
}
?>
现在从这个成功登录后我想调用另一个php file.how来调用它?
答案 0 :(得分:2)
在$status-"found"
:
header("Location: /path/to/file");
exit();