22, November 2008

view user_profiles from every user like viewing the own - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: view user_profiles from every user like viewing the own
« previous next »
Pages: [1] Print

Author Topic: view user_profiles from every user like viewing the own  (Read 1416 times)
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« on: May 07, 2007, 01:49:03 AM »

I've installed this class and it seens to be great :-) thanks

I will need a function for the admin to view and edit all users profiles like every user can view and update there own. I would like to  change every users data from a protected page. No it's only possibe to change the data from one table where the login,pw ... is stored. The admin is not able to change data from the user_profie tabe. How can I use update_user_profile.php as admin to change user data? How would this be possible? Do we need work around or is there a good solution?

Maybe it is possibe already and I don't know how to use it.

tom
« Last Edit: May 07, 2007, 11:20:20 AM by tomz »
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



Re: view user_profiles from from every user like viewing the own
« Reply #1 on: May 07, 2007, 05:48:44 AM »

I've installed this class and it seens to be great :-) thanks

I will need a function for the admin to view and edit all users profiles like every user can view and update there own. I would like to  change every users data from a protected page. No it's only possibe to change the data from one table where the login,pw ... is stored. The admin is not able to change data from the user_profie tabe. How can I use update_user_profile.php as admin to change user data? How would this be possible? Do we need work around or is there a good solution?

Maybe it is possibe already and I don't know how to use it.

tom

if im not mistaken, trying to read your somewhat bad english... you are saying currently on your site you can only edit your own profile, but as an administrator you can not edit any users data? .. just make a new page, and protect it with a simple if else statement, running the same update_profile.php script except changing the sql query from "WHERE user_id = $logged['id']" it would be "Where user_id =$data[id] " or something similair.. of course the page will need some minor modifications.. but either way you will have to make a new page for the admin area to edit accounts Smiley

Code:
<?php
if ($logged['level'] > 4){
if ($_POST['update']){
$value1 $_POST['value1']; 
$value2$_POST['value2']; 
$update mysql_query("UPDATE users 
SET value1 = '$value1', value2 = '$value2' 
WHERE user_id = "
.$_GET['id']);
if ($update) echo "Success!";
}
$result mysql_query("SELECT * FROM users WHERE user_id = ".$_GET['id']);
$data mysql_array($result);
echo "...the form, and profile fields for editing..";
} else {
echo "You do not have the correct level of access for this page...";
}
?>



The above snippet of code is only a universal example of updating a users profile via a protected page based on a field in the logged-in-users table..
« Last Edit: May 07, 2007, 05:55:07 AM by Meth0d »

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: May 07, 2007, 09:58:57 AM »

Hello Tom,

yes you're right at the moment the "admin" extension is only for the user table. There is a plan to have this feature (also a user list) for future versions. But maybe this will be a part of of some future "premium" version.

In the meantime check the profile extension and try to implement the methods into the admin extension.

@method, right the admin (owner) can edit everything (via phpmyadmin), but the class is written to protect some things.


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #3 on: May 07, 2007, 11:19:56 AM »

Code:
<?php
if ($logged['level'] > 4){
if ($_POST['update']){
$value1 $_POST['value1']; 
$value2$_POST['value2']; 
$update mysql_query("UPDATE users 
SET value1 = '$value1', value2 = '$value2' 
WHERE user_id = "
.$_GET['id']);
if ($update) echo "Success!";
}
$result mysql_query("SELECT * FROM users WHERE user_id = ".$_GET['id']);
$data mysql_array($result);
echo "...the form, and profile fields for editing..";
} else {
echo "You do not have the correct level of access for this page...";
}

echo "You do not have the correct level of access for this page...";
}
?>

I would like to see/edit the users data in users_profile as admin simular to admin_user.php but there it is only possibel to view/edit the data from the useres tabel and not from the users_profile tabel. I would like to view/edit the users_profile data table as well.

Do you mean that would be possible with your code snippset?
I think it must be something with the use of admin_user.php and update_users_profile.php
I hope you got me right ...

tom
« Last Edit: May 07, 2007, 11:22:47 AM by tomz »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: May 07, 2007, 11:31:29 AM »

read my post before (note the snippet from method is not related to the class)


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #5 on: May 07, 2007, 11:58:36 AM »

read my post before (note the snippet from method is not related to the class)
Do you think it would be a security  or some else problem to use an other script protcted with your class with the default_admin_level to show datas from the users_profile table?

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: May 07, 2007, 12:49:37 PM »

read my post before (note the snippet from method is not related to the class)
Do you think it would be a security  or some else problem to use an other script protcted with your class with the default_admin_level to show datas from the users_profile table?



I created the admin extension to protect the user to edit his own data via the this script and to have the possibility to handle access levels.

of course you can create a script also without the access protection from the script using .htaccess for example...


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #7 on: May 07, 2007, 01:09:10 PM »

...
of course you can create a script also without the access protection from the script using .htaccess for example...
Why htaccess? I only need is an script to show the users_profile. It shoult be possible with your class to protect this too. My question was if it is an secrurity issue to do this but I think not because only the admin can use this by using your protection class.

I've simply added
Code:
$update_profile->user =  $_POST['get_user'];
     to change the user to look for by postig the login using a form and i seems to work. What do you think about it?
« Last Edit: May 07, 2007, 01:53:47 PM by tomz »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: May 07, 2007, 05:43:17 PM »

the user var can't the same than the user var where to change the details


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #9 on: May 07, 2007, 05:55:33 PM »

the user var can't the same than the user var where to change the details
I changed it to the method from POST to GET to SELECT the $update_profile->user and it works but I get errors if I try to UPDATE it. That problem seems to belong to the $_POST['login'] var. What's your idea to solve it?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #10 on: May 07, 2007, 08:22:49 PM »

the user var can't the same than the user var where to change the details
I changed it to the method from POST to GET to SELECT the $update_profile->user and it works but I get errors if I try to UPDATE it. That problem seems to belong to the $_POST['login'] var. What's your idea to solve it?

as in my comment before, in the current admin extension is NO support fro the profile, If you created the code by yourself then post it here if you have the problems (check the code from the profile extension first)


Last blog : Just a better Internet portal provided by Google
Cyberpunk Wannabe
*
Gender: Male
Posts: 43
280 credits
Members referred : 0


Lolo means Grandpa in the Philippines!


« Reply #11 on: May 11, 2007, 05:57:51 AM »

I will need a function for the admin to view and edit all users profiles like every user can view and update there own. I would like to  change every users data from a protected page.

tom

Hi Tom, an interesting idea.  I am just curious why you would want to do that?  Olaf's script addresses problems (like lost or forgotten access data, login, password, etc.).  Why would you want to do that with simple profile data?  Once you reset a users password then they could change their own profile data.

You could, from the admin panel, change the password and then access the user the normal way!  Of course that would leave the user without a workable password (perhaps a good thing!).

Here are a couple another ideas...

1)
Under third party mods
http://www.webdigity.com/index.php/topic,5503.0.Different+Users+-+Different+parts+of+each+page%21.html Visit through proxy
There is an easy way to add the access_level to the $_SESSION array.

Using access_level 10 for a test, you should be able to copy and modify
ext_user_profile.php
and
upate_user_profile.php
for an admin page that will allow what you want.

That may be a bit deep... But if, as you say, you "need" that function then it is worth talking the time to do (or pay Olaf to do it for you!)

2)
Merge the needed parts of
ext_user_profile.php
into the top of
admin_user.php

Then add the needed parts of
update_user_profile.php
to the bottom of
admin_user.php

That should give you an Admin page that you can use to change all fields except those protected by the class (login, etc).

To me the second option looks like more work but it means not changing the access_user_class.php  That can be important when Olaf releases the next version.

For me the two tiny mods at http://www.webdigity.com/index.php/topic,5503.0.Different+Users+-+Different+parts+of+each+page%21.html Visit through proxy
are so easy I just do them on each mod before uploading our sites...
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6528
Tags : view user_profiles from from every user Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: view user_profiles from every user like viewing the own
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 03:05:38 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.736
Total Topics: 7.650
Total Members: 4.396
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: thomas09

37 Guests, 4 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.