OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Expire an account by date

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Expire an account by date
Page: [1]
 
shoky

 

Posts: 30
Joined: 9/13/2005
Status: offline

 
Expire an account by date - 7/27/2009 16:54:23   
Hello -
I'm thinking of setting up a members area where accounts expire. Any ideas on how to write a script(SQL) that reads a Date from the database and sets accounts to parked if the date has passed.

Thanks!
womble

 

Posts: 6007
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: Expire an account by date - 7/27/2009 18:24:05   
I've been at work all day so brain's dead now and I'm no good at figuring out SQL queries when I'm half asleep, but I'd imagine you'd need to use one of the SQL date functions to check the current date against a date on the account, (whether that's the date the account was created, the last time it was accessed, or whatever) and then use a simple update query to set a field for whether an account's active or not (say '1' for an active account, and '0' for an inactive account). The update query would update the value for that field if the current date was after whatever date you're checking.

Probably somewhere you'd need to use either the NOW() or CURRENT_DATE() functions (again, if you're using MySQL), or possibly the TIME() function.

Something like:

$today = time();
$query = "SELECT * FROM accountstatus WHERE expires > $today";

would select all records where the the expiry date was greater than the current date and you could use an update query to set the status of the account to active, or conversely check whether the current date's after the expiry date and use an update query to set the account status to '1' or '0.' 'Expires' would be a datestamp.

Like I said, my brain's packed up for the day so there's no guarantees that the above will make any sense whatsoever, but that help any?

_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~

(in reply to shoky)
TexasWebDevelopers

 

Posts: 722
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: Expire an account by date - 7/27/2009 18:48:17   
You can modify this to work:
http://www.texaswebdevelopers.com/examples/expirydate.asp

_____________________________

:)

Follow us on TWITTER

(in reply to womble)
shoky

 

Posts: 30
Joined: 9/13/2005
Status: offline

 
RE: Expire an account by date - 7/28/2009 10:04:40   
OK - Thanks - I'll try the ideas out.
Just one related question:
To enter the date in the Database what is the proper syntax using Access db:

"',expiredate='" & request.Form("expiredate") &

Right now it's a text field but I know it needs to be date/time

(in reply to TexasWebDevelopers)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Expire an account by date
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts