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: variable for the username  (Read 5046 times)

0 Members and 1 Guest are viewing this topic.

h3lium

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
variable for the username
« on: January 14, 2005, 06:45:16 pm »

hello,
first of all sorry for my english ;-) i'm a german, but i try to do my best...

im currently working on a guestbook for my gallery.
everything is working, exept of one thing, the user have to enter their names manually.
thats what i want to change.
but i dont know how to get the username.
does somebody know how to handle that?
i just need to set the current variable ($name - which the user have to fill in by a form) to the variable of the gallery...

it would be very cool if somebody could help me, cuz spend many hours for this allready :)

greeting
christian
« Last Edit: January 14, 2005, 08:30:22 pm by TranzNDance »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: variable for the username
« Reply #1 on: January 14, 2005, 06:50:08 pm »

this has been asked only recently - search the forum (for "guestbook").

Joachim
Logged

h3lium

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: variable for the username
« Reply #2 on: January 14, 2005, 07:10:08 pm »

sorry, i allready searched, and tried it again now, but i didnt found anything that could match...
thats also why i registered :) , usually i try to find anything befor i register...

in SMF (simply machines forum) its just a simple thing. like "$context['user']['name']"
and thats it...
is there nothing like this in coopermine?
Logged

Nibbler

  • Guest
Re: variable for the username
« Reply #3 on: January 14, 2005, 07:13:27 pm »

If you can include init.inc.php then you have USER_NAME available. If you can't include it then you can use the authentication mod to give you the same.
Logged

h3lium

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: variable for the username
« Reply #4 on: January 14, 2005, 07:19:04 pm »

i included it...
 - require('include/init.inc.php');

and i'm using "$user['user_name']" but that doesn't work ...
i dont know why :(
Logged

Nibbler

  • Guest
Re: variable for the username
« Reply #5 on: January 14, 2005, 07:20:20 pm »

Because there is no such variable! - that's why I said to use USER_NAME :)
Logged

h3lium

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: variable for the username
« Reply #6 on: January 14, 2005, 07:24:53 pm »

that doesnt work too :(
i donna why...


here is a small part of the code:

Code: [Select]
...
    <tr>
     <td><b>';
echo 'Name:';
     echo'</b></td>
     <td>';
echo $USER_NAME;
echo'</td>
    </tr>
    <tr>
...

Code: [Select]
require('include/init.inc.php');
Logged

Nibbler

  • Guest
Re: variable for the username
« Reply #7 on: January 14, 2005, 07:34:02 pm »

I don't understand why you refuse to use USER_NAME

Code: [Select]
<?
define('IN_COPPERMINE', 1);
include 'include/init.inc.php';
echo USER_NAME;
?>
Logged

h3lium

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: variable for the username
« Reply #8 on: January 14, 2005, 07:52:14 pm »

uff...
now its working... :) thanks alot!!!
you really helped me!
problem is solved :)

greetings
chris
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: variable for the username
« Reply #9 on: January 16, 2005, 05:01:29 am »

you just found out what a php constant is ;) - see http://www.php.net/manual/en/language.constants.php

Joachim
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 24 queries.