expired date validation and session

Reply

Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

expired date validation and session

 
0
  #1
Mar 18th, 2008
hi...i am doing form for bill redemption, and juz wanna ask is there any function in php used to check for expired date? like current month is march, if user enter due month to be january, then it will be invalid. Any function to detect current date?

By the way, i need to pass several variables across pages..i tried session_start() before but seems some hosting or server din support it. I need it because i got two tables in database, which have username in common, so tht i can use the variable to decide which username and insert the data inside the database accordingly.

Thanks for the guidance...if any.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 68
Reputation: JRSofty is an unknown quantity at this point 
Solved Threads: 10
JRSofty's Avatar
JRSofty JRSofty is offline Offline
Junior Poster in Training

Re: expired date validation and session

 
0
  #2
Mar 18th, 2008
There's no built-in functions exactly for what you want to do so what you need to do is build some code of your own.

First take a look at the date/time functions of PHP. If I'm going to check the month against a textual month I would use something like this
  1. $st = time(); // gets the current time in unix timestamp
  2. $current_month_full = date("F"); // gets full length month like January, December
  3. $current_month_short = date("M"); // gets abbreviated month like Jan, Dec
  4. $current_month_num_zero = date("m"); // gets current month number with leading 0 like 01, 02
  5. $current_month_num = date("n"); // gets the current month number without leading 0 like 1, 2, 3
  6.  
  7. // now you need to check against some entered month for example
  8. if($_GET['monthdata'] == $current_month_full){
  9. echo "The month matches the current month!";
  10. }else{
  11. echo "The month does not match the current month!";
  12. }

I hope that gives you some direction.
JRSofty Programming | .NET Dreaming | GalahTech

If your question is solved then mark the thread solved. If someone gives you good advice then give them some rep.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC