Anycontent only for registered user Anycontent only for registered user
 

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

Anycontent only for registered user

Started by hama, February 12, 2005, 11:52:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hama

Is it possible to modify an anycontent block in a way that this specific block is only visible after the Login into the gallery (only a specific group of users should see this block)?

I could post the anycontent block if necessary but I think I have to modify the index ...

If the way how to make this is posted somewhere in the forum, please give me the link (I did a quick search and found nothing).

Thanks

hama
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Casper

Try this.  In index.php, find;

case 'anycontent':
                if ($cat == 0) {
                    include('anycontent.php');
                }
                flush();
                break;
        }
    }


Change it to;

case 'anycontent':
                if (!USER_ID + $cat == 0) {
                    include('anycontent.php');
                }
                flush();
                break;
        }
    }


It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

hama


Yes, works perfect! Thanks!

Do you have time and energy to give some private lessons in php, mysql, ... next january? I book a flight and pay a one week or two weeks intensive workshop ...  ;) Financial thoughts are welcome ... (You don't have to move it to "Looking for Freelancers / Paid help".) ... It's just a crazy idea.

Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Casper

Quote from: hama on February 13, 2005, 01:02:33 PM
Yes, works perfect! Thanks!

Do you have time and energy to give some private lessons in php, mysql, ... next january? I book a flight and pay a one week or two weeks intensive workshop ...  ;) Financial thoughts are welcome ... (You don't have to move it to "Looking for Freelancers / Paid help".) ... It's just a crazy idea.

ROFLMFAO.

will you also pay for me to have some lessons first.  I just find what to do by searching out what has been done to solve other problems, and then adjusting it to suit the current situ.

I'm no coder, just a good improviser, I like to think.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

hama


Quote
I'm no coder, just a good improviser, I like to think.

So then you are a really good thinker!  :)
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

hama

#5

@casper: Hi!

One step more, please:

anycontent1.php should only be visible for registered and logged in users.
anycontent1.php should not be visible for not registered and not logged in users.

anycontent2.php should only be visible for not registered and not logged in users.
anycontent2.php should not be visible for registered and logged in users.

Is that the right way for anycontent1 in index.php?


<?php
case 'anycontent1':
                if (!
USER_ID $cat == 0) {
                    include(
'anycontent1.php');
                }
                else (
$cat == 0) {
                    include(
'anycontent2.php');
                }
                
flush();
                break;
          }
      }
?>



And then the opposite for anycontent2 in index.php?


<?php
case 'anycontent2':
                if (
$cat == 0) {
                    include(
'anycontent2.php');
                }
                else ((!
USER_ID $cat == 0) {
                    include(
'anycontent1.php');
                }
                
flush();
                break;
          }
      }
?>



Or is it possible to write a combination!  ::)

Maybe you are interested to know why I would like to have it like that?

Here's the startpage of my gallery: http://www.dorfschule.ch/copper/index.php

Everybody can see: Wow, radio stations and - uups - songs ...

--> EDIT: The player doesn't work in firefox. I'll try to solve that. But this is off-topic.

My idea is now to show "radio stations" for everybody and "radio stations and songs" only for registered and logged in users. So I will copy this anycontent, delete the song(mp3)-part and have then two anycontents for this two different situations. If you know a better way I'm open to learn something ...  ;)

This is the anycontent code:


<?php
starttable
("100%""Sounds :-)"2);

echo 
"<tr><td class='tableb' colspan='2' align='center'><br><b>Ein bisschen Sound gefällig? - Viel Vergnügen!</b></br><br>";
echo 
"</td></tr>";
echo 
"<tr><td class='tableb' width='50%' align='center'><br>";
echo 
"<form action='player.php' method='post' target='_top'>";
echo 
"<select size='1' name='radiostation'>";
echo 
"<option selected>Radios - Bitte wählen ...</option>";

echo 
"<option value='http://www.web-radio.com/stream.cfm?id=11489'>Radio Groove (USA, 32 KBit/s)</option>";
echo 
"<option value='mms://stream2.orf.at/oe3_live'>Radio Ö3 (Österreich, 31 KBit/s)</option>";
echo 
"<option value='http://www.radiopilatus.ch/sound/high.asx'>Radio Pilatus (48 KBit/s)</option>";
echo 
"<option value='http://sunshine.stream.green.ch/sunshine.wax'>Radio Sunshine (40 KBit/s)</option>";
echo 
"<option value='http://asx.skypro.tv/asx/radio-drs/virus.asx'>Radio Virus (40 KBit/s)</option>";
echo 
"</select>&nbsp;<input type='submit' value='Play!' name='Play!'>";

echo 
"</form>";
echo 
"</td>";
echo 
"<td class='tableb' width='50%' align='center'><br>";
echo 
"<form action='player.php' method='post' target='_top'>";
echo 
"<select size='1' name='radiostation'>";
echo 
"<option selected>Songs - Bitte wählen ...</option>";

// The following code I will delete for not registered and not logged in users.

echo "<option value='http://www.domain.ch/sounds/AC-DC.mp3'>AC/DC (128 KBit's)</option>";
echo 
"<option value='http://www.domain.ch/copper/albums/Sounds/B52s-LoveShack.mp3'>B52's (128 KBit's)</option>";
echo 
"<option value='http://www.domain.ch/sounds/Dave-Goodman.mp3'>Dave Goodman (KBit's)</option>";
echo 
"<option value='http://www.domain.ch/copper/albums/Sounds/DireStraits-ItNeverRains.mp3'>Dire Straits (128 KBit's)</option>";
echo 
"<option value='http://www.domain.ch/sounds/Talk-Talk.mp3'>Talk Talk (128 KBit's)</option>";
echo 
"<option value='http://www.domain.ch/copper/albums/Sounds/ZueriWest-Amerikagitsnid.mp3'>Züri West (128 KBit's)</option>";

echo 
"</select>&nbsp;<input type='submit' value='Play!' name='Play!'>";
echo 
"</form>";
echo 
"</td></tr>";

// Until here I will delete and I will not forget to modify the table.

endtable();
?>



Thanks

hama
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Casper

case 'anycontent1':
                if (!USER_ID + $cat == 0) {
                    include('anycontent1.php');
                }
                flush();
                break;
        }
    }

case 'anycontent2':
                if (USER_ID + $cat == 0) {
                    include('anycontent2.php');
                }
                flush();
                break;
        }
    }


This should do it. 


But you could also do this in anycontent, just put a if/else switch there, such as;

if (USER_ID) {

echo ' your content for one set';

} else {

echo ' your content for other set';

}
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

hama

Quote from: Casper on February 16, 2005, 08:45:07 PM


But you could also do this in anycontent, just put a if/else switch there, such as;

if (USER_ID) {

echo 'your content for one set';

} else {

echo 'your content for other set';

}



Good idea!  8)

I did it and it works. With this solution I have the two possibilities directly integrated in anycontent.php.

Thanks

hama
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!