different text depends on if you are logged in or not? different text depends on if you are logged in or not?
 

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

different text depends on if you are logged in or not?

Started by hooch, November 09, 2004, 11:42:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hooch

Hi!

I have a text in anycontent who says hello and welcome blabla.. register to see the pictures..
but i dont want this to be seen if you already are logged in, then i want another text..

how do i do this? with come kind of if-thing but how do it wkow if im logged in or not?

/Gustav

Joachim Müller

Put this code into anycontent.php<?php
if (USER_ID) {
    
// do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user
} else {
    print 
'You\'re not logged in. If you were, you could do so many things you currently can\'t.<br />Click <a href="login.php">login</a> if you already have an account for this site or <a href="register.php">register</a> to sign up for a new account.';
}
?>


Joachim

hooch


fareforce

Quick question about this. This is what I put in for the script

Quote<?php
if (USER_ID) {
print 'Welcome to AlaskaStudio.com, and thank you for logging in. As a member

of AlaskaStudio.com you have full access to all functions of this site. We

recently added <b>ecards</b>! Please tell your freinds about this site by

sending them an ecard.';
    // do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user
} else {
    print 'You\'re not logged in. If you were, you could do so many things you

currently can\'t.<br />Click <a href="login.php">login</a> if you already have

an account for this site or <a href="register.php">register</a> to sign up for

a new account.';
}
?>

Is there a way to make it say Welcome "username"?
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Nibbler


bbt2993


Joachim Müller

Quote from: bbt2993 on January 07, 2005, 11:35:21 AM
where and how do you use the "constant USER_NAME"
Not at all if you're no PHP coder.

Joachim

bbt2993

Hi

In starttable("100%", "Velkommen"); after "Velkommen"

<?php
// ------------------------------------------------------------------------- //
// CVS version: $Id: anycontent.php,v 1.5 2004/07/24 15:03:52 gaugau Exp $
// ------------------------------------------------------------------------- //

starttable("100%""Velkommen");

?>

<tr><td class="tableb" >
<?php
if (USER_ID) {
    
// do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user
} else {
    print 
'Du er ikke loget ind. Hvis du var kunne du så meget mere end du kan nu.<br />Klik <a href="login.php">log ind</a> hvis du allerede er oprettet som bruger eller <a href="register.php">opret bruger</a> for at oprette en konto.';
}
?>

</td></tr>
<?php
endtable
();

?>

tomrock

Quote from: bbt2993 on January 07, 2005, 11:35:21 AM
where and how do you use the "constant USER_NAME"

Something like

echo USER_NAME . " thanks for logging in.";





simplyzen

In the theme.php can we use php code?  i.e. will it work if it's place in a $template_main_menu1 = <<<EOT EOT; section?

Nibbler

No. If you want to add php then stop the heredoc, add your code, and resume it.

qt4eva

Quote from: tomrock on April 06, 2005, 04:35:01 PM
Quote from: bbt2993 on January 07, 2005, 11:35:21 AM
where and how do you use the "constant USER_NAME"

Something like

echo USER_NAME . " thanks for logging in.";

is there a way to change so that  it said. Thanks fo loggin in [Username].  I tried to do " Thanks for logging in" echo USER_NAME; but it not working.
Quote

<?php
if (USER_ID) {
   // do nothing - a user is logged in
   // we could print out anything here to say welcome to the logged in user
} else {
   print 'You\'re not logged in. If you were, you could do so many things you currently can\'t.<br />Click <a href="login.php">login</a> if you already have an account for this site or <a href="register.php">register</a> to sign up for a new account.';
}
?>

How do i align this so that this is set to the right of the page? TIA for help. Sorry am a noob at php.

stock

Could someone help.

Does one put this code:
<?php
/*************************
  COPPERMINE BIT HERE TAKEN OUT FOR CLARITY, IGNORE
**********************************************/

starttable("100%", "Welcome");

?>
<tr><td class="tableb" >
<?php
if (USER_ID) {
    // do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user
} else {
    print 'You\'re not logged in. <br />Click <a href="login.php">login</a> if you already have an account for this site or <a href="register.php">register</a> to sign up for a new account.';
}
?>
</td></tr>
<?php
endtable();

?>

Into anycontent.php then do something else to make a box come up before they can access the site? This is what I want to do if possible. Thanks for any help

Joachim Müller


stock

many thanks, I did try and find this an apologies that I hadn't. It works perfectly.

Stock