Script error... Please help

I downloaded a PHP login & redirect from http://www.mpdolan.com/downloads.php

they unfortunately do not have a HELP guide or anything to troubleshoot the errors that may occur.

after install you are asked to copy and create a config.php and add a PHP code to any page you wish to have login protection.

Here is my problem

I am getting this error.

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 6

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 9

I have looked and cannot find “white areas” in the following code…

[php]<?php

//prevents caching
header(“Expires: Sat, 01 Jan 2000 00:00:00 GMT”);
header(“Last-Modified: “.gmdate(“D, d M Y H:i:s”).” GMT”);
header(“Cache-Control: post-check=0, pre-check=0”,false);
session_cache_limiter();

session_start();

require(‘config.php’);
require(‘functions.php’);
//this is group name or username of the group or person that you wish to allow access to
// - please be advise that the Administrators Groups has access to all pages.
if (allow_access(Administrators) != “yes”)
{
include (‘no_access.html’);
exit;
}
?>[/php]

Is this script being called from another page? If not, do you have a blank link, space, tab, etc. before the “<?php”? If you are including it from another page, I would bet that the problem is that the first page is outputting to the browser before your include (or require).

If you are looking for a login script this is far better than the one in your link: http://php-login-script.com/ very well put together. I use it as the base for all my works.

Please explain what you mean by “called it from another page”. I am sure I can answer about any question if I know what is being asked.

I am willing to work with anyone and walk through this if i can get this running. I ahve been reading and trying to get “a simple script” to be simple.

looking at this… i have no idea how to set it up… instructions are not simplified for my knowledge

ritamm,

What I am asking is whether or not the code you posted is directly pasted at the top of a page or if it is a separate page that you are including or requiring in a page.

If it is pasted into a page, make certain there is absolutely nothing before the “<?php” - no indents, spaces, tabs, blank lines, etc.

Also make sure that you are typing the exact address for the page that it appears in into your browser.

The code that you posted will not generate the error you are receiving by itself. There is something outside of the code causing your issue. It may be as simple as a space before the code, it might be something in one of the required files, but it isn’t the code itself.

I have to paste that code i every apge i want to be secured. i have it right under the tags in the HTML…

Is this incorrect ?

I just removed it from the and placed it abouve the tags at the very top of the page…

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 6

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/76/8773476/html/eahtml/studentcenter.php:1) in /home/content/76/8773476/html/eahtml/studentcenter.php on line 9

is what i get

Change the DB settings in the includes/dbc.php file at the top. login to your MySQL panel and dump the database from the dbsql.sql file. Login with the user: admin and pass: admin123 Thats it you can then edit and change everything as you see fit.

I did exactly that…

I imported the dbsql and edited the dbc.php… doesnt work for me i got

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to MySQL server on ‘72.167.233.37’ (111) in /home/content/76/8773476/html/eahtml/dbc.php on line 31
Couldn’t make connection.

That means there is a problem with the setting you have put into the script.

[php]
define (“DB_HOST”, “localhost”); // set database host
define (“DB_USER”, “username”); // set database user
define (“DB_PASS”,“password”); // set database password
define (“DB_NAME”,“database name”); // set database name
[/php]

Thats all in the dbc.php file. Make sure you have the " " around the values.

did that… not working…

UNSOLVED…

I couldn’t get this script to work… Therefore I found and a different script and have the new script working now. I appreciate all help.

Sponsor our Newsletter | Privacy Policy | Terms of Service