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

    please help. pt2

    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Sat Apr 17, 2010 10:44 pm

    i wasnt sure where to put these questions so im putting them here.. on your post Send a registration activation email i tried adding the statement validate if user is greater then 1 i couldnt find where it says retrive password and userlevel from result anywhere in the database.php file i would like to impliment that cause then i can filter who registers and i can make people a level 2 to get in...

    2nd question when i login with main.php at the bottom it shows how many people are online as in members and guests....is there a code i can add to the other pages so it will know when people are on those pages????
    Linchpin311
    Linchpin311


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

    please help. pt2 Empty Re: please help. pt2

    Post  Linchpin311 Sat Apr 17, 2010 11:57 pm

    topic split!
    Linchpin311
    Linchpin311


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

    please help. pt2 Empty Re: please help. pt2

    Post  Linchpin311 Sun Apr 18, 2010 12:04 am

    ill take the last question first...

    wow this is really interesting. you want a bit of code you can put on each individual page that will tell which user is on which individual page? there is no code you can jst copy and paste all nice and neat that will achieve this but im sure with a little brainstorming this can happen... this is a little tricky and im going to have to get back to you on this one. maybe on monday i will have more time to think this over and come up with something.

    and now the first question...

    im assuming you are following the post step by step to get this mod up and running? if you have a fresh install of the login system (or as long as you havent made too many changes to database.php) you can just run a search in your text editor to find the code in the post and change it accordingly. where exactly are you running into a problem?
    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Sun Apr 18, 2010 12:18 am

    as for the showing who is online part i tried adding this that was on the bottom of the main.php page

    <?
    }

    /**
    * Just a little page footer, tells how many registered members
    * there are, how many users currently logged in and viewing site,
    * and how many guests viewing site. Active users are displayed,
    * with link to their user information.
    */
    echo "</td></tr><tr><td align=\"center\"><br><br>";
    echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
    echo "There are $database->num_active_users registered members and ";
    echo "$database->num_active_guests guests viewing the site.<br><br>";

    include("include/view_active.php");

    ?>


    </td></tr>
    </table>


    to my other pages and it just gives me a error on a line message

    and for the other thing yes i was tring to follow word for word on the database part you said look for this line

    /* Retrieve password and userlevel from result, strip slashes */
    $dbarray = mysql_fetch_array($result);
    $dbarray['password'] = stripslashes($dbarray['password']);
    $dbarray['userlevel'] = stripslashes($dbarray['userlevel']);
    $password = stripslashes($password);

    i looked at every single word and line on that page and cant find that any where so i can add the part you said to add...i found where it was talking about the password but it doesnt say any where about the userlevel
    Linchpin311
    Linchpin311


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

    please help. pt2 Empty Re: please help. pt2

    Post  Linchpin311 Sun Apr 18, 2010 12:33 am

    ohhhh... you just want that footer to display on all your pages? i see now, what is the error its giving you?

    and as for your other question...
    alright, well it seems you found a mistake with a 2+ year old post of mine! i see exactly what you are talking about... those lines just arent there in a fresh install! i am about to edit that post but for now lets get this squared away.. if you find
    Code:
          /* Retrieve password from result, strip slashes */
          $dbarray = mysql_fetch_array($result);
          $dbarray['password'] = stripslashes($dbarray['password']);
          $password = stripslashes($password);
    then replace it with
    Code:
          /* Retrieve password and userlevel from result, strip slashes */
          $dbarray = mysql_fetch_array($result);
          $dbarray['password'] = stripslashes($dbarray['password']);
          $dbarray['userlevel'] = stripslashes($dbarray['userlevel']);
          $password = stripslashes($password);

          /* Validate that userlevel is greater than 1 */
          if($dbarray['userlevel'] < 2){
            return 3; //Indicates account has not been activated
          }
    then things should be alright. i seems i was rushed somewhere along the lines and made an error or two... im only human :-/

    lemme know if this fixes things!
    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Sun Apr 18, 2010 12:58 am

    yes just the footer so it will show how many members or guests are on the site...
    and the error it is giving me is

    Parse error: syntax error, unexpected '}' in /home/jknocks/public_html/allies.php on line 121


    and with your suggestion on the other thing i actually did try that by changing that part and adding the one part

    and when i went to try and login under my name with me being a admin level 9 it gave me the message indicates account has not been activated..i even tried with a different user being a level 1 it did the same and i even switched mine from level 9 to level 2 and i still got that message.....i followed every step and stopped at the mail part cause i did not want to send a activation link i wanted it so when people registered that i had to make them a level 2 so they could get in...so i can filter the people registering
    Linchpin311
    Linchpin311


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

    please help. pt2 Empty Re: please help. pt2

    Post  Linchpin311 Sun Apr 18, 2010 7:32 am

    in regards to the parse error...
    im thinking you shouldnt have copied that first } into your code. try removing it and see what happens. also you may run into some formatting issues with what you have copied because it looks as if you have the end parts of an html table pasted in there with that footer. if the footer isnt displaying like you want it to try removing the table code from the footer.

    and for the other question...
    im thinking somewhere along the lines the script isnt fetching your userlevel from the database or its possible that your php distro is much stricter than mine... hmmm. but its weird that it would correctly return your password and not your userlevel. you havent changed the names of any tables or columns in your database have you? ...assuming you havent, try this: in session.php find
    Code:
    else if($result == 3){
      $field = "user";
      $form->setError($field, "* Your account has not been activated yet");
    }
    and change it to
    Code:
    else if($result == 3){
      $field = "user";
      $form->setError($field, "* Your account has not been activated yet. " . $dbarray['userlevel'] . ".");
    }
    that should (hopefully?) show what value the function is returning for your user level. for instance if you try logging in as an admin and still have this problem you should see something like "* Your account has not been activated yet. 9." of course my gut is telling me you'll probably see something like "* Your account has not been activated yet. ." but in any case paste what you see back here and we will take it from there.
    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Sun Apr 18, 2010 2:02 pm

    i took the } out of the top of the one code to see who is online and the page loaded this time but at the bottom of the page i got this errorr

    Fatal error: Call to a member function getNumMembers() on a non-object in /home/jknocks/public_html/allies.php on line 130


    and for the other thing its giving me the same problem when i go to log in using my info being a admin it is giving me a little message above the word user name saying 1 error(s) found
    Username: * Your account has not been activated yet. .

    and givning me your account has not yet been activated to the right of the user name box
    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Mon Apr 19, 2010 1:31 pm

    dont know if you have read that last post or not but if you have scratch that email problem i took it off some people did get it...

    but i think i may have a little bigger problem im using fire fox for my web browser and when i login it takes me to the page just fine and it all works...people that have internet explorer when they login it redirects them to the home page...when they tried using fire fox they got in just fine.... im assuming when they used internet explore it isn't registering that they are logged in and redirects them to the home page...could it be there is a difference how internet explorer and fire fox reads cookies??? cause i know the login script goes by cookies.....any idea why it is doing that or maybe know what to change????
    Linchpin311
    Linchpin311


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

    please help. pt2 Empty Re: please help. pt2

    Post  Linchpin311 Mon Apr 19, 2010 2:47 pm

    I did read the last post but I haven't been home in front of my laptop to test your problems. Its hard to test code on my blackberry.

    Are you testing firefox the right after checking IE? If so make sure you log out before you check in another browser. It is known that the script does not correctly save sessions from browser to browser and this can cause problems when viewing the site in one browser then switching to another without logging out.
    jknocks
    jknocks


    Number of posts : 18
    Registration date : 2010-04-12

    please help. pt2 Empty Re: please help. pt2

    Post  jknocks Mon Apr 19, 2010 3:12 pm

    ok never mind its working in IE now i think my problem was i made a domain name and i was using it to re direct me to the site and i think it was messing it up but i added the domain to my server and its working fine....

    any idea about the one error message??

    and for the other thing its giving me the same problem when i go to log in using my info being a admin it is giving me a little message above the word user name saying 1 error(s) found
    Username: * Your account has not been activated yet. .


    refering to when i try to add to the script to make it where a admin has to change the people from level 1 to level 2 to let them in

    Sponsored content


    please help. pt2 Empty Re: please help. pt2

    Post  Sponsored content


      Current date/time is Fri May 17, 2024 4:26 am