Hosting Solutions
mobile_logo Table of Contents

Social Network Header Logic Dynamic Links Example Script

Learn to program php and mysqli logic into your header file that will render dynamic links needed for your social network site users. If the user is not logged in they should see a different set of links than your logged in members. You can also use this area to query numbers that represent the amounts of notifications or friend requests a particular user has in your social network website system. <?php // It is important for any file that includes this file, to have // check_login_status.php included at its very top. $envelope = '<img src="images/note_dead.jpg" width="22" height="12" alt="Notes" title="This envelope is for logged in members">'; $loginLink = '<a href="login.php">Log In</a> &nbsp; | &nbsp; <a href="signup.php">Sign Up</a>'; if($user_ok == true) { $sql = "SELECT notescheck FROM users WHERE username='$log_username' LIMIT 1"; $query = mysqli_query($db_conx, $sql); $row = mysqli_fetch_row($query); $notescheck = $row[0]; $sql = "SELECT id FROM notifications WHERE username='$log_username' AND date_time > '$notescheck' LIMIT 1"; $query = mysqli_query($db_conx, $sql); $numrows = mysqli_num_rows($query); if ($numrows == 0) { $envelope = '<a href="notifications.php" title="Your notifications and friend requests"><img src="images/note_still.jpg" width="22" height="12" alt="Notes"></a>'; } else { $envelope = '<a href="notifications.php" title="You have new notifications"><img src="images/note_flash.gif" width="22" height="12" alt="Notes"></a>'; } $loginLink = '<a href="user.php?u='.$log_username.'">'.$log_username.'</a> &nbsp; | &nbsp; <a href="logout.php">Log Out</a>'; } ?> <div id="pageTop"> <div id="pageTopWrap"> <div id="pageTopLogo"> <a href=""> <img src="images/logo.png" alt="logo" title="Web Intersect 2.0"> </a> </div> <div id="pageTopRest"> <div id="menu1"> <div> <?php echo $envelope; ?> &nbsp; &nbsp; <?php echo $loginLink; ?> </div> </div> <div id="menu2"> <div> <a href=""> <img src="images/home.png" alt="home" title="Home"> </a> <!--<a href="#">Menu_Item_1</a> <a href="#">Menu_Item_2</a> --> </div> </div> </div> </div> </div>

PHP Videos

Social Network Development

Introduction and Building the Design TemplateDatabase Creation and PHP MySQLi Connection Script TutorialMySQL Database Tables Creation Script LogicEstablish htaccess and phpini for apache web site server configurationCreate the Main JavaScript Module and Insert Other Modules TutorialSign Up Form and Email Activation PHP MySQL JavaScript Programming TutorialLog In Form Log Out Script Cookies Sessions User ProfileCron Job Automate Social Network Web Site Maintenance TutorialForgot Account Password Form Email Script Ajax TutorialFriend Add Block System Ajax TutorialSocial Network Header Logic Dynamic Links Example ScriptFriend Lists and Social Network Notifications TutorialUser Profile Photo File Upload HTML Form PHP Parse Script MySQLPhoto Gallery CMS TutorialConversation System Social Network Ajax PHP MySQL TutorialSend SMS Text Messages to Mobile Phone PHP Tutorial