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
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
worked perfectly!
thank you GauGau!! ;D
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"?
Yes, use the constant USER_NAME.
where and how do you use the "constant USER_NAME"
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
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();
?>
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.";
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?
No. If you want to add php then stop the heredoc, add your code, and resume it.
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.
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
no, do as suggested in http://coppermine.sourceforge.net/faq.php#registeredUsersOnly instead to accomplish what you're up to.
many thanks, I did try and find this an apologies that I hadn't. It works perfectly.
Stock