Hi ,i am new here but i have been working on this for a couple of days but can not manage to fix the problem can any one help.
i get the error:
Warning: Cannot send session cache limiter - headers already sent (output started at C:\apache\htdocs\out_fns.php:11) in C:\apache\htdocs\member.php on line 17
here is me code.
------------index.php-----
<?
session_start();
require_once("function.php");
do_html_header("RAMSN Login");
$buttons[0] = 'log-in';
display_toolbar($buttons);
//display_login_form(Login);
echo "Welcome";
do_html_footer();
?>
---------log-in.php--------
<?
//session_start();
require_once("function.php");
do_html_header("RAMSN Login");
$buttons[0] = 'log-in';
display_toolbar($buttons);
display_login_form(Login);
do_html_footer();
?>
------------function.php---------
<?
//function to be included
require_once("out_fns.php");
require_once("ds_fns.php");
?>
---------out_fns.php---------
<?
function do_html_header($title)
{
// print an HTML header
global $table_width;
//draw title bar
?>
<html>
<head>
<title><?=$title?></title>
<style>
h1 { font-family: Arial, Helvetica, sans-serif; font-size: 32;
font-weight: bold; color: white; margin-bottom: 0}
h2 { margin-bottom: 0}
b { font-family: Arial, Helvetica, sans-serif; font-size: 14;
font-weight: bold; color: black }
th { font-family: Arial, Helvetica, sans-serif; font-size: 18
font-weight: bold; color: white; }
body, li, td, p { font-family: Arial, Helvetica, sans-serif;
font-size: 14; margin = 5px }
a { color: #000000 }
</style>
</head>
<body>
<table width = <?=$table_width?> cellspacing = 0 cellpadding = 6 border = 0>
<tr>
<td bgcolor = "#5B69A6" width = 73><img src = "images/logo.gif"
width = 100 height = 100 alt ="" valign = middle></td>
<td bgcolor = "#5B69A6" width = <?=$table_width-73;?>><h1><?=$title?></h1></td>
</tr>
</table>
<table width = <?=$table_width?> cellpadding = 0 cellspacing = 0 border = 0>
<tr><td>
<?
}
function do_html_heading($heading)
{
// print heading
?>
<h2><?=$heading?></h2>
<?
}
function do_html_footer()
{
// print an HTML footer
?>
</body>
</html>
<?
}
function display_login_form($action)
{
// display form asking for email and password
?>
<center>
<form method=post action="member.php">
<table bgcolor='#cccccc' border = 0 cellpadding = 6 cellspacing = 0>
<tr>
<th colspan = 2 bgcolor = '#5B69A6'>
Please Log In
</th>
</tr>
<tr>
<td>User Name:</td>
<td><input type=text name=name></td></tr>
<tr>
<td>Password:</td>
<td><input type=password name=password></td></tr>
<tr>
<td colspan=2 align=center>
<? display_form_button('log-in'); ?>
</td></tr>
<tr>
<td colspan=2 align=center><a href="forgot_form.php">Forgot your password??</a></td>
</tr>
</table></form>
</center>
<?
}
function display_form_button($button)
{
//display one of our standard buttons in a form
echo "<center><input type = image src = 'images/".$button.".gif'
border = 0 ";
echo "width = 149 height = 43 ";
echo "alt = '".format_action($button)."'></a></center>";
}
function display_toolbar($button, $extra_parameters = '')
{
// draw our toolbar
// there are up to five buttons per row and up to three rows
// these numbers are completely arbitary and depend on the
// images size and acceptable screen width
global $table_width;
echo "<table width = $table_width cellpadding = 0 cellspacing = 0
border = 0>";
for($i = 0; $i < 3; $i++ )
{
if($button[($i*5)])
{
echo '<tr>';
echo '<td bgcolor = "#cccccc">';
for($j = 0; $j < 5; $j++)
{
echo '<td bgcolor = "#cccccc">';
if ($button[($i*5+$j)])
display_button($button[$i*5+$j], $extra_parameters);
else
display_spacer();
echo '</td>';
}
echo '</tr>';
}
}
echo '</table>';
}
function display_spacer()
{
//display blank spacer the size of our buttons
echo "<img src = 'images/spacer.gif' border = 0 ";
echo "width = 149 height = 43 ";
echo "alt = ''>";
}
function check_normal_user()
// see if somebody is logged in and notify them if not
{
}
function check_admin_user()
// see if somebody is logged in and notify them if not
{
}
function check_teacher_user()
// see if somebody is logged in and notify them if not
{
}
function display_button($button, $extra_parameters = '')
{
//display one of our standard buttons as a href
$url = "$button.php";
if($extra_parameters)
$url .= $extra_parameters;
echo "<center><a href = '$url'>";
echo "<img src = 'images/$button.gif' border = 0 ";
echo "width = 149 height = 43 ";
echo "alt = '".format_action($button)."'></a></center>";
}
function format_action($string)
{
// convert our actions into a displayable string
// eg "account-setup" becomes "Account Setup"
$string = str_replace("-", " ", $string);
$string = ucwords($string);
return $string;
}
?>
--------forgot.php-------
<?
require_once("out_fns.php");
do_html_header(Forgot);
echo "You have to contact your system administrator to find out your password";
do_html_footer();
?>
----------ds_fns.php----
<?php
function db_connect()
{
$db_host = 'localhost';
$db_user = 'schirkin';
$db_pass = 'MvcG03';
$db_name = 'schirkin';
$db_table = 'user';
//add $db_user $db_pass
$conn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect");
if ($conn == true)
{
// Select the database.
mysql_select_db($db_name,$conn) or die("Unable to find database");
}
else
{
echo ' could not connect to database : '. mysql_error();
}
}
function login($name, $password)
{
// connect to db
$conn = db_connect();
$query = "select UserLevel from User
where UserID='$name'
and PWD = '$password'";
$result = mysql_query($query);
if (!$result)
return false;
if (mysql_num_rows($result)<1)
return false;
if(mysql_result($result,0 ) == 2)
return 'admin';
else if (mysql_result($result, 0) == 0)
return 'normal';
else
return 'teacher';
}
function check_logged_in()
{
return ( check_normal_user() || check_admin_user() || check_teacher_user());
}
?>
----------member.php---------
<?
// include function files for this application
require_once("function.php");
if ($name && $password)
{
$login = login($name, $password);
if($login == 'admin')
{
do_html_header(a);
session_register("admin_user");
}
else if($login == 'normal')
{
do_html_header(b);
session_register("normal_user");
}
else if($login == 'teacher')
{
do_html_header(c);
session_register("teacher_user");
}
else
{
do_html_heading("<p>Sorry, we could not log you in with that name and password.<br>");
}
}
else
{
echo "<br>You haven't filled out both fields";
}
?>