PHP Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrrobotto
Forum Commoner
Posts: 40
Joined: Thu Sep 26, 2002 9:30 pm
Contact:

PHP Problem

Post by mrrobotto »

I have been trying to get this E-commerce application to work that I got from devshed.com called mymarket it states that php4 RC1 or greater is required. The server that I am trying to get it to run on is running php4.0.6 which from the information that I have been able to find is greater then php4 RC1.

When I try to run it I get the following error

Warning: Undefined variable: qualified_me in /home/www/ecsbi/lmu/robert/mymarket/application.php on line 49

Fatal error: Call to undefined function: () in /home/www/ecsbi/lmu/robert/mymarket/application.php on line 49

This is the line in the application.php file

Code: Select all

/* setup some global variables */
$ME = qualified_me();
These are the functions in the stdlid file the only thing that I been able to find as possibly being the problem is that in the function the me is lower case and in the application.php file the ME is upper case could this be the cause of the undefined error.

Code: Select all

function me() {
/* returns the name of the current script, without the querystring portion.
 * this function is necessary because PHP_SELF and REQUEST_URI and PATH_INFO
 * return different things depending on a lot of things like your OS, Web
 * server, and the way PHP is compiled (ie. as a CGI, module, ISAPI, etc.) */

	if (getenv("REQUEST_URI")) {
		$me = getenv("REQUEST_URI");

	} elseif (getenv("PATH_INFO")) {
		$me = getenv("PATH_INFO");

	} elseif ($GLOBALS["PHP_SELF"]) {
		$me = $GLOBALS["PHP_SELF"];
	}

	return strip_querystring($me);
}

function qualified_me() {
/* like me() but returns a fully URL */

	$HTTPS = getenv("HTTPS");
	$SERVER_PROTOCOL = getenv("SERVER_PROTOCOL");
	$HTTP_HOST = getenv("HTTP_HOST");

	$protocol = (isset($HTTPS) && $HTTPS == "on") ? "https://" : "http://";
	$url_prefix = "$protocol$HTTP_HOST";
	return $url_prefix . me();
}

function match_referer($good_referer = "") {
/* returns true if the referer is the same as the good_referer.  If
 * good_refer is not specified, use qualified_me as the good_referer */

	if ($good_referer == "") { $good_referer = qualified_me(); }
	return $good_referer == get_referer();
}

function redirect($url, $message="", $delay=0) {
/* redirects to a new URL using meta tags */
	echo "<meta http-equiv='Refresh' content='$delay; url=$url'>";
	if (!empty($message)) echo "<div style='font-family: Arial, Sans-serif; font-size: 12pt;' align=center>$message</div>";
	die;
}
:(
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Hi, I had a play about and the only way I could replicate those error messages was if I put a dollar sign in front of the function call so that:

Code: Select all

$ME = qualified_me();
became

Code: Select all

$ME = $qualified_me();
so you may want to check for this in the actual code just remove the dollar sign if it's there.

Mac
mrrobotto
Forum Commoner
Posts: 40
Joined: Thu Sep 26, 2002 9:30 pm
Contact:

Post by mrrobotto »

What I posted is the actual code.
User avatar
skehoe
Forum Commoner
Posts: 59
Joined: Sun Dec 22, 2002 5:57 am
Location: Denver

Post by skehoe »

Is it possible that there's a space in this line?

$ME = qualified_me();

Between qualified_me and the ()

Making it : $ME = qualified_me ();

I now you said the code you posted is the actual code, but I'm at a loss and just suggesting you check... It could be hard to see.
mrrobotto
Forum Commoner
Posts: 40
Joined: Thu Sep 26, 2002 9:30 pm
Contact:

Post by mrrobotto »

I checked for spaces where you suggested and there wasn't any. everything look ok. Still looking. :(
Post Reply