Jump to content

how to make this script works on php5


arn_php

Recommended Posts

Hi there, I have been trying to make this config.php below to work on php5 environment. Any error? I can't see any. Or maybe I miss a thing here. I know that I could find help from php.net, from its documentation section. But to be honest with you, the more I read the more confuse I am.  Well, I don't have any basic education on php at all. So please help.

 

Here is the background of this issue. I have this script written in php4 originally but then we need to move to php5. So I tried to load my site into php5 server and found out that the config.php file is not read properly by php5.  The config.php below is actually linked from index.php with this code: <?php include_once('_init.php'); ?> then from _init.php:

<?php session_start();

include_once('config.php');
// and some other codes
$_SESSION['init'] = 'done';
?>

Here is the config.php:

<?php
// Site title
define('SITE_TITLE', 'My Title goes here');
// contact title
define('CONTACT_TITLE', 'Website Contact form');

// contact form email
define('CONTACT_EMAIL', 'my@email.com');
define('ADMIN_EMAIL', 'my@email.com');

// sessions
define('SESS_USER', 'my_user');
define('SESS_ADMIN', 'my_session');
//date formatting
define('DATE_FORMAT', 'd-m-Y');
define('DATE_FORMAT1', 'd-m-Y H:i');
//PATHS
define('PATH_DATA_FILES', 'data_files/');
define('PATH_INCLUDES', 'includes/');
//paths for DYNAMIC EXTRANET
define('EXTRANET_DIRECTORY', '../');
define('EXT_DIR_PARAMETERS', 'parameters/');
//*************************************************************************************************

?>

Link to comment
Share on other sites

I thought you said this was the config.php? So why does it have,

 

<?php 
session_start();

include_once('config.php');
(and some other codes)

no that code is from _init.php

it calls config.php

the third block of code from arn_php is config.php

the first line

<?php include_once('_init.php'); ?>

is from index.php

the second set is _init.php

and the last set is config.php

 

Scott.

Link to comment
Share on other sites

When I run this website into php5 environment, the config.php is not read properly. As example, the site title is not read as "My Title goes here" but "<?= SITE_TITLE; ?>". Same as others.. are you sure it runs well on yours? What do I do wrong? Or do you think it was on other file that cause it?  Actually others are running just fine.

 

Into the _init.php: (everything works ok, only the config.php isn't read properly)

<?php

session_start();

 

include_once('config.php');

include_once('includes/function.php');

include_once('parameters/parameters_multilanguage.php');

include_once('parameters/config_arrays.php');

include_once('parameters/parameters_mysql.php');

include_once('parameters/parameters_extranet_paths.php');

 

$connection = @mysql_connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASS) or error_report($PHP_SELF, 'MYSQL_CONNECT', mysql_error());

@mysql_select_db(MYSQL_DB) or error_report($PHP_SELF, 'MYSQL_SELECT_DB', mysql_error());;

$_SESSION['init'] = 'done';

?>

Link to comment
Share on other sites

To: PFMaBiSmAd

Do you mean if I use <?php echo 'SITE_TITLE'; ?> will work insted of <?= SITE_TITLE; ?> ? If so, is there any shorten ways to fix this? I mean I have about 150 sites to fix then..

 

To: ratcateme

What do you mean of adding print_r($GLOBALS); to index.php?

Do you mean to add it as something like this:

<?php

include_once('_init.php');

print_r($GLOBALS);

?>

 

Will it help the issue above?

Link to comment
Share on other sites

  • 3 weeks later...

Ok, I have the short_tags ON,the website is ok (http://www.edubenefit.com) but then the extranet I have is a mess now.  you may take a look here:

http://www.edubenefit.com/extranet (can't access it, why? in php4, it works just fine)

http://www.edubenefit.com/extranet/index.php (you have add the index.php to pull up the page but then you can see there is an error on the top: "Notice: Constant DELETE_IMAGE_REQUIRED already defined in d:\edubenefit.com\extranet\language.php on line 92"  What is this? in php4 everything is smooth)

 

What do I need to do? the phpinfo is this: http://www.edubenefit.com/info.php (I do not have access to the config of its php, if I do what I need to change in order to make the extranet to work?)

 

Thanks, Arnold

 

 

Link to comment
Share on other sites

Thanks, do you know why I can't access the extranet just adding /extranet after the domain as before? I have to put /extranet/index.php now.

 

By the way, once I log in, this is the error message I received:

Notice: Use of undefined constant ENABLE_ACCESS_LOG - assumed 'ENABLE_ACCESS_LOG' in d:\edubenefit.com\extranet\login.php on line 29

 

Warning: Cannot modify header information - headers already sent by (output started at d:\edubenefit.com\extranet\login.php:29) in d:\edubenefit.com\extranet\login.php on line 41

 

Warning: Cannot modify header information - headers already sent by (output started at d:\edubenefit.com\extranet\login.php:29) in d:\edubenefit.com\extranet\login.php on line 43

 

It should actually take me to main.php.

Link to comment
Share on other sites

I have been trying to paste the login php here, but then the page bounce me blank all the time. Here is the line 29:

if((ENABLE_ACCESS_LOG == 1) && is_dir(EXT_SERVER_PATH.'logs/')){

 

And here is the line 41 to 43:

setcookie('cms_authentification', md5(session_id()), time()+3600*60);

mysql_close($connection);

header("Location:main.php");

 

Link to comment
Share on other sites

I actually commented it out like this:

/* if((ENABLE_ACCESS_LOG == 1) && is_dir(EXT_SERVER_PATH.'logs/')){ blah... blah...

}*/

 

Then it works fine, taking me to main.php.  What does that do actually, I mean the code above. Why is it working just ok in php4 but not in php5.  Is there anything I need to change on the php config file in this php5?

 

Anyhow, when I am in main.php.. this is the error messages that show up (so much trouble with this php5 - can anybody help me please?):

Notice: Undefined index: mainsection in d:\edubenefit.com\extranet\libs\lib_extranet_util_functions.php on line 114

This is the code on line 114 of lib_extranet_util_functions.php:

        if($row['esid'] == $_GET['mainsection']){

        echo '<img src="imgs/icon_arrow_down.gif" /> <a href="main.php?'.generate_url_parameters(array('mainsection'=>$row['esid']), 'new').'" class="menu_on">'.stripslashes($row['name']).'</a>';

        echo '<br /><div class="submeniu">';

        generate_submenus($row['esid']);

        echo '</div>';

        }else{

 

Another error messages on main.php

Notice: Undefined index: op in d:\edubenefit.com\extranet\main.php on line 82

Notice: Undefined index: section in d:\edubenefit.com\extranet\main.php on line 154

 

switch($_GET['op']){--------------> line 82

if( (($_GET['section'] != '') && ($_GET['section'] != 'mainmenu')) ){--------------> line 154

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.