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

 Share

×
×
  • Create New...