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: Anycontent only for registered user  (Read 4959 times)

0 Members and 1 Guest are viewing this topic.

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Anycontent only for registered user
« on: February 12, 2005, 11:52:34 pm »

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
« Last Edit: February 17, 2005, 06:49:26 pm by GauGau »
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Anycontent only for registered user
« Reply #1 on: February 13, 2005, 11:57:32 am »

Try this.  In index.php, find;

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

Change it to;

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

Logged
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

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Anycontent only for registered user
« Reply #2 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.

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

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Anycontent only for registered user
« Reply #3 on: February 13, 2005, 02:14:54 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.
Logged
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

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Anycontent only for registered user
« Reply #4 on: February 13, 2005, 02:34:55 pm »


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

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

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Anycontent only for registered user
« Reply #5 on: February 16, 2005, 01:58:08 pm »


@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?

Code: [Select]
<?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?

Code: [Select]
<?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:

Code: [Select]
<?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
« Last Edit: February 16, 2005, 02:05:46 pm by hama »
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Anycontent only for registered user
« Reply #6 on: February 16, 2005, 08:45:07 pm »

Code: [Select]
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;

Code: [Select]
if (USER_ID) {

echo ' your content for one set';

} else {

echo ' your content for other set';

}
Logged
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

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Anycontent only for registered user
« Reply #7 on: February 17, 2005, 06:39:35 pm »



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

Code: [Select]
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
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.