Jump to content

Help with these errors pls


hass1980

Recommended Posts

Hi, can someone help me with the following errors im getting pls. On my index page it looks like that the template folder is having problems displaying on the index.php. All the settings are in the application.php

 

Theses are the following errors.

 

Notice: Undefined variable: CFG in C:\wamp\www\mymarket\index.php on line 21

 

Notice: Trying to get property of non-object in C:\wamp\www\mymarket\index.php on line 21

 

Warning: include(/header.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\mymarket\index.php on line 21

 

Warning: include() [function.include]: Failed opening '/header.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\mymarket\index.php on line 21

 

Notice: Undefined variable: CFG in C:\wamp\www\mymarket\index.php on line 45

 

Notice: Trying to get property of non-object in C:\wamp\www\mymarket\index.php on line 45

 

Warning: include(/footer.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\mymarket\index.php on line 45

 

Warning: include() [function.include]: Failed opening '/footer.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\mymarket\index.php on line 45

 

Here is the code for the index.php

 

<?php
/* index.php (c) 2000 Ying Zhang (ying@zippydesign.com)
*
* TERMS OF USAGE:
* This file was written and developed by Ying Zhang (ying@zippydesign.com)
* for educational and demonstration purposes only.  You are hereby granted the 
* rights to use, modify, and redistribute this file as you like.  The only
* requirement is that you must retain this notice, without modifications, at
* the top of your source code.  No warranties or guarantees are expressed or
* implied. DO NOT use this code in a production environment without
* understanding the limitations and weaknesses pretaining to or caused by the
* use of these scripts, directly or indirectly. USE AT YOUR OWN RISK!
*/

/******************************************************************************
* MAIN
*****************************************************************************/
include("application.php");

$DOC_TITLE = "MyMarket Home";
include($CFG->templatedir."/header.php");
?>

<table width=100%>
<tr valign="top">
	<td class=normal>
		Hello and welcome to MyMarket!  This is the homepage, web masters,
		use this area:
		<ul class=normal>
			<li>Provide a basic map of the site</li>
			<li>Advertise your on-sale items</li>
			<li>Welcome customers to your site</li>
			<li>Do useful things</li>
		</ul>

		<p>To begin shopping, <a href="shopping/">go to the shopping page</a>
		or buy the on-special items to your right.  Your shopping cart is
		always visible on the left side of your screen.  Click it to edit
		the contents of your basket or to check out.
	</td>
</tr>
</table>

<?php
include($CFG->templatedir."/footer.php");
?>

 

Applications.php

 


<?
/* $RCSfile: application.php,v $ (c) 2000 Ying Zhang (ying@zippydesign.com)
*
* $Revision: 1.7 $
* $Date: 2002/09/23 17:31:17 $
* $Author: yingz $
*
* TERMS OF USAGE:
* This file was written and developed by Ying Zhang (ying@zippydesign.com)
* for educational and demonstration purposes only.  You are hereby granted the
* rights to use, modify, and redistribute this file as you like.  The only
* requirement is that you must retain this notice, without modifications, at
* the top of your source code.  No warranties or guarantees are expressed or
* implied. DO NOT use this code in a production environment without
* understanding the limitations and weaknesses pretaining to or caused by the
* use of these scripts, directly or indirectly. USE AT YOUR OWN RISK!
*/

/* turn on verbose error reporting (15) to see all warnings and errors */
error_reporting(15);

/* define a generic object */
class object {};

$CFG = new object;

/* database configuration */
$CFG->dbhost = "localhost";
$CFG->dbname = "mymarket";
$CFG->dbuser = "root";
$CFG->dbpass = "root";

/* directory configuration, if all your mymarket files are in one directory
* you probably only need to set the wwwroot variable.  valid examples are:
*
* $CFG->wwwroot = "http://localhost/mymarket";
* $CFG->wwwroot = "http://localhost/mymarket";
*
* do not include the trailing slash. dirroot is the physical path on your
* server where mymarket can find it's files. for more security, it is
* recommended that you move the libraries and templates ($CFG->libdir
* and $CFG->templatedir) outside of your web directories.
*/
$CFG->wwwroot     = "http:localhost/mymarket";
$CFG->dirroot     = dirname(__FILE__);
$CFG->templatedir = "$CFG->localhost/mymarket/templates";
$CFG->libdir      = "$CFG->localhost/mymarket/lib";
$CFG->imagedir    = "$CFG->localhost/mymarket/images";
$CFG->icondir     = "$CFG->imagedir/icons";
$CFG->bannerdir   = "$CFG->imagedir/banners";
$CFG->support     = "support@mymarket.org";
$CFG->version     = "1.71";
$CFG->sessionname = "mymarket";

/* extended configuration */
$CFG->showsponsor   = true;		// enabled banner advertising
$CFG->currency      = "$";
$CFG->currencyfirst = true;	// show the currency symbol before the price tag

/* define database error handling behavior, since we are in development stages
* we will turn on all the debugging messages to help us troubleshoot */
$DB_DEBUG = true;
$DB_DIE_ON_FAIL = true;

/* load up standard libraries */
require("$CFG->libdir/stdlib.php");
require("$CFG->libdir/dblib.php");
require("$CFG->libdir/mymarket.php");
require("$CFG->libdir/cart.php");

/* setup some global variables */
$ME = qualified_me();

/* start up the sessions, to keep things simple we just have two
* variables, USER containing user information and CART containing
* the user's shopping cart. */
ini_set("session.name", $CFG->sessionname);
session_start();
session_register("USER");
session_register("CART");

/* initialize the USER object if necessary */
if (! isset($_SESSION["USER"])) {
$_SESSION["USER"] = array();
}

/* initialize the CART object if necessary */
if (! isset($_SESSION["CART"])) {
$_SESSION["CART"] = new Cart;
}

$USER = &$_SESSION["USER"];
$CART = &$_SESSION["CART"];

/* connect to the database */
db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
?>






Link to comment
Share on other sites

In your php.ini change the error reporting to:

error_reporting  =  E_ALL & ~E_NOTICE

Restart the webserver.

 

This will get rid of the Notices. However you will have to fix:

Warning: include() [function.include]: Failed opening '/header.php' for inclusion

 

From the Notices

$CFG->templatedir

is not set to anything. Should be an object.

Link to comment
Share on other sites

This looks incorrect:

$CFG->wwwroot     = "http:localhost/mymarket";
$CFG->dirroot     = dirname(__FILE__);
$CFG->templatedir = "$CFG->localhost/mymarket/templates";
$CFG->libdir      = "$CFG->localhost/mymarket/lib";
$CFG->imagedir    = "$CFG->localhost/mymarket/images";
$CFG->icondir     = "$CFG->imagedir/icons";
$CFG->bannerdir   = "$CFG->imagedir/banners";
$CFG->support     = "support@mymarket.org";

 

 

Should be more like:

$CFG->wwwroot     = "http://localhost/mymarket";
$CFG->dirroot     = dirname(__FILE__);
$CFG->templatedir = "/localhost/mymarket/templates";
$CFG->libdir      = "/localhost/mymarket/lib";
$CFG->imagedir    = "/localhost/mymarket/images";
$CFG->icondir     = $CFG->imagedir."/icons";
$CFG->bannerdir   = $CFG->imagedir"./banners";
$CFG->support     = "support@mymarket.org";

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.