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 5 123 ... LastLast
Results 1 to 15 of 69
  1. #1
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question I need a PHP script that can do this or a method to help me create it?

    Ok I know what I need a PHP script to do!
    I just don't know how to do it???

    Ok I have a site to work with date(s) and time(s),
    Basically this is the layout/idea:

    You register=> get email then you Activate=> IF (a big IF)
    IF you don't activate within 3 days (72 hours) your account that you created must be deleted.

    IF your activation was succesful then:

    You submit an image=> get email then you Activate=> IF (a big IF again)
    IF you don't activate within 7 days your image that you submitted must be deleted.

    I hope that this makes sense.

    I need a PHP script that can do this or a method to help me create it?
    Thanks for you support!

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    add a field to database like reg <= make it a time
    and imgadded <= time aswell
    make a cron run a php script which checks if the user has activated if !activated && now => time + 60*60*24*3 (72 hours change for image) delete the account and info

  • #3
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    That looks like it could work, except that I have no CRON available and wont change the host as it is the cheapest.
    Thanks for you support!

  • #4
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question

    Sorry forgot to add how do I get the script to run without the cron job?
    Thanks for you support!

  • #5
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    visit the page which holds the script

  • #6
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Ok that would mean that it is exactly like object orientated programming:
    CLICK THEN DO.

    Is there no way to make it do it automatically by date or something without a CLICK THEN DO situation, probably CRON? right?
    Thanks for you support!

  • #7
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    you just create the normal php script which the cron would run, then www.yoursite.com/folder/page.php in ur browser will run the same as if a cron was doing it
    no OOP required

  • #8
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Cool I fully understand that part but I physically have to go to that page:
    UNLESS
    I make sure that the user has to pass that page before or after logging in.

    Ok will try it and get back to you as I am sure that I will need some help with coding it properly as you understand this time thing quite well.
    Thanks for you support!

  • #9
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Ok this is what I got:
    PHP Code:
    <?php
    $activated 
    $row_rstime['active'];
    if (!
    $activated && time 60*60*24*3){
    echo 
    "You are ok";
    }
    else{
    echo 
    "You are not ok";
    }
    ?>
    How do I add 7 days to this?
    Just change 3 to 7 (60*60*24*3)?
    Thanks for you support!

  • #10
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    I have tried this way, but it keeps saying: You are ok
    PHP Code:
    <?php
    $time 
    $row_rstime['DateJoined'];
    $activated $row_rstime['active'];
    if (!
    $activated && $time 60*60*24*3){
    echo 
    "You not are ok";
    }
    else{
    echo 
    "You are ok";
    }
    ?>

    It does not make sense as the DateJoined is: "2007-05-24 20:50:53"
    And the account is not active: = "N"
    Thanks for you support!

  • #11
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    yes change the 3 to 7
    $activated will always return true you need to check the value of it with ==
    and
    time + 60*60*24*3
    what is time? maybe you mean $time or time()
    PHP Code:
    $activated $row['active'];
    $when $row['timedate']
    if (
    $activated == yes || $when !> time() +(60*60*24*7)) {
    //something like that sorry you wanted an or sign there instead of and
    }else{ 
    echo 
    'activate';


  • #12
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Parse error: parse error, unexpected '!' in line 44

    Line 44 =
    Code:
    if ($activated == 'Y' && $when !> time()+(60*60*24*7)){
    Thanks for you support!

  • #13
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    A cheap alternative to cron is to have the check/update process be fired upon each page visit, or every X visits if you have a busier site.

    It's not as reliable, but it works.

  • #14
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Quote Originally Posted by westmatrix99 View Post
    Parse error: parse error, unexpected '!' in line 44

    Line 44 =
    Code:
    if ($activated == 'Y' && $when !> time()+(60*60*24*7)){
    sorry use the less than operator
    < instead of !>
    and change the && to ||

  • #15
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Can do that but still can't execute this:
    Code:
    if ($activated == 'Y' && $when !> time()+(60*60*24*7)){
    Changed it to:
    Code:
    if ($activated == 'Y' && $when != time()+(60*60*24*7)){
    It worked but is that the trick?
    Thanks for you support!


  •  
    Page 1 of 5 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
    •