Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Ok, try this: Open Modify page properties (cmd-J) and choose UTF-8 and make sure that BOM is not included:

_Skjermbilde 2.jpg
(I'm not 100% sure this will actually do what I want, because I'm not gotten back to using Dreamweaver, yet...)

This is even easier in my preferred free all purpose text editor, TextWrangler:

_Skjermbilde 1.jpg
 
Ok have done that and its showing no bom in Textwrangler as well.

Still have the error messages though. this is the code i have now.

PHP:
<?php require_once('Connections/userslogin.php'); ?>

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "admin_home.php";
  $MM_redirectLoginFailed = "error.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_userslogin, $userslogin);
  
  $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $userslogin) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
session_start();<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 
session_start() needs go before anything gets sent to the user. Put it at the top of the page
 
Thanks I have changed that which has stopped displaying the error. But when i login i get this message:
Warning: Cannot modify header information - headers already sent by (output started at /Users/Sambo/Web/Universal site/admin_page.php:2) in /Users/Sambo/Web/Universal site/admin_page.php on line 39


my overall code looks like this now:
session_start();
<?php require_once('Connections/userslogin.php'); ?>

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin_home.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_userslogin, $userslogin);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $userslogin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="shortcut icon" href="fa
 
is that a good thing or bad thing. Where is it supposed to be?
PHP code normally likes it best inside of the <?php ... ?> tags...but I'm not sure here, since it's already set in the beginning of the code...

Which errors are you getting...? Does it specify a line...?

What happens in userslogin.php?

I seem to have more questions than answers...
 
The error i'm getting is this:

Warning: Cannot modify header information - headers already sent by (output started at /Users/Sambo/Web/Universal site/admin_page.php:2) in /Users/Sambo/Web/Universal site/admin_page.php on line 39

This warning is displayed in my browser when i test my login page.

My Dreamweaver code for this page looks like this:

session_start();
<?php require_once('Connections/userslogin.php'); ?>

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin_home.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_userslogin, $userslogin);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $userslogin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>


I hope this helps
 
ok have done that.
I'm still getting this in my browser:

Warning: Cannot modify header information - headers already sent by (output started at /Users/Sambo/Web/Universal site/admin_page.php:4) in /Users/Sambo/Web/Universal site/admin_page.php on line 39

My dreamweaver code is now like this:
<?php session_start(); ?>
<?php require_once('Connections/userslogin.php'); ?>

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin_home.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_userslogin, $userslogin);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $userslogin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
 
You still need to put session_start() inside of PHP tags. :)

Also, go back and warp your posts in this thread that have PHP code inside of
Code:
 tags.
 
ok have done that and i'm now getting this in my browser

Warning: Cannot modify header information - headers already sent by (output started at /Users/Sambo/Web/Universal site/admin_page.php:4) in /Users/Sambo/Web/Universal site/admin_page.php on line 39

my code now looks like this:


<?php session_start(); ?>
<?php require_once('Connections/userslogin.php'); ?>

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin_home.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_userslogin, $userslogin);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $userslogin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
 
It's because you're trying to send headers long after they've already been sent to the client, on line 39 of your code.

Header()
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
 
ok so where in my code should i put
header("Location: " . $MM_redirectLoginSuccess );

I don't know code well enough to know when any output has been sent.

I think i'm so close to sorting this problem so just a little more help needed!!!
Thanks so much for your time
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.