Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'registration link'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Question: I have never created a menu system dynamically. I can not figure out how to hide() the register tab if a user is logged in. I am unsure where to start in the header file to do so. Near the bottom of the code is where we decide if we should show the log in page within the index page. I figure I would have to start there, or change the dynamic code to check for this first? I'm such a newbie... LOL Any help, or ideas would be most appreciated. Thank you, The Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title><?php // Use a default page title if one was not provided... if (isset($page_title)) { echo $page_title; } else { echo 'Knowledge is Power: And It Pays to Know'; } ?></title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Custom styles for this template --> <link href="css/sticky-footer-navbar.css" rel="stylesheet"> </head> <body> <!-- Wrap all page content here --> <div id="wrap"> <!-- Fixed navbar --> <div class="navbar navbar-fixed-top"> <div class="container"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php">Knowledge is Power</a> <div class="nav-collapse collapse"> <ul class="nav navbar-nav"> <?php // Dynamically create header menus... // Array of labels and pages (without extensions): $pages = array ( 'Home' => 'index.php', 'About' => '#', 'Contact' => '#', 'Register' => 'register.php' ); // The page being viewed: $this_page = basename($_SERVER['PHP_SELF']); // Create each menu item: foreach ($pages as $k => $v) { // Start the item: echo '<li'; // Add the class if it's the current page: if ($this_page == $v) echo ' class="active"'; // Complete the item: echo '><a href="' . $v . '">' . $k . '</a></li> '; } // End of FOREACH loop. // Show the user options: if (isset($_SESSION['user_id'])) { // Show basic user options: // Includes references to some bonus material discussed in Part Four! echo '<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="logout.php">Logout</a></li> <li><a href="renew.php">Renew</a></li> <li><a href="change_password.php">Change Password</a></li> <li><a href="favorites.php">Favorites</a></li> <li><a href="recommendations.php">Recommendations</a></li> </ul> </li>'; // Show admin options, if appropriate: if (isset($_SESSION['user_admin'])) { echo '<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="add_page.php">Add Page</a></li> <li><a href="add_pdf.php">Add PDF</a></li> <li><a href="#">Something else here</a></li> </ul> </li>'; } } // user_id not set. ?> </ul> </div><!--/.nav-collapse --> </div><!--/container--> </div><!--/navbar--> <!-- Begin page content --> <div class="container"> <div class="row"> <div class="col-3"> <h3 class="text-success">Content</h3> <div class="list-group"> <?php // Dynamically generate the content links: $q = 'SELECT * FROM categories ORDER BY category'; $r = mysqli_query($dbc, $q); while (list($id, $category) = mysqli_fetch_array($r, MYSQLI_NUM)) { echo '<a href="category.php?id=' . $id . '" class="list-group-item" title="' . $category . '">' . htmlspecialchars($category) . ' </a>'; } ?> <a href="pdfs.php" class="list-group-item" title="PDFs">PDF Guides </a> </div><!--/list-group--> <?php // Should we show the login form? if (!isset($_SESSION['user_id'])) { require('login_form.inc.php'); } //I figure here is where I could add an (isset($_SESSION['user_id']. hide() or something. I can't figure it out. ?> </div><!--/col-3--> <div class="col-9"> <!-- CONTENT --> 0 Quote MultiQuote Edit
×
×
  • Create New...