Advanced search  

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]

Pages: [1]   Go Down

Author Topic: how to session based user information show?  (Read 2902 times)

0 Members and 1 Guest are viewing this topic.

rony446

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
how to session based user information show?
« on: August 09, 2008, 10:53:43 am »


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".
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: how to session based user information show?
« Reply #1 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.
Logged

rony446

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: how to session based user information show?
« Reply #2 on: August 09, 2008, 11:21:31 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.
Logged

rony446

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: how to session based user information show?
« Reply #3 on: August 09, 2008, 12:24:09 pm »

thanks Joachim Müller.

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

thank you.
Logged

copperminepro

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
Re: how to session based user information show?
« Reply #4 on: August 09, 2008, 12:45:53 pm »

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:

Code: [Select]
<?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
Logged
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 15 queries.