Lo everyone,

I have a bit of a dilemma.  I use MySQL for all my authentication (user
accounts etc, via ftp / mail / radius / http / etc), and currently am using
PureFTPD as my FTPD to allow my clients to upload web sites.

I use the following to authenticate users for their personal web space...

SELECT Password FROM UserAccounts RIGHT JOIN DNSZones ON
UserAccounts.ZoneID=DNSZones.ZoneID WHERE UserAccounts.Username=LEFT('\L',
(LOCATE('@', '\L') -1)) AND UserAccounts.StatusID < 10 AND
DNSZones.ZoneName='mydomain.com' LIMIT 1;

\L is replaced by the username, where the usernames looks at
[EMAIL PROTECTED]

Now, this is all very nice and simple, but it is limited in the sense that I
can only allow that query on the one web site.  In other words, I'll need to
run at least two different FTP servers (one for user web sites, and one for
other web sites).

In the other web sites, I'll be using something like this:

SELECT Password FROM WebAuth RIGHT JOIN DNSZones ON
WebAuth.ZoneID=DNSZones.ZoneID WHERE WebAuth.UserName=LEFT('\L',
(LOCATE('@', '\L') -1)) AND WebAuth.StatusID < 10 LIMIT 1;

In this instance, the user account will be something like
[EMAIL PROTECTED]

Now, is there a way that I can do both those queries in one go?  Basically,
I want to provide PureFTP with one SQL query, that will either return the
account details on the user account ([EMAIL PROTECTED]), OR, for a
virtual web site ([EMAIL PROTECTED])

If I can write this quick of what I have in mind, I'm looking for something
like

if (\L LIKE '[EMAIL PROTECTED]) {
  the user is authenticating for their personal web space
} else {
  the user is authenticating for a dedicated virtual host
}

Is this possible??? :/

--
me

<sql,query>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to