I have this registration form but for whatever reason it always returns with that the username is taken. Anyone care to look at it?
<?php
session_start;
include "config.php";
if($_POST['register']) {
if($_POST['email']) {
if($_POST['name']) {
if($_POST['pw1']) {
if($_POST['pw2']) {
if($_POST['pw2'] == $_POST['pw1']) {
$check_query = mysql_query("SELECT * FROM register WHERE username = '" .$_POST['name']. "'");
$check = mysql_num_rows($check_query);
if($check == "0"){
$pw = md5($_POST['pw1']);
mysql_query("INSERT INTO register (username, pass, email)
VALUES ('".$_POST['name']."', '".$pw."', '".$_POST['email']."')") or die(mysql_error());
$notice = "You are registered and you can login <a href='index.php'>here</a>";
}else{//#1 name already exists
$notice = "This username already exists";
}//#1 close
}else{//#2 pw's not the same
$notice = "The passwords are not the same";
}//#2 close
}else{//#3 pw2 not filled in
$notice = "You do have to type in a password";
}//#3 close
}else{//#4 pw 1 not filled in
$notice = "You do have to type in a password";
}//#4 close
}else{//#5 no name
$notice = "You do have to type in a username";
}//#5 close
}else{//#6 no email
$notice = "You do have to type in an email";
}//#6 close
}//post register close
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="bluestyle.css">
<link href='http://fonts.googleapis.com/css?family=Cabin' rel='stylesheet' type='text/css'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sign Up</title>
</head>
<body>
<center><div id="masterpower">
<img src="headblue.png" id="head">
<div id="h">
<a style="float:right;margin-right:10px;">This</a>
</div>
<div class="holder">
<div class="loppit">
<div id="contt">
<h1>Sign up!</h1><br />
<?php
if($_SESSION['usrid']) {
echo 'You are already logged in, <br />Home';
}else{
if($notice) {
echo $notice, '<br />Back';
}else{
?>
Note: Everything is case-sensitive!
<form id="form1" name="form1" method="post" class="form" action="register.php">
<table>
<tr><td>Username:</td>
<td><input name="name" id="name" class="ipted" type="text" /></td></tr>
<tr><td>Password:</td>
<td><input type="password" class="ipted" id="pw2" name="pw2"/></td></tr>
<tr><td>Password (Verify):</td>
<td><input name="pw1" class="ipted" id="pw1" type="password" /></td></tr>
<td>E-Mail:</td>
<td><input type="text" class="ipted" id="email" name="email" /></td></tr>
<tr><td></td><td><input type="submit" class="ipted" name="register" value="Register" id="register" /></td></tr>
</form>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</center>
</body>
</html>
This is a little more tidy:
<?php
session_start();
include "config.php";
if($_POST['register']) {
$notice = array();
if(empty($_POST['email'])) {
$notice[] = "You do have to type in an email";
}
if(empty($_POST['name'])) {
$notice[] = "You do have to type in a username";
}
if(empty($_POST['pw1']) || empty($_POST['pw2'])) {
$notice[] = "You do have to type in a password";
}
if($_POST['pw2'] == $_POST['pw1']) {
$notice[] = "The passwords are not the same";
}
$check_query = mysql_query("SELECT * FROM register WHERE username = '" .$_POST['name']. "'") or die(mysql_error()); // added " or die(mysql_error())" for debug purpose
if(mysql_num_rows($check_query) != 0){
$notice[] = "This username already exists";
}
if(count($notice) == 0){
$pw = md5($_POST['pw1']);
mysql_query("INSERT INTO register (username, pass, email)
VALUES ('".$_POST['name']."', '".$pw."', '".$_POST['email']."')") or die(mysql_error());
$notice[] = "You are registered and you can login <a href='index.php'>here</a>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="bluestyle.css">
<link href='http://fonts.googleapis.com/css?family=Cabin' rel='stylesheet' type='text/css'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sign Up</title>
</head>
<body>
<center><div id="masterpower">
<img src="headblue.png" id="head">
<div id="h">
<a style="float:right;margin-right:10px;">This</a>
</div>
<div class="holder">
<div class="loppit">
<div id="contt">
<h1>Sign up!</h1><br />
<?php
if($_SESSION['usrid']) {
echo 'You are already logged in, <br />Home';
}else{
if(isset($notice) && count($notice) > 0) {
echo implode(', ',$notice), '<br />Back';
}else{
?>
Note: Everything is case-sensitive!
<form id="form1" name="form1" method="post" class="form" action="register.php">
<table>
<tr><td>Username:</td>
<td><input name="name" id="name" class="ipted" type="text" /></td></tr>
<tr><td>Password:</td>
<td><input type="password" class="ipted" id="pw2" name="pw2"/></td></tr>
<tr><td>Password (Verify):</td>
<td><input name="pw1" class="ipted" id="pw1" type="password" /></td></tr>
<td>E-Mail:</td>
<td><input type="text" class="ipted" id="email" name="email" /></td></tr>
<tr><td></td><td><input type="submit" class="ipted" name="register" value="Register" id="register" /></td></tr>
</form>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</center>
</body>
</html>
Try that and see if you get an error.
Related
The select query does not want to work. It goes directly to the login failed although I have enter the correct password.
I tried from another database and it works but from this table it does not want to work.
Another thing is whenever I start XAMPP it shows key _ buffer.
Is that what prevents my query from working?
Below is my code. Hoping from some help from you developers.
<?php
session_start();
$_SESSION['message']='';
$mysqli=new MySQLi('127.0.0.1','root','','learning_malaysia');
if(isset($_POST['login'])) {
$username = $mysqli->real_escape_string($_POST['username']);
$password = md5($_POST['password']);
$sql="SELECT * FROM tutor_register WHERE username='$username' AND password='$password' LIMIT 1;";
$result = mysqli_query($mysqli,$sql);
if(mysqli_num_rows($result) > 0){
$row = mysqli_fetch_array($result);
if (($row['username']=='sithi') && ($row['password']=='202cb962ac59075b964b07152d234b70')){
$_SESSION['user_type'] = $row;
$_SESSION['password'] = $row;
$_SESSION['message'] = "Registration successful!";
header("location:myresuming.html");
exit();
} else {
$_SESSION['username'] = $row['username'];
$_SESSION['profile'] = $row['profile'];
$_SESSION['message'] = "Registration successful!";
header("location:Welcome.php");
exit();
}
} else {
$_SESSION['message'] = "Login Failed!";
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form in Design</title>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<link rel="stylesheet" type="text/css" href="form.css" />
</head>
<body>
<div class="container"><?=$_SESSION['message']?>
<img src="5.jpg" />
<form class="form" action="" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="alert alert-error"></div>
<input type="text" placeholder="User Name" name="username" required />
<input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
<input type="submit" name="login" value="login" class="btn-login" />
</form>
</div>
</body>
</html>
<?php
session_start();
$_SESSION['message']='';
$mysqli=new MySQLi('127.0.0.1','root','','learning_malaysia');
if(isset($_POST['login'])) {
$username = $mysqli->real_escape_string($_POST['username']);
$password = md5($_POST['password']);
$sql="SELECT * FROM tutor_register WHERE username='$username' AND password='$password' LIMIT 1;";
$result = mysqli_query($mysqli,$sql);
if(mysqli_num_rows($result) > 0){
$row = mysqli_fetch_array($result);
if (($row['username']=='sithi') && ($row['password']=='202cb962ac59075b964b07152d234b70')){
$_SESSION['user_type'] = $row['user_type'];
$_SESSION['password'] = $row['password'];
$_SESSION['message'] = "Registration successful!";
header("location:myresuming.html");
exit();
} else {
$_SESSION['username'] = $row['username'];
$_SESSION['profile'] = $row['profile'];
$_SESSION['message'] = "Registration successful!";
header("location:Welcome.php");
exit();
}
} else {
$_SESSION['message'] = "Login Failed!";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form in Design</title>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<link rel="stylesheet" type="text/css" href="form.css" />
</head>
<body>
<div class="container"><?php echo $_SESSION['message']; ?>
<img src="5.jpg" />
<form class="form" action="" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="alert alert-error"></div>
<input type="text" placeholder="User Name" name="username" required />
<input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
<input type="submit" name="login" value="login" class="btn-login" />
</form>
</div>
</body>
</html>
try this.
I am not sure what the problem is here. The user data is in my MySQL database, and correct. However when I try to login I get an error saying user/password is incorrect. I am trying to login using the users email address. In addition I want to add the first name, and user id to the session.
<?php
session_start();
include_once 'dbconnect_new.php';
if(isset($_SESSION['user'])!="")
{
header("Location: ../index.php");
}
if(isset($_POST['btn-login']))
{
$s_email = mysql_real_escape_string($_POST['email']);
$s_password = mysql_real_escape_string($_POST['password']);
$s_email = trim($s_email);
$s_password = trim($s_password);
$res=mysql_query("SELECT student_id, student_password, student_firstname FROM studentdata WHERE student_email='$s_email'");
$row=mysql_fetch_array($res);
$count = mysql_num_rows($res); // if uname/pass correct it returns must be 1 row
if($count == 1 && $row['student_password']==md5($s_password))
{
$_SESSION['user'] = $row['student_id'];
header("Location: ../index.php");
}
else
{
?>
<script>
alert('Username / Password Seems Wrong !');
</script>
<?php
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Reg Page</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<center>
<div id="login-form">
<form method="post">
<table align="center" width="30%" border="0">
<tr>
<td>
<input type="text" name="email" placeholder="Your Email" required />
</td>
</tr>
<tr>
<td>
<input type="password" name="password" placeholder="Your Password" required />
</td>
</tr>
<tr>
<td>
<button type="submit" name="btn-login">Sign In</button>
</td>
</tr>
<tr>
<td>Sign Up Here</td>
</tr>
</table>
</form>
</div>
</center>
</body>
</html>
Try this code:-
$s_email = mysql_real_escape_string($_POST['email']);
$s_password = mysql_real_escape_string($_POST['password']);
$s_email = trim($s_email);
$s_password = md5(trim($s_password));
$res=mysql_query("SELECT student_id, student_firstname FROM studentdata WHERE student_email='$s_email' AND student_password = '$s_password'");
if (!$res) {
// Debug query result by below code
//echo 'Could not run query: ' . mysql_error();
//exit;
echo '<script language="javascript">';
echo 'alert("Username / Password Seems Wrong !")';
echo '</script>';
}else{
$row = mysql_fetch_row($result);
$stu_id = $row[0];
$stu_fname = $row[1];
$_SESSION['user'] = $stu_id;
header("Location: ../index.php");
}
Hope this will help you :)
ok so i deleted some md5 password encryption because i was having issues with it. but now when i go to log in after adjusting the passwords in phpmyadmin the header redirect is not working. i know that the user logs in because when i go to the next pages link by typing it in the url it shows the user as logged in.
<?php
require('user_chat/config.php');
if(isset($_SESSION[''.CHAT_SESSION_UID.''])){
header('http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
}
include_once 'include/processes.php';
$Login_Process = new Login_Process;
$Login_Process->check_login($_GET['page']);
$Login = $Login_Process->log_in($_POST['user'], $_POST['pass'], $_POST['remember'], $_POST['page'], $_POST['submit']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ccrxpersonnel.com</title>
<link type="text/css" rel="Stylesheet" href="http://wordpress.techlifeforgotten.com/wp-content/uploads/ultimatum/b9b341fd54db6ec6136e9edd548c0511.css?ver=3.6.1" />
<body>
<div class="container">
<?php
if(isset($error_msg)){
echo '<div class="err">'.$error_msg.' Go Back</div>';
} else {
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<h1>Log In</h1>
<div class="red"><?php echo $Login; ?></div>
<div class="label">
Username:
</div>
<input name="user" type="text" class="field" id="user"/>
<br />
<div class="label">
Password:
</div>
<input name="pass" type="password" class="field" id="pass" value="" />
<br />
<div class="right">
<label>Remember Me For 30 Day's
<input name="remember" type="checkbox" value="true" />
</label>
</div>
<input name="page" type="hidden" value="<? echo $_GET['page']; ?>" />
<input name="submit" type="submit" class="button" value="Log In" />
<br />
<br />
<div class="center">
Password Recovery
</div>
</form>
<?php
}
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/jquery.cookie.js"></script>
<script>
$.cookie("c_openbox","", { expires: -30 });
$.cookie("min_openbox","", { expires: -30 });
</script>
<?php
if(isset($_POST['submit']))
{
$time = time();
$username = mysql_real_escape_string($_POST['user']);
$password = mysql_real_escape_string($_POST['pass']);
if($_POST['user'] != "" && $_POST['pass'] != ""){
$password = $_POST['pass'];
$query_test_new_user = mysql_query("SELECT * FROM ".DB_PREFIX."".USER_TABLE." WHERE ".USER_TABLE_USERNAME."='$username' AND ".USER_TABLE_PASSWORD."='$password' LIMIT 1");
$row_test_new_user = mysql_fetch_array($query_test_new_user);
$num_test_new_user = mysql_num_rows($query_test_new_user);
if($num_test_new_user != '0' && $num_test_new_user != ''){
$_SESSION[''.CHAT_SESSION_UID.''] = $row_test_new_user[''.USER_TABLE_ID.''];
$_SESSION[''.CHAT_SESSION_UNAME.''] = $row_test_new_user[''.USER_TABLE_USERNAME.''];
$_SESSION["Select_Whos"] = "Users";
header('http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
} else {
$error_msg = 'Username and/or password is worng. Please try agian.';
}
} else {
$error_msg = 'Username and/or password is empty. Please try agian.';
}
}
?>
</div>
</body>
</html>
I honestly don't know what had happened with this but I am hoping it is something simple that I have overlooked.
You are missing to add Location in header. also add exit() after header.
header('Location: http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
exit();
I want to make a single login for just 1 user without storing in a database but I can't seem to get this to work.
My code: login.php
<html>
<head>
<title>Login</title>
</head>
<h3>Add entry</h3>
<p> Add another Article</p>
<form action="trylog.php" method = "post">
<label for="username">Username</label> <input type="username" id="usename" name="username"><br /><br />
<label for="password">Password:</label> <input type="text" id="password" name="password"><br /><br />
<button type = "submit">Login</button>
</form>
</html>
trylog.php
<html>
<title>Login</title>
<body>
<?php
$usr = "admin";
$psw = "password";
$username = '$_POST[username]';
$password = '$_POST[password]';
//$usr == $username && $psw == $password
session_start();
if ($_SESSION['login']==true || ($_POST['username']=="admin" && $_POST['password']=="password")) {
echo "password accepted";
$_SESSION['login']=true;
}else {
echo "incorrect login";
}
?>
<form name="input" action="adminportal.php" method="get">
<input type="submit" value="Home">
</form>
</body>
</html>
Your code could look more like:
<?php
session_start();
$errorMsg = "";
$validUser = $_SESSION["login"] === true;
if(isset($_POST["sub"])) {
$validUser = $_POST["username"] == "admin" && $_POST["password"] == "password";
if(!$validUser) $errorMsg = "Invalid username or password.";
else $_SESSION["login"] = true;
}
if($validUser) {
header("Location: /login-success.php"); die();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Login</title>
</head>
<body>
<form name="input" action="" method="post">
<label for="username">Username:</label><input type="text" value="<?= $_POST["username"] ?>" id="username" name="username" />
<label for="password">Password:</label><input type="password" value="" id="password" name="password" />
<div class="error"><?= $errorMsg ?></div>
<input type="submit" value="Home" name="sub" />
</form>
</body>
</html>
Now, when the page is redirected based on the header('LOCATION:wherever.php), put session_start() at the top of the page and test to make sure $_SESSION['login'] === true. Remember that == would be true if $_SESSION['login'] == 1 as well.
Of course, this is a bad idea for security reasons, but my example may teach you a different way of using PHP.
Here is a simple php script for login and a page that can only be accessed by logged in users.
login.php
<?php
session_start();
echo isset($_SESSION['login']);
if(isset($_SESSION['login'])) {
header('LOCATION:admin.php'); die();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='content-type' content='text/html;charset=utf-8' />
<title>Login</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h3 class="text-center">Login</h3>
<?php
if(isset($_POST['submit'])){
$username = $_POST['username']; $password = $_POST['password'];
if($username === 'admin' && $password === 'password'){
$_SESSION['login'] = true; header('LOCATION:admin.php'); die();
} {
echo "<div class='alert alert-danger'>Username and Password do not match.</div>";
}
}
?>
<form action="" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" name="password" required>
</div>
<button type="submit" name="submit" class="btn btn-default">Login</button>
</form>
</div>
</body>
</html>
admin.php ( only logged in users can access it )
<?php
session_start();
if(!isset($_SESSION['login'])) {
header('LOCATION:login.php'); die();
}
?>
<html>
<head>
<title>Admin Page</title>
</head>
<body>
This is admin page view able only by logged in users.
</body>
</html>
Firstly, you need to put session_start(); before any output to the browser, normally at the top of the page. Have a look at the manual.
Second, this won't affect your results, but these lines aren't being used anywhere and should be removed:
$usr = "admin";
$psw = "password";
$username = '$_POST[username]';
$password = '$_POST[password]';
...and the last two lines there wouldn't work, you need to put the quotes inside the square brackets:
$username = $_POST['username'];
If you put session_start() at the top of your page (i.e. before the <html> tag etc), this should work fine.
Your code could look more like:
<?php
session_start(); $username = $password = $userError = $passError = '';
if(isset($_POST['sub'])){
$username = $_POST['username']; $password = $_POST['password'];
if($username === 'admin' && $password === 'password'){
$_SESSION['login'] = true; header('LOCATION:wherever.php'); die();
}
if($username !== 'admin')$userError = 'Invalid Username';
if($password !== 'password')$passError = 'Invalid Password';
}
?>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<meta http-equiv='content-type' content='text/html;charset=utf-8' />
<title>Login</title>
<style type='text.css'>
#import common.css;
</style>
</head>
<body>
<form name='input' action='<?php echo $_SERVER['PHP_SELF'];?>' method='post'>
<label for='username'></label><input type='text' value='<?php echo $username;?>' id='username' name='username' />
<div class='error'><?php echo $userError;?></div>
<label for='password'></label><input type='password' value='<?php echo $password;?>' id='password' name='password' />
<div class='error'><?php echo $passError;?></div>
<input type='submit' value='Home' name='sub' />
</form>
<script type='text/javascript' src='common.js'></script>
</body>
</html>
<?php
session_start();
mysql_connect('localhost','root','');
mysql_select_db('database name goes here');
$error_msg=NULL;
//log out code
if(isset($_REQUEST['logout'])){
unset($_SESSION['user']);
unset($_SESSION['username']);
unset($_SESSION['id']);
unset($_SESSION['role']);
session_destroy();
}
//
if(!empty($_POST['submit'])){
if(empty($_POST['username']))
$error_msg='please enter username';
if(empty($_POST['password']))
$error_msg='please enter password';
if(empty($error_msg)){
$sql="SELECT*FROM users WHERE username='%s' AND password='%s'";
$sql=sprintf($sql,$_POST['username'],md5($_POST['password']));
$records=mysql_query($sql) or die(mysql_error());
if($record_new=mysql_fetch_array($records)){
$_SESSION['user']=$record_new;
$_SESSION['id']=$record_new['id'];
$_SESSION['username']=$record_new['username'];
$_SESSION['role']=$record_new['role'];
header('location:index.php');
$error_msg='welcome';
exit();
}else{
$error_msg='invalid details';
}
}
}
?>
// replace the location with whatever page u want the user to visit when he/she log in
I need some help with my code. It works on XAMPP on my computer but when it's live on my server it won't work all I get is a blank screen. You can have a look what happens at <a href="http://www.redhotessentials.com/prototype/pages/login.php</a> put username allanallan password allanallan and you can see what happens thanks
<?php
if (isset($_POST['email'])) {
//Connect to the database through our include
require("db.php");
$email = stripslashes($_POST['email']);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$password = preg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters
$password = md5($password);
// Make query and then register all database data that -
// cannot be changed by member into SESSION variables.
// Data that you want member to be able to change -
// should never be set into a SESSION variable.
$sql = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$password' AND emailactivated='1'");
$login_check = mysql_num_rows($sql);
if($login_check>0){
while($row = mysql_fetch_array($sql)){
// Get member ID into a session variable
$id = $row['id'];
session_register('id');
$_SESSION['id'] = $id;
// Get member username into a session variable
$username = $row['username'];
session_register('username');
$_SESSION['username'] = $username;
// Update last_log_date field for this member now
mysql_query("UPDATE members SET lastlogin=now() WHERE id='$id'");
// Print success message here if all went well then exit the script
header("location: endlessnails_blog.php");
exit();
} // close while
} else {
// Print login failure message to the user and link them back to your login page
print '<br /><br /><font color="#FF0000">No match in our records, try again </font><br />
<br />Click here to go back to the login page.';
exit();
}
}// close if post
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login to your profile</title>
<link rel="stylesheet" type="text/css" href="../../css/main4.css" />
<script type="text/javascript">
<!-- Form Validation -->
function validate_form ( ) {
valid = true;
if ( document.logform.email.value == "" ) {
alert ( "Please enter your User Name" );
valid = false;
}
if ( document.logform.pass.value == "" ) {
alert ( "Please enter your password" );
valid = false;
}
return valid;
}
<!-- Form Validation -->
</script>
</head>
<?php include("header.php"); ?>
<?php include("nav.php"); ?>
<body>
<div id="container">
<div id="box3">
<div align="center">
<h3 id="login2"><br />
<br />
Log into Endless Nails Blog<br />
<br />
</h3>
</div>
<div id="loginformmove">
<table class="style7" align="center" cellpadding="5">
<form action="index.php" method="post" enctype="multipart/form-data" name="logform"
id="logform" onsubmit="return validate_form ( );">
<tr>
<td class="style7"><div align="right">Email Address:</div></td>
<td class="style7"><input name="email" type="text" id="email" size="30" maxlength="64" /></td>
</tr>
<tr>
<td class="style7"><div align="right">Password:</div></td>
<td class="style7"><input name="password" type="password" id="password" size="30" maxlength="24" /></td>
</tr>
<tr>
<td class="style7"> </td>
<td id="login3"><input name="Submit" type="submit" value="Login" class="login_pad" /></td>
</tr>
</form>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
Remove the enctype from your FORM attributes, since you are not Uploading files, just use the method="POST"