Evy
-
Posts
2 -
Joined
-
Last visited
Posts posted by Evy
-
-
I have done all the coding perfect for 'Script 12.5 - add_entry.php. But if I add details to the title and entry fill in space it shows me the following errors:
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\add_entry.php on line 14
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\add_entry.php on line 15
Warning: mysql_error() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\add_entry.php on line 38
Warning: mysql_close() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\add_entry.php on line 43if it might be the server that I'm using please help me to configure.
Chapter 13 - Putting It All Together
in PHP for the Web: Visual QuickStart Guide (5th Edition)
Posted
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