Jump to content
xisto Community
Propeng

Unexpected Error Undefined variable???

Recommended Posts

Is this script correct?

 

index.php:

<?php	if (isset($_COOKIE["disp_name"]))		  $_GET['name'] = $_COOKIE['disp_name'];	else		setcookie("disp_name", Anonymous, date()+99);?><html>	<head>		<title>Display Name - DZN</title>		<!-- METAS -->		<meta name="verify-v1" content="oyEmG+TJ87xHGXl8NQS6GHJ8rcRDkFG4oXnYWtqddGk=" />	</head>	<body>		<div align="center">			<form action="proccess.php" method="get">				<?php if ($_GET["name"]=="") {$_GET['name']="Anonymous";} ?>				Dislpay Name: <input type="text" value=<?php echo $_GET['name']; ?> name="name" />				<input type="submit" value="Enter Website!" />			</form>		</div>		<?php $wn = "Download Zone Network"; $swn = "DZN"; ?>	</body></html>

proccess.php:

<head>	<title>Proccessing Request...</title>	<meta http-equiv="Refresh" content="1; URL=main.php" />	<b>Please wait...</b></head><?php	setcookie("disp_name", $_GET['name'], date()+99);?>

main.php:

<?php	function customError($errno, $errstr) 	{  		echo "<div align='center'><b>Error:</b> [$errno] $errstr<br /></div>"; 		echo "<div align='center'>Ending Script</div>"; 		die(); 	}?><?php //Page Config.	//REQUIRE	  $_GET['name'] = $_COOKIE['disp_name'];	  /* do: echo (remember) */	  //		  echo $_GET['name']		  //	  if ($_COOKIE['disp_name']=="")	  {		$_GET['name'] = "Guest";	}	function currentlyOnline()	{		echo "";	} 	set_error_handler("customError"); 	function showCO ($showCO) 	{		echo "ddd";	}	while ($showCO=="true") 	{		showCO();	}?><?php	echo "<title>Welcome back, " . $_GET['name'] . "! - DZN</title>";	showCO ($showCO);	$showCO = "true";?>
(Not all the file; just the piece that encounters the problem)

 

Everything goes fine, but when i enter main.php, it displays:

Error: [8]Undefined variable: showCO

Ending Script


Is this script wrong? If it has, please reply. I know that the problem is in the main.php only, but i copied all of them if you want to test it.
Edited by Propeng (see edit history)

Share this post


Link to post
Share on other sites

main.php:

<?php	function customError($errno, $errstr) 	{  		echo "<div align='center'><b>Error:</b> [$errno] $errstr<br /></div>"; 		echo "<div align='center'>Ending Script</div>"; 		die(); 	}?>
(Not all the file; just the piece that encounters the problem)

 

Everything goes fine, but when i enter main.php, it displays:

Is this script wrong? If it has, please reply. I know that the problem is in the main.php only, but i copied all of them if you want to test it.

I think that the problem is related with the brackets that you use in your customError() function. Try this:

<?php	function customError($errno, $errstr) 	{  		echo "<div align='center'><b>Error:</b> [" . $errno . "] $errstr<br /></div>"; 		echo "<div align='center'>Ending Script</div>"; 		die(); 	}?>
Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.