how to session based user information show? how to session based user information show?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

how to session based user information show?

Started by rony446, August 09, 2008, 10:53:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rony446


I created a custom page. I want to show some information of logged in user. this information only show for that user only. like, My Profile. which code i have to copy/changes? I m new in PhP/Mysql.thats why I asked about the code.

example: if rony is logged in, then if he clicks on custom page then it shows some information from "my profile".

Joachim Müller

Take a look how this is being accomplished in profile.php. There is not simple, more straightforward answer than that.

rony446

Quote from: Joachim Müller on August 09, 2008, 11:09:35 AM
Take a look how this is being accomplished in profile.php. There is not simple, more straightforward answer than that.

I tried to way.

1. declaring a session variable like:  $_SESSION['uname']=$_POST['username'];   in login.php and print that session from my custom page. but no result was printed.

2. to find out the solution, once  i linked my custom page with profile.php and another time, i copied some code in my custom page. but both case i got an error when i clicked on my custom link.

Error
  Selected user does not exist ! 


if i click on my profile. then its work properly. what is the problem i could not find.

rony446

thanks Joachim Müller.

I got the solution from another post where u gave this kind of solution.

thank you.

copperminepro

What do you want to display?

If it's all user_data, you can do this:

Create a new .php file in your root directory of the gallery and paste the following:

<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');
pageheader('Your Page Title');
if (
USER_ID) { $user_data $cpg_udb->get_user_infos(USER_ID); } 
?>

<!-- Your Content -->




Let's show the user's id: <?php echo $user_data['user_id'?>
<br />
Show username: <?php echo $user_data['user_name'?>



<!-- Stop Your Content -->
<?php
pagefooter
();
?>




That will load the user's data on your custom pages.

Edit: really late. Rony, please post the link to the solution you used, other users may find Joachim Muller's post more helpful