PHP Login System with Admin Features

Would you like to react to this message? Create an account in a few clicks or log in to continue.
PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


2 posters

    Moving buttons/functions onto other pages

    avatar
    abbo


    Number of posts : 5
    Registration date : 2008-05-09

    Moving buttons/functions onto other pages Empty Moving buttons/functions onto other pages

    Post  abbo Thu Oct 08, 2009 3:31 am

    Hi,

    How would I go about moving some of the buttons like admin, view account onto a header include so they would be visible wherever you you are on the site? I have moved the session.php include without problems but I am unable to get the buttons to work anywhere else except on main.php.

    Also is it possible to break up the admin page so all the functions aren't listed at the same time to make the page smaller?

    I would appreciate any help.

    Thanks
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    Moving buttons/functions onto other pages Empty Re: Moving buttons/functions onto other pages

    Post  Linchpin311 Thu Oct 08, 2009 9:31 pm

    of course these are both possible. i have made a few amendments to the script so anyone who is logged in has access to all the links they have permission to click on site wide. its not a very hard thing to do.

    of course every page needs to include session.php, after that its just a matter of putting the links you want to display inside of the function to check to see if a user is logged on.

    how are you trying to accomplish this, post some code and i'll tell you what i see.
    avatar
    abbo


    Number of posts : 5
    Registration date : 2008-05-09

    Moving buttons/functions onto other pages Empty Re: Moving buttons/functions onto other pages

    Post  abbo Sat Oct 10, 2009 7:18 am

    Thanks for the reply, I ahve tree files as below, I want to move the menu options shown on main when you login to the header. The session include is in the header and i tried just copying the if($session->logged_in){ part to the header as well but then the page wont display at all. Is it as simple as this or do i need to add something else?

    header.php
    Code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="GB">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php
    include("session.php");
    ?>
    <?
    /**
     * User has already logged in, so display relavent links, including
     * a link to the admin center if the user is an administrator.
     */
    if($session->logged_in){
      //echo "<h1>Logged In</h1>";
      echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
          ."<a href=\"userinfo.php?user=$session->username\" class=\"button\">My Account</a>"
          ."<a href=\"useredit.php\" class=\"button\">Edit Account</a>";
      if($session->isAdmin()){
          echo "<a href=\"admin/add_agent.php\" class=\"button\">Add Agent</a>";
         echo "<a href=\"admin/edit_ggent.php\" class=\"button\">Edit Agent</a>";
         echo "<a href=\"admin/points.php\" class=\"button\">Points</a>";
         echo "<a href=\"admin/price_list.php\" class=\"button\">Price List</a>";
         echo "<a href=\"admin/co_account.php\" class=\"button\">Company Account</a>";
         echo "<a href=\"admin/suspend_account.php\" class=\"button\">Suspend Account</a>";
         echo "<a href=\"admin/admin.php\" class=\"button\">Admin Center</a>";
      }
      echo "<a href=\"process.php\" class=\"button\">Logout</a>";
    }
    else{
    ?>

    </head>
    <body>
    <div>

    index.php
    Code:

    <?php require_once("header.php"); ?>
    content here....
    <?php require_once("footer.php"); ?>

    footer.php
    Code:

    </div>
    </body>
    </html>
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    Moving buttons/functions onto other pages Empty Re: Moving buttons/functions onto other pages

    Post  Linchpin311 Sat Oct 10, 2009 4:46 pm

    well this looks all good and fine to me so we'll start with the same general questions.

    Local or live server? Is php spitting any errors at you? Most of your code is using full <?php ?> tags (as opposed to <? ?>) but is your whole script?

    If error reporting is off try turning it on and seeing if php is giving you any errors. Also you say it doesnt look like $session->logged_in is even working. do you have any way to see if you are logged in, you may be running into some sort of error and are getting logged out right after you attempt to log in.

    I would try going back to the drawing board and getting the basic script to work and function as you know it should and then one step at a time try working some of your own code in there to see if theres some sort of human error going on here...

    let me know what you find.

    Sponsored content


    Moving buttons/functions onto other pages Empty Re: Moving buttons/functions onto other pages

    Post  Sponsored content


      Current date/time is Fri May 17, 2024 8:02 am