zero-perfoliate
zero-perfoliate

Author Topic: help building a gradual content script  (Read 1948 times)

Offline slasher

  • New PHP Members
  • Posts: 3
  • Karma: +0/-0
help building a gradual content script
« on: February 15, 2010, 07:10:45 AM »
I am trying to create a membership site that has gradual content release. There are very few programs out there that do this and none that do what I want.

What im looking for/need help with.

I want links to appear on a main page depending on how long a user has been a member.

so for example...

day 1 userA can see link1
day 2 userA can see link1 and link2
day 3 userA can see link1 and link2 and link3

but if userB signs up 2 days later, i dont want them being able to see what userA is seeing.

so day1 would be from signupdate.

i have found a script that could be modified but i am having trouble with it.

my php knowledge is very limited and would greatly appreciate someone either guiding me through it or possibly writing it for me if its not a big job.

here is the script

<<?php

// Init. Get current user status, data + connect to database and such
include('common.php');

$signupdate = "Huh??";

$lesson[0] = "day 0 stuff";
$link[0] = "day0.php";
$desc[0] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sagittis ipsum at lorem. Suspendisse feugiat. Sed imperdiet orci at magna.";
$days[0] = 0; // for immediate

$lesson[1] = "day 1 stuff";
$desc[1] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sagittis ipsum at lorem. Suspendisse feugiat. Sed imperdiet orci at magna.";
$link[1] = "day1.php";
$days[1] = 1; //

$lesson[2] = "day 2 stuff";
$desc[2] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sagittis ipsum at lorem. Suspendisse feugiat. Sed imperdiet orci at magna.";
$link[2] = "day2.php";
$days[2] = 2; //

$lesson[3] = "day 3 stuff";
$desc[3] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sagittis ipsum at lorem. Suspendisse feugiat. Sed imperdiet orci at magna.";
$link[3] = "day3.php";
$days[3] = 3; //

$lesson[4] = "day 4 stuff";
$desc[4] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sagittis ipsum at lorem. Suspendisse feugiat. Sed imperdiet orci at magna.";
$link[4] = "day4.php";
$days[4] = 4; //

//BEGIN Output, Display, Echo

include 'header.php' // top of page
?>
<h1>Your Lessons</h1>

<?php
$seconds_a_day = 86400;
for($i = 0; $i < count($lesson); $i++)
{
$days_to_release = $days[$i] * $seconds_a_day;
$release_date = $signupDate + $days_to_release;
$j = $i + 1;
if ($release_date > time())
{
echo "<p style='color: #999;'><strong>Lesson ".$j.": ".$lesson[$i]."</strong>
".$desc[$i]."
available to you on ". date('l jS \of F Y', $release_date) ."</p>";
}
else
{
echo "<p><strong>Lesson ".$j.": <a href='".$link[$i]."'>".$lesson[$i]."[/url]</strong>
".$desc[$i]."
Content released on ". date('l jS \of F Y', $release_date) ."</p>";
}
}

//More CONTENT GOES HERE

include('footer.php'); // the bottom of page

?>

this script will allow users to click on each link depending on how many days they have been a member.

what I would like(if possible) is for the links to be hidden until the selected day the links become active.


another problem i am having is is wont read or find common.php


where would this file be on my server/database and if i created one, what code would i put in it and where would i find the code for it.

at the moment it is displaying the date as 1st jan 1970

I hope someone can help me

thanks

 

zero-perfoliate