How to expire account after X days. in PHP/MYSQL

Discussion in 'PHP' started by neha2011, Jun 26, 2011.

  1. #1
    i am creating a script user registration method, register account automatically expire after X days.

    1. I am using current_timestamp method (When user register Current date auto add in database, format look like this 2011-03-01 18:46:38)
    2. i found lot of account expiry php tutorial but all use unix time (12545156454 etc) stamp but my website host on Windows IIS server using PHP/MYSQL.

    Eg. if i register at 2011-03-01 18:46:38 and after 30 days my account expired at 2011-04-01 18:46:38. bold area (time) not recommending to deffrence.

    Thanks,
     
    neha2011, Jun 26, 2011 IP
  2. Custombot

    Custombot Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I was looking at this for something else that expired after an hour.Try something like:

    
    UPDATE table SET fieldname = 'expired' WHERE registered-date < DATE_SUB(NOW(), INTERVAL 30 DAY)
    
    PHP:
     
    Custombot, Jun 26, 2011 IP