从CSV加载并转发到不同的URL

I've a CSV file that I must read from and according to the parameters must forward the user to a different page. eg

"start date","end date","company","url to be forwarded"   ---> this line is for explanation only 

26/05/2011,26/06/2011 KATZ http://www.google.com

I am confused as to how I will check these parameters i.e. I should first check whether the date will be true if true forward the user. Any inputs would be appreciated.

I've to basically check for the date if it is valid(whether expired or not) then check the username(KATZ) if these two parameters hold true, I must forward the user to www.google.com

Thank you

How about something like this:

// Username
$username = 'KATZ';

// Open the file.
$fh = fopen('file.csv', 'r')

// Loop through the data.
while ( ($data = fgetcsv($fh)) )
{
  $now = time();

  // Check that now is later (grater than) than the start date but earlier (less than) than the end date and that the username matches.
  if ( $now >= strtotime($data[0]) && $now <= strtotime($data[1]) && $username == $data[2] )
  {
    // Forward the user
    header('Location: ' . $data[3]);
    exit;
  }
}

// Close the file.
fclose($fh);