Login page not working

+1 Osaretin Ogbebor · August 18, 2014
Hello Community,

I have followed the php user login videos and I not getting the login to work properly. I' m using wordpress as my CMS and have the template properly installed in MySQL database. I have an init.php, connection.php, login.php and all other necessary functions that the video tutorials provide but can't seem to get the login.php to be called as the "action" portion of my form. 

Please Advise.

Thanks in advance.

Here is my code:

<form role="form" action="login.php" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" name="email">
</div>

<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
</div>

<a class="btn btn-merchants btn-lg" href="http://flavorping.com/sign-up/">Not a member? Join Us</a>

<button type="submit" class="btn btn-primary">Log In</button>
</form>

Post a Reply

Replies

Oldest  Newest  Rating
0 Sachin Kumar · August 19, 2014
i dont get it....i mean do u want to create a login page with ur own php code or do u wanna use wordpress login system?? :3
0 JOhaL jaTT · August 19, 2014
which type error did you get?
0 Osaretin Ogbebor · August 20, 2014
Yes I want to create my own login page and then give users their own dashboard page. I do not want to use the Wordpress login.

I don't get any errors. The error messages don't print out any where on the page and just redirect me. The only part of the login php that works for me when I push submit is the redirect. I even type in the wrong email and password and it still redirect me but I don't know if it logs me in.

I don't have the form in a widget like it has it in the tutorial, could that be the problem? I have the login in form in the middle of the page.

Thanks 
0 Shamal Sandeep · August 20, 2014
<form action="./login.php" method="post">

Try like this.
0 Chathula Sampath · August 20, 2014
you must post login.php codes to check what is the problem...
0 Jasmin Bakalović · August 20, 2014
In your code here, action in form is on "login.php" but on your website is on "index.php". Check that.

If this is not a problem, post your code from login.php to see what is wrong.

P.S: Optimize your website for all browsers.
0 Osaretin Ogbebor · August 20, 2014
Okay I have placed the login php in the page itself but the errors aren't showing. Now my code looks something like this. 


<?php

include('http://www.flavorping.com/wp-content/theme/Revera Child/parts/init.php');

if (empty($_POST) === false){
$email = $_POST['email'];
$password = $_POST['password'];

if (empty($email) === true || empty($password)  === true){
$errors[] = 'Please enter a valid email and password.';
} else if (user_exists($email) === false){
$errors[] = 'We can\'t find that email. Have you registered?';
} else if (user_active($email) ===false){
$errors[] = 'You haven\'t activated your account. Please check your email and activate account.';
} else {
$login = login ($email, $password);
if ($login === false){
$errors[] = 'That email and password combination is incorrect';
} else 
//set the user session
$_SESSION['user_id'] = $login;
//redirect to user home
header('Location: http://www.flavorping.com/');
exit();

}

?>

<div class="row">
<div class="tan-one-background-square">
<form role="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" name="email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
</div>
<a class="btn btn-merchants btn-lg" href="http://flavorping.com/sign-up/">Not a member? Join Us</a>

<button type="submit" class="btn btn-primary">Log In</button>
</form>

</div>
  • 1

PHP

107,167 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators