[FX.php List] Find an email using FMS7A and PHP 5.0.2
Jason H Awbrey
jawbrey at gmail.com
Sun Jun 5 08:21:07 MDT 2005
Hi Andy,
The way that I have dealt with this is to simply replace the '@' with
another character and then use that iteration for my username in the
database. Then simply replace the '@' in your PHP script with the
character you are using in the database. For instance,
$username = preg_replace('/@/', '.', $_POST['username']);
This way your users can still use their email address as their username.
A better way of validating a user is to create an account in the
database for that user. Then using the same preg_replace() statement
above you could use the following:
$test = new FX($serverIP, $webCompanionPort);
$test->SetDBData ('login', 'login');
$test->SetDBPassword($password, $username);
$login = $test->FMFindAll();
If the login is a valid account, they have access to the database. If
not give them an error to try again or kiss off. ;-)
HTH,
Jason H Awbrey
Harmonic Data Associates
http://www.harmonic-data.com
jawbrey at harmonic-data.com
On Jun 4, 2005, at 2:36 PM, Andy Gaunt wrote:
> Hey guys –
>
>
>
> I have a slight issue right now using an email address in a login
> solution.
>
>
>
> It seems it does not like the email address being used as the
> username, even if I enclose the email in “s
>
>
>
> This works fine in FM6 unlimited and PHP4.3 but fails in FM7
>
>
>
> $username=$_POST[‘username’];
>
> $password=$_POST[‘password’];
>
>
>
> $checklogin=new FX($serverIP,$webCompanionPort);
>
> $checklogin->SetDBData(,);
>
> $checklogin->SetDBPassword(,'');
>
> $checklogin->AddDBParam('Username',"==");
>
> $checklogin->AddDBParam('Username','"'.$username.'"');
>
> $checklogin->AddDBParam('Password1',"==");
>
> $checklogin->AddDBParam('Password1',$ password);
>
> $checkloginResult=$checklogin->FMFind();
>
>
>
> Regards
>
>
>
> Andy Gaunt
>
> T: 407.810.4722
>
> andy at fmpug.com
>
> http://www.fmpug.com
>
>
>
> June 23rd 2005, 7pm Orlando FMPug
>
> Register interest online at http://www.pug-planet.com/rsvp.php
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20050605/9924eff6/attachment.html
More information about the FX.php_List
mailing list