|
-
Jan 21st, 2009, 09:19 AM
#1
Thread Starter
Addicted Member
Very Urgent, Help Appreciated!
http://www.merkamericaco.com/ is the full address.
http://merkamericaco.com/ results in an odd error.
Once you hit "Buy Now" on any product you get the following:
Headers sent in file: /home/merkamericaco/public_html/index.php on line: 1
Here is the code:
PHP Code:
<?php
/**
* define path to application files
*/
define( 'APPS_FILES', '../apps_files' );
require APPS_FILES . '/config/config.php';
require APPS_FILES . '/init.php';
RPC_Db::addConnection( 'default', $config['database']['default'] );
RPC_Registry::set( 'config', $config );
$router = new RPC_Controller_Router_Rewrite();
$http_host = explode( '.', $_SERVER['HTTP_HOST'] );
if( $_SERVER['SERVER_PORT'] != '443' )
{
if( $http_host[0] != 'secure' && substr( $_SERVER['SERVER_NAME'], 0, 3 ) != 'www' )
{
header( 'Location: http://www.' . $_SERVER['SERVER_NAME'] . '' . @$_SERVER['REQUEST_URI'] );
exit;
}
}
if( $http_host[0] == 'secure' )
{
if( $_SERVER['SERVER_PORT'] != '443' )
{
header( 'Location: ' . WEB_ADDRESS );
exit;
}
$url = $_SERVER['REQUEST_URI'];
if( trim( $url, '/' ) != 'checkout/payment' &&
trim( $url, '/' ) != 'g/callback' &&
trim( $url, '/' ) != 'checkout/index' &&
trim( $url, '/' ) != 'checkout/data' &&
trim( $url, '/' ) != 'checkout/login' &&
trim( $url, '/' ) != 'checkout/register' &&
trim( $url, '/' ) != 'checkout/finish' )
{
header( 'Location: ' . WEB_ADDRESS . '/' . trim( $url, '/' ) );
exit;
}
}
else
{
if( $_SERVER['SERVER_PORT'] == '443' )
{
header( 'Location: ' . WEB_ADDRESS );
exit;
}
$router->rewrite( '^([a-zA-Z0-9\-\_]+)\/c([0-9]+)$', '/category/index/params/id/$2' );
$router->rewrite( '^([a-zA-Z0-9\-\_]+)\/p([0-9]+)$', '/product/index/params/id/$2' );
$router->rewrite( '^([a-zA-Z0-9\-\_]+)\/o([0-9]+)$', '/product/offer/params/id/$2' );
$router->rewrite( '^page\/([a-zA-Z0-9\-]+)$', '/page/view/params/url/$1' );
$router->rewrite( '^admin$', '/admin/auth/login', true );
}
$dispatcher = new RPC_Controller_Dispatcher( PATH_ROOT . DS . 'application' . DS . 'controllers' );
$front = new RPC_Controller_Front( $dispatcher, $router );
try { $front->dispatch(); }
catch( Exception $e ) { if( strpos( $e->getMessage(), 'does not exist' ) !== false ) { header( 'Location: /page_not_found.html' ); exit; } }
RPC_Db::factory()->disconnect();
?>
Obviously this is a major problem for me and I would greatly appreciate any help. If it helps, the person who touched it last said they changed the
PHP Code:
false ) { header( 'Location: /page_not_found.html' ); exit; } }
line but changed it back when they noticed a problem.
-
Jan 21st, 2009, 09:38 AM
#2
Hyperactive Member
Re: Very Urgent, Help Appreciated!
well, first off in order for it to be accessible without the www you need to register that with your nameserver. Did it ever work without the www? The error you are getting is because you are sending headers when headers already exist. By quickly glancing at your code you should not be getting that error if the product exists so there may be more wrong than you think.
If I helped you please rate me.
-
Jan 21st, 2009, 09:56 AM
#3
Thread Starter
Addicted Member
Re: Very Urgent, Help Appreciated!
Yes, I have always accessed parts of my website without www..
Just today it started with these odd messages and that one error message. I notice that these messages only ever show up if you type an incorrect URL, other than when you click buy now on the shopping cart.
-
Jan 21st, 2009, 10:04 AM
#4
Hyperactive Member
Re: Very Urgent, Help Appreciated!
What error message are you getting when you access it without the www. I only get a blank screen. Who is your webhost?
If I helped you please rate me.
-
Jan 21st, 2009, 10:21 AM
#5
Thread Starter
Addicted Member
Re: Very Urgent, Help Appreciated!
When I try without www. I do not get an error message, I get:
-
Jan 21st, 2009, 11:12 AM
#6
Re: Very Urgent, Help Appreciated!
Copy all of the contents out of the file, paste it into notepad and re-save the file.
It looks like they probably saved it as unicode and it added some "invisible" characters to the beginning. That would explain the header issues you're receiving, since it would print out those characters before the header was sent.
-
Jan 21st, 2009, 08:02 PM
#7
Re: Very Urgent, Help Appreciated!
The bytes at the beginning of a unicode file at known as the byte order mark or BOM. Unfortunately version of PHP < 6 can do not interpret unicode files.
Save the file as ASCII and it should be ok.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|