I'm getting the same error on line 1 of my code. my session starts on top and I tried saving in notepad++ in UTF without BOM. STILL no luck. this script was working, and hasn't moved servers or anything so I'm not sure what happened...could the way the file is uploaded affect it working?
here is my code:
<?php session_start(); ?>
<script src="js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
$(document).ready(function() {
$("#loginform").validate({
rules: {
email: {
required: true,
email:true
},
password: {
required: true,
},
},
messages: {
password: "Please enter your password",
email: "Please enter a valid email address"
}
});
});
function OnLogin(){
var email = $('#email').val();
var password = $('#password').val();
if ( email != "" && password != "" ){
$.ajax({
url:'lib/login.php',
type:'POST',
data:"email=" + email + "&password=" + password,
async:false,
success: function(str){
if ( str.indexOf("SUCCESS") != -1 )
{
if ( $("#redirect").length > 0 && $("#redirect").val() != "" )
location.href = $("#redirect").val() + ".php";
else
location.reload();
return;
}
else
{
if ( str.indexOf("PWD") != -1 )
{
alert("Please input the correct password.");
$("#password").focus();
}
else if ( str.indexOf("UID") != -1 )
{
alert("Please input the correct email.");
$("#email").focus();
}
}
}
});
}
}
function OnRegister(){
location.href = "register.php";
}
function OnLogOut(){
$.ajax({
url:'lib/logout.php',
type:'POST',
data:"logout=1",
async:false,
success: function(str){
if ( str.indexOf("SUCCESS") != -1 )
{
location.reload();
return;
}
}
});
}
//]]>
</script>
<?php if( !isset($_SESSION['PHP_AUTH_USER']) ): ?>
<h1>User Login</h1>
<div id="login-form">
<form id="loginform" name="loginform" method="post" onsubmit="OnLogin();return false;">
<h3>Email</h3>
<input type="text" name="email" id="email" />
<h3>Password</h3>
<input type="password" name="password" id="password" />
<br />
<input type="image" class="login button" src="images/login.jpg" />
<input type="image" class="register button" src="images/register.jpg" onclick="OnRegister()" />
</form>
</div>
<?php else: ?>
<p>Thanks <strong><?=$user_name?></strong>, You are now logged in.</p>
<p style="text-align:center"><input type="button" class="button" onclick="OnLogOut()" value="logout" /></p>
<?php endif; ?>