Jump to content

[SOLVED] Fatal error: Cannot redeclare headers()


newbtophp

Recommended Posts

Im getting this error, wherever I include the config file, anyone know what this maybe caused by?

 

Fatal error: Cannot redeclare headers() (previously declared in /home/mysite/public_html/config.php:9) in /home/mysite/public_html/config.php on line 17

 

Config.php:

 

<?php
//Include db connection
include "db.php";
db_connect();
$siteurl="http://mysite.com";
$sitename="Mysite Name";
$youremail="myemail@yahoo.com";
$alloweduses="11";
$headerad="<img src=\"images/banner.gif\" border=0>";
function headers($from,$to,$subject)
{
return "MIME-Version: 1.0\r\n". //optional
   "Content-type: text/html; charset=iso-8859-1\r\n". //optional
   "From: \"".$from."\"\r\n". //required
   "To: \"Client\" <".$to.">\r\n".//required
   "Date: ".date("r")."\r\n".//optional
   "Subject: ".$subject."\r\n";//optional
} 
?>

 

db.php:

 

<?php
function db_connect()
{
$result = mysql_connect("localhost", "username", "password");
if(!$result)
return false;
if(!mysql_select_db("dbname"))
return false;

return $result;
}

?>

Link to comment
Share on other sites

Fatal error: Cannot redeclare headers() (previously declared in /home/mysite/public_html/config.php:9) in /home/mysite/public_html/config.php on line 17

 

remove the headers() function from the config.php file and put it into a separate file afterwards call it using:

 

include_once('headers.php');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.