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


    Admin Edit Users' Information?

    Share

    user04

    Number of posts : 1
    Registration date : 2007-12-02

    Admin Edit Users' Information?

    Post  user04 on Sun Dec 02, 2007 7:47 pm

    Okay so now that I've figured out how to add a user to the DB as the admin, I know need to be able to edit that info from the admin page.

    So I did the following on the admin page:

    Code:

    /* Display table contents */
      echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
      echo "<tr><td><b>Username</b></td><td><b>Level</b></td><td><b>Email</b></td><td><b>Last Active</b></td><td><b>Edit User's Account Info?</b></td></tr>\n";
      for($i=0; $i<$num_rows; $i++){
          $uname  = mysql_result($result,$i,"username");
          $ulevel = mysql_result($result,$i,"userlevel");
          $email  = mysql_result($result,$i,"email");
          $time  = mysql_result($result,$i,"timestamp");
         $edit  = mysql_result($result,$i,"username");
        
          echo "<tr><td>$uname</td><td>$ulevel</td><td>$email</td><td>$time</td><td align=center><a href=../useredit.php?user=$edit>$edit</a></td></tr>\n";
      }


    It works, albeit crudely, to display a 5th column with a hyperlink to the useredit.php page for the referenced user (aka useredit.php?=user=$edit).

    However, when I go to that page, the useredit page notices "who I am" (the admin) and only allows me to edit MY information as opposed to the user I want to edit.

    So I am wondering, do I need a function to be called to bypass the fact that useredit.php is checking to see "who I am" and instead check the $edit variable and edit that account? If so, can someone please advise? I am well versed in Javascript, but PHP is still a novelty for me. If not, can someone please advise on an alternative?

    Thx in advance...
    avatar
    Linchpin311

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

    Re: Admin Edit Users' Information?

    Post  Linchpin311 on Thu Dec 06, 2007 2:58 pm

    i dont know what your situation is, but have you considered phpmyadmin (http://www.phpmyadmin.net/home_page/index.php)? it makes editing anything in your database a breeze...


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    s.w.vanderlaan

    Number of posts : 19
    Age : 38
    Localisation : The Netherlands
    Registration date : 2009-03-22

    Re: Admin Edit Users' Information?

    Post  s.w.vanderlaan on Tue Apr 14, 2009 11:56 am

    Hi,

    I'm also trying to figure this out. Still doesn't work.

    I have phpMyAdmin, but that's for real webmaster. I want somebody else to be able to register new users, delete users and to change user credentials online. Without the need for phpMyAdmin.

    This would be sort of an administrator, the webmaster (me) being a superadministrator.

    If you have an answer... I would be greatful.

    Ciao,

    Sander
    avatar
    Linchpin311

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

    Re: Admin Edit Users' Information?

    Post  Linchpin311 on Tue Apr 14, 2009 4:56 pm

    what i have seen done is create a new page (we'll call it adminuseredit.php) that is only accessible by administrators. the big difference is this file will return the info of the username in the address bar and when changes are made, it will do the same thing.

    you can really copy most of the code from useredit.php but of course you would have to put a few lines of code in there to make sure it functions like you want it to.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Gamer

    Number of posts : 2
    Registration date : 2009-04-21

    Re: Admin Edit Users' Information?

    Post  Gamer on Wed Apr 22, 2009 1:30 pm

    Did any find a solution to this?
    avatar
    Linchpin311

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

    Re: Admin Edit Users' Information?

    Post  Linchpin311 on Wed Apr 22, 2009 8:41 pm

    did you try creating the new file to help you do this?


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Gamer

    Number of posts : 2
    Registration date : 2009-04-21

    Re: Admin Edit Users' Information?

    Post  Gamer on Thu Apr 23, 2009 6:50 am

    "this file will return the info of the username in the address bar and when changes are made, it will do the same thing."

    I am unsure how to do this with the login system, but I will create it without the core if nobody comes with a solution.
    avatar
    Linchpin311

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

    Re: Admin Edit Users' Information?

    Post  Linchpin311 on Thu Apr 23, 2009 6:56 pm

    well the core of this system is just userinfo.php and useredit.php but you are pretty much just looking for lines where the script looks for $session->username (the username of the logged in user for this session) and replacing it with something like $_GET['username']. Of course make sure you have set up username to display in the URL.

    if you are still stuck let me know and i will try to create something to help you out some.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.

    Sponsored content

    Re: Admin Edit Users' Information?

    Post  Sponsored content


      Current date/time is Sun Oct 22, 2017 4:53 pm