Here's an update to the previous readme:

I modified the database table to look like this:

mysql> desc relay_users;
+--------------+---------------+------+-----+---------+-------+
| Field        | Type          | Null | Key | Default | Extra |
+--------------+---------------+------+-----+---------+-------+
| username     | char(32)      | YES  |     | NULL    |       |
| IP           | char(20)      | YES  |     | NULL    |       |
| permit_relay | enum('N','Y') | YES  |     | NULL    |       |
| t_stamp      | timestamp(10) | YES  |     | NULL    |       |
+--------------+---------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

I added a t_stamp field to it and a little shell script to expire
entries older then max allowed time:

------------------------ cut here --------------------------

#!/bin/sh
database="_db_name_"
host="_hostname_"
user="_username_"
pass="_passwd_"
table_name="_table_name"
flag_name="_flag_table_name_"
expire_time=900

#################
## 15 min = 900 sec
## 30 min = 1800 sec
## 1 h = 3600 sec
## etc...
#################

while :
do
mysql $database -h$host -u$user -p$pass -e" update $table_name \
set permit_relay = 'N' where \
(unix_timestamp(now()) - unix_timestamp(t_stamp)) > $expire_time
and permit_relay = 'Y'"
# run every 10 min
sleep 600
done

------------------------ cut here --------------------------

Plus a modification to Qpopper to update the timestamp:

#define RELAY_TABLE "_table_name_"
#define HOST "_host_name_"
#define USER "_user_"
#define PASS "_pass_"
#define DB "_database_name_"
...
..
.
before returning POP_SUCCESS:
 
	/*	Build a query	*/
        snprintf(queryBuf,sizeof(queryBuf),"update %s set IP = '%s',
        permit_relay = 'Y', t_stamp = now() where username = '%s'",
        RELAY_TABLE,p->ipaddr,p->user);

	/*	Connect to MySQL server	*/
        if(!mysql_real_connect(&mysql,HOST,USER,PASS,DB,0,NULL,0))
        {
         return(pop_msg(p,POP_FAILURE,"error",mysql_error(&mysql)));
        }
	/*	Send a query to server	*/
        mysql_query(&mysql,queryBuf);

	/*	Disconnect from server	*/
        mysql_close(&mysql);

	/* return POP_SUCCESS with a message	*/
        return(pop_msg(p,POP_SUCCESS,"Relay Database updated"));

	/* return POP_SUCCESS	*/
        return(POP_SUCCESS);

That's it
For the rest read the previous readme
