Jump to content
Larry Ullman's Book Forums

Chapter 13 - Putting It All Together


Recommended Posts

The User Defined Function is not being undefined on the login page. Its shoeing this error message : Fatal error: Call to undefined function is_administrator() in /home/moshpjkm/public_html/templates/footer.html on line 3.

 

This is the function.php page and I save it in includes directory

<?php // Script 13.2 - functions.php
/*This page defines custom functions*/

//This function checks of the user is the administrator
//This function take two optional values
//This function returns the Boolean value
if((function is_administrator($name= 'Samuel', $value='Clemens')){
    
    //Check for cookie and check for its value
    if(isset($_COOKIE[$name]) && ($_COOKIE[$name] == $value)){
        return true;
    }else{
        return false;
    }
}//end of is_administrator() function

?>

 

This is the footer section

    <!----END CHANGEABLE CONTENT----->
    <?php

     if((is_administrator() && (basename($_SERVER['PHP_SELF']) != 'logout.php')) OR (isset($loggedin) && $loggedin)){
          
          //Create the links
           print '<hr /><h3>Site Admin</h3><p><a href="add_quote.php">Add Quote</a><->
           <a href="view_quotes.php">View All Quotes</a> <->
           <a href="logout.php">Logout</a></p>';
     }
    
     ?>
     </div> <!----Container----->
    
     <div id="footer">Content © 2011</div>
 

</body>
</html>

 

If there is another way to accomplish this, please advise

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...