Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Only registered users can read full story

 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
Only registered users can read full story
Author Message
erlendfl



Joined: 10 Jan 2007
Posts: 41

Post Only registered users can read full story Reply with quote
I need a plugin who only gives the registered users (commenter-level) the opportunity to read the full story of a news/article. Everyone who visit the webpage can see the short-story, but when the full ,story is included they have to be logged in.

- The login-box appears when you click on the link that leads to {full-story}
- I use the register-mod and the login-box, so the users stays logged in when they have typed their username and password once.

This would be great. I'm starting a information-site for horse-sport, with latest news and tip of the day. I need this plugin, then I will know how many who uses the information on the site. The exact number of users.

Thanks in advance!
Sun Oct 19, 2008 1:35 pm View user's profile Send private message
Guest








Please login to hide the ads.

scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
I've been experimenting with the login/logout stuff cause I'm trying to make the script into more of a community based thing.. in other words.. what I've done to restrict people from seeing content without being a member is adding this at the top of my index.php:

Code:
<html>

<head>
<?php include("admin/head.php"); ?>

<?php
if($is_logged_in){
 include 'http://www.scodal.com/index2.php';
}
else{
 include 'http://www.scodal.com/login.php';
};
?>


that's my whole index

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Mon Oct 20, 2008 2:51 pm View user's profile Send private message Visit poster's website AIM Address
Torstein



Joined: 03 Aug 2006
Posts: 119

Post Reply with quote
You can also make it more advanced:

Code:
if($member['level'] >= 3 && $is_logged_in) {
  include('adminstuff.php');
}
else if($member['level'] == 4 && $is_logged_in) {
  include('memberstuff.php');
}
else {
  include('notloggedonstuff.php');
}


(member level 1 = admin, 2 = editor, 3 = journalist and 4 = commenter)
Wed Oct 22, 2008 6:26 pm View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
hot damn, i saved that! thanks Torstein.

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Tue Oct 28, 2008 1:18 am View user's profile Send private message Visit poster's website AIM Address
erlendfl



Joined: 10 Jan 2007
Posts: 41

Post Reply with quote
A good idea is also, if you have a include-code, using this code
Code:

<?php
if($is_logged_in){
 include ("include.php");
}
else{
 include ("registrer_deg_si.php");
};
?>


So thank yo for your tips so I could figute out my own solution Smile
Thu Oct 30, 2008 12:30 am View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
I wish there was a line of code you could put at the top of any page you wanted protected. For example, if you were not logged in, you could not visit a page. That if/else include page code works, however, the trouble is that if you use something like:

Code:
<?php
if($is_logged_in){
 include 'http://www.scodal.com/index2.php';
}
else{
 include 'http://www.scodal.com/login.php';
};
?>


If the visitor knows that index2.php contains all the contents of the page they're really trying to view, they can just manually type it in.

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Fri Oct 31, 2008 3:12 pm View user's profile Send private message Visit poster's website AIM Address
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2857
Location: Germany

Post Reply with quote
Try this:
Code:
if(!$is_logged_in) die('You are not allowed to see this page.');


head.php must be included first. Otherwise $is_logged_in is not available.
Fri Oct 31, 2008 4:09 pm View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
Cool! How about die, but also redirect to login.php or another php file?

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Sun Nov 02, 2008 11:54 pm View user's profile Send private message Visit poster's website AIM Address
Torstein



Joined: 03 Aug 2006
Posts: 119

Post Reply with quote
How about:

Code:
<?php
  if(!$is_logged_in) { include 'login.php'; }
  else {
?>

    Content goes here

<?php } ?>



requires you to have the '} ?>' in your footer though.
Mon Nov 03, 2008 11:30 am View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
Interesting. I'm too tired to try it but I bookmark and play with it tomorrow. Yes mm yum. Fun.

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Thu Nov 06, 2008 5:52 am View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.