php code problem

Discussion in 'PHP' started by yoyoo, Oct 11, 2007.

  1. yoyoo

    yoyoo New Member

    Joined:
    Oct 11, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    okay i got these code it gives me an error once i try to compile it anybody to help please
    PHP:
    <?php
    /* A collection of commonly used functions in OnLib */

    require_once("conf.php");
    function 
    clean($input,$maxlength)
    {
    $input=substr($input,0,$maxlength);
    $input=Escapeshellcmd($input);
    return 
    $input;
    }
    function 
    showerror()
       {
    ?>
    <html><body><p><p><p><p><p><p>    <?
          die("Error " . mysql_errno() . " : " . mysql_error());
       }
    function isadmin()
    {    
        if($_SESSION['bo_id'] != "ADMIN")
            {
            global $wwwroot;
            include("style.html");
            ?>
                <html><head><title>Must Be admin</title>
                <meta http-equiv="Refresh"
                    content="5 ; URL=<?=$wwwroot?>/userf/login.php">
                </head>
                <br><br><center>
                <font color="brown"><h4>Only Administerators Can Access This Page</h4></font>
                <br>You will be redirected to <a href="<?=$wwwroot?>/userf/login.php">Login Page</a> in 5 seconds
                </center></body></html>

            <?
            exit;
            }
    }

        
    ?>
     
    Last edited by a moderator: Nov 16, 2007
  2. pete_bisby

    pete_bisby New Member

    Joined:
    Nov 11, 2007
    Messages:
    48
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    Software Developer/Analyst, PB
    Location:
    Manchester, England
    Home Page:
    http://www.pbworld.co.uk
    ..... what's the error?

    If it's something to do with sessions, you will need to put session_start() at the top of your code, or else your session information will not be visible.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice