Displaying an error message in PHP [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to display an error message to the user if the credentials entered by them are incorrect(do not return a match with anything in my database), such as in a login form.
What is the easiest way to do that?
Here's what I have till now-
<?php
require 'includes/common.php';
?>
<!DOCTYPE html>
<!--
Login page of Lifestyle Store
-->
<html>
<head>
<title>Log In</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!---- External css file index.css placed in the folder css is linked-->
<link href="css/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<?php
include 'includes/header.php';
?>
<div class="row login">
<div class="col-xs-4"></div>
<div class="col-xs-4">
<div class="panel panel-primary">
<div class="panel-body">
<p class="text-warning">Login to make a purchase-</p>
<form action="login_submit.php" method="POST">
<div class="form-group">
<label for="email">E-mail:</label>
<input type="text" class="form-control" name="email" value="Email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="text" class="form-control" name="password" value="Password">
</div>
</form>
<button class="btn btn-primary" type="submit" name="submit">Log-in</button>
</div>
<div class="panel-footer">Don't have an account? <a class="a2" href="signup.html">Register!</a></div>
</div>
</div>
<div class="col-xs-4"></div>
</div>
<?php
include 'includes/footer.php';
?>
</body>

If you are using mysql to search the database for matches, then use something like below
$email = $mysqli->escape_string($_POST['email']);
$password = $mysqli->escape_string($_POST['password']):
$result = $mysqli->query("SELECT * FROM users WHERE email='$email' AND password='$password'");
//check whether the user exists and redirecting if not exists
if ($result-> num_rows == 0){
$_SESSION['messege']= "You have entered Either Wrong Username or Password ";
header("location: error.php");
}

Related

trying to login using php mysql

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../admin/css/styles.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-2"></div>
<div class="col-lg-6 col-md-8 login-box">
<div class="col-lg-12 login-key">
<i class="fa fa-key" aria-hidden="true"></i>
</div>
<div class="col-lg-12 login-title">
ADMIN PANEL
</div>
<div class="col-lg-12 login-form">
<div class="col-lg-12 login-form">
<form action="" method="POST">
<div class="form-group">
<label class="form-control-label">USERNAME</label>
<input type="text" name="username" class="form-control">
</div>
<div class="form-group">
<label class="form-control-label">PASSWORD</label>
<input type="password" name="password" class="form-control" i>
</div>
<div class="col-lg-12 loginbttm">
<div class="col-lg-6 login-btm login-text">
<!-- Error Message -->
</div>
<div class="col-lg-6 login-btm login-button">
<input type="submit" name="submit" class="btn btn-outline-primary">
</div>
</div>
</form>
</div>
</div>
<div class="col-lg-3 col-md-2"></div>
</div>
</div>
</body>
</html>
<?php
include 'db.php';
if(isset($_POST['submit'])){
$username=$_POST['username'];
$password=$_POST['password'];
$db=mysqli_select_db($conn,"admin");
echo $sql= "SELECT * FROM admin WHERE username='$username' AND password='$password'";
$result=mysqli_query($conn,$sql);
$rows=mysqli_num_rows($result);
if($rows == 1){
echo 'hi';
}
else{
echo 'failed';
}
}
?>
I created database and inserted username and password. Database connected successfully. This is the code i have written for login page. I am entering username and password. I echo the query, its showing username and password but not echoing 'hi'. Its echoing failed. Where is the error. Thanks in advance.
It is because you're echoing the query not actually executing it.
remove this
echo $sql= "SELECT * FROM admin WHERE username='$username' AND password='$password'";
add this
$sql= "SELECT * FROM admin WHERE username='$username' AND password='$password'";
A couple of points to improve the query,
Never SELECT *, It's bad practice, instead mention column names
Use PDO or even better a PDO library (IMO)
Remove echo which is in front of $sql.
Check if you are writing the correct $username and $password in database admin field.
echo the $rows variable. Check if it is different than 1.
Not related to your problem but good to fix; move your PHP code above everything on the code.
maybe you have two couple of equal username and password in database o it return 2 instead of one. echo $rows to check it.

how to generate dynamically html web pages with content, when user hit submit button?

i am working on a project in which user have to ask a question through fill a form. my question is that when user fill the form and ask the question the php automatically generate the html web page. for example if user asks what is stackoverflow then url be like localhost/what-is-stackoverflow , and by clicking on this link this link show the other content which users filled.
here is my code
<?php include("header.php");
require("dbconnect.php");
if(isset($_POST['post'])){
$user_email = $_POST['user_email'];
$user_name = $_POST['user_name'];
$question_title = $_POST['question_title'];
$question_body = $_POST['question_body'];
$question_title = htmlentities($question_title);
$question_body = htmlentities($question_body);
$insert_question = mysqli_query($con,"insert into questions values('','".$user_email."','".$user_name."','".$question_title."','".$question_body."','".php_slug($question_title)."')");
}
function php_slug($question_title)
{
$slug = preg_replace('/[^a-z0-9-]+/','-' , strtolower($question_title));
return $slug;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/styles.css" rel="stylesheet" type="text/css">
<link href="favicon.ico" rel="shortcut icon" type="img/ico">
</head>
<body>
<div class="container">
<div class="col-lg-7 " >
<div class="form-group ">
<form name="submit_question" action="" method="post">
<label for="user_email" class="control-label " > Enter Your Email Address We Will Mail You Answer </label>
<input type="email" class="form-control" name="user_email" placeholder="Enter Your Email We Will Mail You Answer Of Your Question" required/>
<br >
<label for="user_name" class="control-label " > Enter Your Name </label>
<input type="text" class="form-control" name="user_name" placeholder="Enter Your Name" required/>
<br >
<label for="question_title" class="control-label " > Enter Your Question Subject </label>
<input type="text" class="form-control" name="question_title" placeholder="Enter Question Subject" required/>
<br >
<label for="question_body" class="control-label " > Question Body </label>
<textarea class="form-control pull-middle" rows="20" placeholder="Enter Post Content" name="question_body" required/> </textarea>
<div class="btn btn-group pull-right">
<br>
<br>
<button type="submit" class="btn btn-primary" name="post">
<span class="glyphicon glyphicon-plus"></span> Submit Question
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
<script src="js/bootstrap.js" > </script>
<?php include("footer.php");?>
</body>
I think
1. You have to post the all content in your <form action=""> page.
2. Get that all data in variables then replace all special characters like space, ? etc from question with '-'.
3. the create url with this updated question with the url parameters like name, email
$url=localhost/what-is-stackoverflow?email=email#gmail.com&name=abc
4. use .htaccess file to rewrite url
RewriteRule ^(a-zA-z)$ filename [L]
5. redirect to that url with url parameters.
redirect($url,'refresh');
6.on that page get all url parameters.
$myFile = $questiontitle.".html"; // or .php
$fh = fopen($myFile, 'w'); // or die("error");
$stringData = "<html><head><title>".$questionbody."</title></head><body></body></html>";
fwrite($fh, $stringData);
You can create html file and add html content programmatically by php

Find an html element by id and replace its contents with php

I have an html with submit button.
Submit sends you to php.
php code has this:
header("location:./setupOk.html");
$html = file_get_html('setupOk.html');
$ret = $html->find('div[id=valueOk]');
echo $ret[0]->innertext = "foo";
and this is some of my html setupOk.html code:
<form action="http://54.186.92.18/Pixel-Matrix/keys.php" method="post">
<div class="logo">
<link rel="stylesheet" type="text/css" href="styles.css">
<label id="logo"</label>
<!--<label for="name">Type:</label>-->
</div>
<div class="right">
<h1>Enter License Information</h1>
<div id="valueOk">
<input type="text" id="valOk" name="Key" readonly="readonly" />
</div>
</div>
<div class="button">
<button id="validateB" type="submit">Validate Now ></button>
</div>
</form>
After executing button on first html, it goes to php and reloads my html website with setupOk but no text is innered to anywhere. Any solution?
EDIT:
my goal is to have a general html (with label and images) then from php, put text to that html and automatically load this html on user's browser
EDIT2:
MY FIRST HTML ISN'T THE SAME THAN 2ND HTML. FIRST ONE SENDS POST PETITION TO PHP THEN DEPENDING ON THE INFO SENT TO PHP, PHP WILL FILL TEXT TO THE 2ND HTML AND LOAD THIS LAST HTML ON USER'S BROWSER
Avoiding DOMParser and loading/redirecting to HTML page -- you can do it more simple way like (it has to be a PHP file):
<?php
$innerText = "";
if (!empty($_POST['Key'])) {
$innerText = "foo";
}
?>
<div class="logo">
<link rel="stylesheet" type="text/css" href="styles.css">
<label id="logo"</label>
<!--<label for="name">Type:</label>-->
</div>
<div class="right">
<h1>Enter License Information</h1>
<div id="valueOk">
<input type="text" id="valOk" name="Key" readonly="readonly" value="<?php echo $innerText;?>"/>
</div>
</div>
<div class="button">
<button id="validateB" type="submit">Validate Now ></button>
</div>
If you think this is not what you want - please elaborate your need a bit.
UPDATE
setupOk.php
<form action="http://54.186.92.18/Pixel-Matrix/keys.php" method="post">
<div class="logo">
<link rel="stylesheet" type="text/css" href="styles.css">
<label id="logo"</label>
<!--<label for="name">Type:</label>-->
</div>
<div class="right">
<h1>Enter License Information</h1>
<div id="valueOk">
<input type="text" id="valOk" name="Key" readonly="readonly" />
</div>
</div>
<div class="button">
<button id="validateB" type="submit">Validate Now ></button>
</div>
</form>
keys.php [where you are submitting the form]
require_once('simple_html_dom.php');
$processedResult = "";
if (!empty($_POST['Key'])) {
$processedResult = "foo";
}
$html = file_get_html('setupOk.php');
$html->find('input[id=valOk]', 0)->value = $processedResult;
echo $html;
I have tested it and it's working.

Session not starting

I just finished my login form, and everything seems to be working properly, except that when I try logging in, it redirects me back to the login page. I've tried multiple solutions but none work. Here is my code:
Mainpage.php
<?
include("index.php");
session_start();
if(!isset($_SESSION['id'])){
header("Location:index.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Cable Tech Guide</title>
<!-- Bootstrap -->
<link href ="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.hitsCounter {
position:bottom;
float:right;
}
</style>
</head>
<body>
<div class="container">
<div class="navbar navbar-inverse">
<div class="navbar-header">
Twin Cities
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Coding Guide</li>
<li>Cable Types</li>
<li>Drop Integrity</li>
</ul>
</div>
</div>
<div class="jumbotron">
<h2>Update!! 2/14</h2>
<p>Unfortanely, the login system is taking longer than expected. I will post another update within the week, to keep you guys updated.</p>
<p>I did add a drop integrity page for everybody to use, and I also updated the XH codes. Everybody enjoy!</p>
</div>
<div class="jumbotron">
<p>After the login system is up and running, I should be able to add some contact numbers on here.</p>
<p>Any other suggestions would be very helpful!</p>
</div>
<img class="hitsCounter" src="/Hits_Counter/gd-count.cgi?page=PageCounter&style=LED&x=16&y=24&nbdigits=1">
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
login.php
<?php
session_start();
if ($_GET["logout"]==1 AND $_SESSION['id']) { session_destroy();
$message="You have been logged out. Have a nice day!";
}
include("connection.php");
if ($_POST['submit']=="Sign Up") {
if (!$_POST['email']) $error.="<br />Please enter your email";
else if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) $error.="<br />Please enter a valid email";
$var1 = ($_POST['accessCode']);
$var2 = "abC";
if (strcmp($var1, $var2) !== 0) $error.="<br />That access code is incorrect!";
if (!$_POST['password']) $error.="<br />Please enter your password";
else {
if (strlen($_POST['password'])<8) $error.="<br />Please enter at least 8 characters";
if(!preg_match('/[A-Z]/', $_POST['password'])) $error.= "<br />Please include at least one capital letter";
}
if ($error) $error = "There were error(s) in your sign up details:".$error;
else {
$query= "SELECT * FROM `users` WHERE techNumber ='".mysqli_real_escape_string($link, $_POST['techNumber'])."'";
$result = mysqli_query($link, $query);
$results = mysqli_num_rows($result);
if ($results) $error = "That tech number is already registered. Do you want to log in?";
else {
$query = "INSERT INTO `users` (`techNumber`, `email`, `password`, `accessCode`) VALUES ('".mysqli_real_escape_string($link, $_POST['techNumber'])."', '".mysqli_real_escape_string($link, $_POST['email'])."', '".md5(md5($_POST['techNumber']).$_POST['password'])."', '".mysqli_real_escape_string($link, $_POST['accessCode'])."')";
mysqli_query($link, $query);
$_SESSION['id']= mysqli_insert_id($link);
header("Location:mainPage.php");
}
}
}
if ($_POST['submit'] == "Log In") {
$query = "SELECT * FROM users WHERE techNumber='".mysqli_real_escape_string($link, $_POST['logintechNumber'])."'AND password='" .md5(md5($_POST['logintechNumber']) .$_POST['loginpassword']). "'LIMIT 1";
$result = mysqli_query($link, $query);
$row = mysqli_fetch_array($result);
if($row){
$_SESSION['id']=$row['id'];
header("Location:mainPage.php");
} else {
$error = "We could not find a user with that tech number and password. Please try again.";
}
}
?>
index.php
<?php include("login.php"); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cable Tech Guide</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
</style>
</head>
<body data-spy="scroll" data-target=".navbar-collapse">
<div class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand">Twin Cities</a>
</div>
<div class="collapse navbar-collapse">
<form class="navbar-form navbar-right" method="post">
<div class="form-group">
<input type="techNumber" name="logintechNumber" placeholder="Tech Number" class="form-control" value="<?php echo addslashes($_POST['logintechNumber']); ?>" />
</div>
<div class="form-group">
<input type="password" name="loginpassword" placeholder="Password" class="form-control" value="<?php echo addslashes($_POST['loginpassword']); ?>" />
</div>
<input type="submit" name= "submit" class="btn btn-success" value="Log In">
</form>
</div>
</div>
</div>
<div class="container contentContainer" id="topContainer">
<div class="row">
<div class="col-md-6 col-md-offset-3" id="topRow">
<h1 class="marginTop">Cable Tech Guide</h1>
<?php
if ($error) {
echo '<div class="alert alert-danger">'.addslashes($error).'</div>';
}
if ($message) {
echo '<div class="alert alert-success">'.addslashes($message).'</div>';
}
?>
<form class="marginTop" method="post">
<div class="form-group">
<label for="techNumber">Tech Number</label>
<input type="techNumber" name="techNumber" class="form-control" placeholder="Your Tech Number" value="<? echo addslashes($_POST['techNumber']); ?>" />
</div>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" name="email" class="form-control" placeholder="Your Email" value="<? echo addslashes($_POST['email']); ?>" />
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="password" class="form-control" placeholder="Password" value="<? echo addslashes($_POST['password']); ?>" />
</div>
<div class="form-group">
<label for="accessCode">Access Code</label>
<input type="accessCode" name="accessCode" class="form-control" placeholder="Access Code" value="<? echo addslashes($_POST['accessCode']); ?>" />
</div>
<input type="submit" name="submit" value="Sign Up" class="btn btn-success btn-lg marginTop"/>
</form>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
$(".contentContainer").css("min-height",$(window).height());
</script>
</body>
</html>
As I observe your code..
I thought u have forget to open php tag properly on mainpage.php
you should use proper php open tag like this
<?php
pls chech it. this was your problem.
and make sure session_start(); always be first line of php code. so update ur code as like below. on mainpage.php
<?php
session_start();
if(!isset($_SESSION['id'])){
header("Location:index.php");
}
include("index.php");
?>
I cant understand your logic
but i hope its solve your session issue.
try it.
Sessions merely persist data across multiple requests to PHP, and the fact that this is an ideal place to store the user's authentication state does not mean that it should only be started during authentication.
Also, the name session_start() is a bit misleading because it does not start a session so much as open one if it exists, or start a new one. The first invocation to session_start() will set a cookie in the user's browser with the PHPSESSID variable that is passed back in the $_COOKIE superglobal array on subsequent requests. If session_start() detects this variable it loads the data from the server's session cache into $_SESSION, but only when session_start() is called.
This is why you should be calling session_start() for all requests, and why if should be one of the very first things in your script. Personally, all of my projects have the same 2 lines at the beginning of the global header:
Add session_start() on each page.
Echo session value so you can get idea that session started or not.
<?php
error_reporting(E_ALL);
session_start();
session_start(); will set cookies therefore should be called before any output. To make sure it will happen it should be the first thing called in anyone script that require use of the $_SESSION superglobal.
For more info check this answer
Have a look at this
Hope it will help and clear your doubts.

PHP Login code wont run?

I cannot get the PHP code to run within the HTML code. It simply will not work and I can't figure it out. I removed the <head></head> part of the html and the PHP login script works again. How do I fix this?
Here is my PHP:
<?php
include("db.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from Form
$username = mysqli_real_escape_string($db,$_POST['username']);
$password = mysqli_real_escape_string($db,$_POST['password']);
$password = md5($password); // Encrypted Password
$sql = "SELECT id FROM Users WHERE username='$username' and passcode='$password'";
$result = mysqli_query($db,$sql);
$count = mysqli_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1) {
header("location: greatjob.php");
}
else {
$error = "Your Login Name or Password is invalid";
}
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="test Portal | Login" />
<meta name="author" content="test" />
<title>test Portal | Login</title>
<link rel="stylesheet" href="logintemplate/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css">
<link rel="stylesheet" href="logintemplate/css/font-icons/entypo/css/entypo.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic">
<link rel="stylesheet" href="logintemplate/css/bootstrap.css">
<link rel="stylesheet" href="logintemplate/css/neon-core.css">
<link rel="stylesheet" href="logintemplate/css/neon-theme.css">
<link rel="stylesheet" href="logintemplate/css/neon-forms.css">
<link rel="stylesheet" href="logintemplate/css/custom.css">
<script src="logintemplate/js/jquery-1.11.0.min.js"></script>
<script>$.noConflict();</script>
<!--[if lt IE 9]><script src="logintemplate/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="page-body login-page login-form-fall" data-url="http://test.dev">
<!-- This is needed when you send requests via Ajax -->
<script type="text/javascript">
var baseurl = '';
</script>
<div class="login-container">
<div class="login-header login-caret">
<div class="login-content">
<a href="index.html" class="logo">
<img src="logintemplate/images/logo#2x.png" width="120" alt="" />
</a>
<p class="description">Dear user, log in to access the admin area!</p>
<!-- progress bar indicator -->
<div class="login-progressbar-indicator">
<h3>43%</h3>
<span>logging in...</span>
</div>
</div>
</div>
<div class="login-progressbar">
<div></div>
</div>
<div class="login-form">
<div class="login-content">
<div class="form-login-error">
<h3>Invalid login</h3>
<p><?PHP echo $error; ?></p>
</div>
<form method="post" action="login.php" role="form" id="form_login">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<i class="entypo-user"></i>
</div>
<input type="text" class="form-control" name="username" id="username" placeholder="Username" autocomplete="off" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<i class="entypo-key"></i>
</div>
<input type="password" class="form-control" name="password" id="password" placeholder="Password" autocomplete="off" />
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block btn-login">
<i class="entypo-login"></i>
Login In
</button>
</div>
</form>
<div class="login-bottom-links">
Forgot your password?
<br />
ToS - Privacy Policy
</div>
</div>
</div>
</div>
<!-- Bottom scripts (common) -->
<script src="logintemplate/js/gsap/main-gsap.js"></script>
<script src="logintemplate/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js"></script>
<script src="logintemplate/js/bootstrap.js"></script>
<script src="logintemplate/js/joinable.js"></script>
<script src="logintemplate/js/resizeable.js"></script>
<script src="logintemplate/js/neon-api.js"></script>
<script src="logintemplate/js/jquery.validate.min.js"></script>
<script src="logintemplate/js/neon-login.js"></script>
<!-- JavaScripts initializations and stuff -->
<script src="logintemplate/js/neon-custom.js"></script>
<!-- Demo Settings -->
<script src="logintemplate/js/neon-demo.js"></script>
</body>
</html>
Based on your provided link, your site is using AJAX for login so the jQuery is preventing the form from submitting normally. To make it work do one of these:
Change where your ajax is pointing
Make your changes to the page that the AJAX is currently pointing to
Give the login form a different id like <form id="formlogin"> and the ajax will ignore it and reload your page the way you want it to.

Categories