3 tier answer....
Part 1
The solution you need is to check the query string parameters on the call, something like this:
if ($_GET['app_password'] == 'sea')
{
.... Do your DB query ....
}
This would work if you called:
http://www.mysite.com/dodbquery.php?app_password=sea
but would not work if you called
http://www.mysite.com/dodbquery.php?app_password=air
http://www.mysite.com/dodbquery.php
http://www.mysite.com/dodbquery.php?foobar=sea
Part 2 - Possibly the more important part
The 'solution' above is all well and good, however this is not going to give you any real security - the URL can be seen, and therefore reused, by any intermediary (between the mobile device and your webserver).
The same would apply if you used post instead of get, any intermediary would be able to see the content of the post and therefore replay it.
There are a myriad potential solutions, the simplest IMHO (without reworking scripts etc) is to use post to pass the "password" and do this over SSL. This means that only the client and the server get to see the plaintext post data and therefore an intermediary cannot see your 'secret' key. As an added bonus you could do time sensitive secret keys, so from 1am to 2am you use 'pass1', 2am to 3am you use 'pass2' etc etc. You could also use something similar for the actual key as well (i.e. app_password)
You could also check that the device making the call is a mobile device, easily spoofable though.
Part 3 - Definately the more important part
The code sample you posted above is vunerable to SQL injection. In summary this means that somebody could inject additional SQL (i.e. drop table my_really_important)table) into your code and this would be executed without question. You should always verify the inputs to the script to ensure that somebody isn't attempting to 'hack' your script. As an example your script seems to indicate that the remote inputs are email addresses. So your code should verify that these are indeed email address. For example:
$email1Valid = VerifyEmail($_REQUEST['email1']);
$email2Valid = VerifyEmail($_REQUEST['email2']);
if ((!$email1Valid) || (!$email2Valid))
{
...abort as emails are not valid...
}
else if ($_GET['app_password'] == 'sea')
{
.... Do your DB query (and SQL escape the input emails) ....
}
else
{
.... Abort as your secret password was not passed correctly ....
}
function VerifyEmail($email)
{
return (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
}
More information on SQL injection can be found here:
http://php.net/manual/en/security.database.sql-injection.php