On Jan 9, 2004, at 4:33 PM, Rick Widmer wrote:
Yesterday I worked on template.c removing unused tags and moving large
blocks of code to separate functions, some to different files.  There
are now 26 options with the form:


case '?' : single line of code; break;

Note, that you could even do this:


case '?': some_function_here(); break;

You might want to put the break on a separate line, so you can be sure to see it. Missing breaks cause big problems.

I ran into some TmpBuf* variables which were declared in qmailadmin.c
and qmailadminx.h then used locally all over the program. I was worried
about interaction, so I went through each function in which they
appeared, and if they were initialized within the function I renamed
them from TmpBuf* to Buffer*, and declared them locally. It turns out
there were no interactions, now there is no question - they aren't
shared globals any more.

That's a good idea. Both qmailadmin and vpopmail use shared globals and it's just not a good idea. Upgrading some of the functions to pass values instead of relying on the global variables (like NewU) would be a good idea.


If we want to move from

/cgi-bin/qmailadmin/com/commandname?...

to

/qmailadmin/program.cgi?command=commandname

why not just go with single character commands that we can switch() on?

/qmailadmin/program.cgi?command=c

I'd prefer to stick with cmd=commandname for readability.


However, if I was doing this with PHP, a URL might look like:

http://server.x.com/qmailadmin/maildomain.com/name/edit.php

qmailadmin is a PHP program without the .php extension.  I use the
following settings in httpd.com to make it execute:

<Location /qmailadmin>
ForceType applocation/x-httpd-php
</Location>

Not everyone uses Apache -- QmailAdmin works with other web servers. Keeping all parameters as values in the URL means that you can also move them to hidden fields in a POST. There's flexibility in being able to pass values in the URL (GET style) and/or form data (POST style). You could even store some values in a cookie (like the username and domain name) to make the URLs smaller. If the user isn't accepting cookies, just include them in the URL (from template.c).


--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/



Reply via email to