| Author |
Message |
erlendfl
Joined: 10 Jan 2007 Posts: 41
|
|
Only registered users can read full story |
|
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 |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
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:
 |  | <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  |
|
| Mon Oct 20, 2008 2:51 pm |
|
 |
Torstein
Joined: 03 Aug 2006 Posts: 119
|
|
|
|
You can also make it more advanced:
 |  | 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 |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
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  |
|
| Tue Oct 28, 2008 1:18 am |
|
 |
erlendfl
Joined: 10 Jan 2007 Posts: 41
|
|
|
|
A good idea is also, if you have a include-code, using this 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 
|
|
| Thu Oct 30, 2008 12:30 am |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
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:
 |  | <?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  |
|
| Fri Oct 31, 2008 3:12 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2857 Location: Germany |
|
|
|
Try this:
 |  | 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 |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
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  |
|
| Sun Nov 02, 2008 11:54 pm |
|
 |
Torstein
Joined: 03 Aug 2006 Posts: 119
|
|
|
|
How about:
 |  | <?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 |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
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  |
|
| Thu Nov 06, 2008 5:52 am |
|
 |
|