Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Unexpected Error, Undefined variable???
Propeng
post Sep 29 2007, 09:15 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 11
Joined: 24-September 07
Member No.: 25,093


Is this script correct?

index.php:
CODE
<?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:
CODE
<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:
CODE
<?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:
QUOTE
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.

This post has been edited by Propeng: Sep 29 2007, 09:18 AM
Go to the top of the page
 
+Quote Post
TavoxPeru
post Sep 29 2007, 11:46 AM
Post #2


Super Member
Group Icon

Group: [HOSTED]
Posts: 818
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579
myCENTs:3.57


QUOTE(Propeng @ Sep 29 2007, 04:15 AM) [snapback]111618[/snapback]
main.php:
CODE
<?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:
CODE
<?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,
Go to the top of the page
 
+Quote Post
robert2411
post Sep 29 2007, 08:37 PM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 23
Joined: 27-September 07
Member No.: 25,159


put this error_reporting(E_ALL); abover you main script directly after <?php
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   5 derouge 1,542 30th November 2008 - 07:16 AM
Last post by: iG-Rev.Keith Ratliff
No New Posts   2 xboxrulz 241 3rd November 2008 - 12:00 AM
Last post by: xboxrulz
No New Posts   6 xboxrulz 215 23rd October 2008 - 06:44 PM
Last post by: xboxrulz
No New Posts   6 Gollum 1,290 13th October 2008 - 04:05 PM
Last post by: Mordent
No New Posts   5 skedad 374 12th October 2008 - 05:24 AM
Last post by: skedad
No New Posts   0 khalilov 204 5th September 2008 - 08:14 PM
Last post by: khalilov
No New Posts   6 Eggie 1,165 24th August 2008 - 10:12 PM
Last post by: Guest
No New Posts   2 mingkus 199 21st August 2008 - 06:20 PM
Last post by: wutske
No New Posts   2 Gr33nN1nj4 292 20th August 2008 - 01:25 AM
Last post by: Gr33nN1nj4
No New Posts   0 rahulappe 330 1st August 2008 - 08:48 AM
Last post by: rahulappe
No New Posts   8 hihihihi88 1,843 30th July 2008 - 09:48 PM
Last post by: Guest
No New Posts   5 LuPPy 979 22nd July 2008 - 11:37 AM
Last post by: Guest
No New Posts 6 ajayshivaa 1,551 19th July 2008 - 01:58 AM
Last post by: Guest
No New Posts   7 LacrosseMS 796 4th July 2008 - 09:12 PM
Last post by: TavoxPeru
No New Posts   5 Miles 943 3rd July 2008 - 02:46 PM
Last post by: tansqrx