Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts

    php help signupdate/script

    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 user can see link1
    day 2 user can see link1 and link2
    day 3 user can see link1 and link2 and link3

    i have found a script that could me 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

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Do you already have a database (MySQL) set up where the user registers?
    So, they register with a form, it's verified with their email address, and they
    can then access a profile page? You'll know when they registered, and can
    work from there.

    How much do you already have set-up as it pertains to the membership part?

  • #3
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    yes I have a database setup with mysql.

    My server has all the latest software and programs etc so its not limited by the server capabilities.

    yes they sign up to the membership site then get transfered to the 'main page'

    what im looking for is a way to display links/new pages after a set times.

    is there a way of hiding links then displaying them after eg 2days after becoming a member?

    ive asked at alot of forums but havent really got very far. people have mentioned using $signupDate but this doesnt seem to work with this script.

    All I want is a script that checks current date and signupdate, calculates days since membership started then displays/allows links accordingly.

    I would prefer if it hid links then displayed after a set date.

    My php knowledge is very limited and my funding is also limited otherwise I would pay someone to build one for me.

    is config.inc.php something to do with finding the members info?

    is this being used instead of $signupDate? - (intval($_SESSION['_amember_id'])

    is header.inc.php different to header.php?

    im sorry for all the questions. I do look for answers on the internet before asking in forums and I know that i shouls steer clear of php if i dont know what im doing, but i really need this working.

    hope you can help

    thanks

  • #4
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    You can subtract the signup time from the current time and work out the difference between the two, then echo out the relevant link(s) dependant on that value
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    What is the variable name you have in MySQL for the "sign up date"?
    And what is the format of that date (mm/dd/yyyy, or ??? )?

  • #6
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    where would i find the variable for the sign up date in mysql?

    sorry, im new to all of this.

  • #7
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JAY6390 View Post
    You can subtract the signup time from the current time and work out the difference between the two, then echo out the relevant link(s) dependant on that value
    that is what the code i posted does. The problem im having is its not collecting data from the $signupDate or whatever the amember equivelant is and its not using the correct unix date. keeps refering to jan 1st 1970.

    Plus I want to find out how to make links visible after a certain time period - if its possible.

  • #8
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    How much do you already have set-up as it pertains to the membership part?
    The whole site is complete and fully functional. The only thing im missing is the gradual content script.

  • #9
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    You say the whole script is set up but where is the code that gets the signup date? You need to get the signup date, and find out what format it is presented in (ie UNIX timestamp, or mysql date time format). If it's the latter, get the date using the UNIX_TIMESTAMP function along with your column
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    You have to query the database to find the sign-up date for a particular user.
    That sign-up date is a variable in your MySQL database (table). No way to give
    you an example of how to do it unless we know what the variable (field name) is.

    In fact, you need to have some scripting to query the database to begin with.
    I think you're missing a lot of code ... or are not showing it to us.

    Without knowing when the user signed-up, how can we compare any dates?

    EDIT:
    If you show us any MySQL connection scripting, remove the username and password so we can't see it.
    If you want, you can PM me and I can give you more information (as you can provide me with more private data).



    .
    Last edited by mlseim; 02-16-2010 at 02:04 AM.

  • #11
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The script I have posted uses the signupdate and time etc to release content but like you both rightly said, there is code missing.... this is what I am stuck on.

    I dont know where to get this code from.

    I have searched my files on the server in a blind attempt to find what you ask.
    I hope one of these code help.

    $product = & get_product($product_id[0]);
    $begin_date = $product->get_start();
    $expire_date = $product->get_expire($begin_date, null, $terms); //yyyy-mm-dd

    $pc = array();
    $pc['db'] = '??????';
    $pc['user'] = '???????';
    $pc['pass'] = '???????';
    $pc['host'] = '???????';
    $pc['prefix'] = '???????';
    $pc['charset'] = ''; // replace with 'utf8' for example

    $config = array();
    $config['db']['mysql'] = $pc;
    $config['use_mysql_connect'] = 1;
    $config['root_dir'] = dirname(__FILE__);

    the ??? are details I have edited.

    Is any of the above the right information?

    Is the $begin_date used instead of $signupDate? or is that to do with product? although there is only 1 product and will onlt every be 1 product

    hope this helps and I thank you for your patience with me

  • #12
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    so basically I need to send a query to the database?
    and this gets added to header.php?
    so that all pages get info?

    I tried including common.inc.php but its still returning 1970 despite trying different codes.

    Its not easy to find php basic info on the net.
    Last edited by simon99; 02-16-2010 at 10:42 AM.

  • #13
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Do you know the name of the script you're using for members?
    Is there some pre-made script you found that you're using?

    Show us "common.php", but remove any MySQL passwords that are shown.

  • #14
    New Coder
    Join Date
    Feb 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    the script im using for the 'gradual content' is one I found on a forum but its made for dlguard. but it will work if i can get the query working.

    I dont have a common.php file, only a common.inc.php file.

    does a common.php file need to be created?

    If its going to cause problems, i can abandon the script and use another one.

    at the moment i have a simple script to display current time but even thats not displaying the right time.

    This is due to the database not being accessed?
    Last edited by simon99; 02-16-2010 at 02:15 PM.

  • #15
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    If it's using a MySQL database, then somewhere it needs to connect to it.

    Did you install it yourself?
    Do you remember setting up a MySQL database with your webhost control panel?


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •