[FX.php List] Newbie PHP Question about direct link request to DB

Chris Hansen chris at iViking.org
Wed Mar 24 08:16:43 MDT 2010


Lars,

The PHP Site Assistant definitely doesn't do things the best way (I  
have some work the entails fixing and/or adding to Site Assistant  
generated code...)  You could still use a field other than the  
RecordID as long as it was unique.  Also, when I generate the type of  
string we've been discussing, I usually also use a random length (just  
to make things more difficult for those who would do something  
untoward...)  Best of luck on your project!

--Chris

On Mar 24, 2010, at 3:57 AM, Lars Arlér wrote:

> Thanks Webko for the quick and swift answer....
>
> But I'll try to explain my problem a little deeper.
>
> The problem is that I have created a html webmail, from where my  
> colleges
> will be linked via a hidden link, in their email client, to their own
> browser and directed to their own personal record.
>
> http://87.61.63.20/browserecord.php?-action=browse&-recid=501
>
> But this link will be displayed in the top link window in their  
> browser, not
> good.
>
> So I would really like recid to be much longer like Jonathan  
> explained.
>
> The problem with my PHP code generated by FileMaker PHP Site Assistant
> Is that it seems to only allow me to use FMP own generated -recid.
>
> And I can sure live with that if I can define how many numbers and  
> letters
> it consist off.
>
> Otherwise I would like to use any other FMP field to do the lookup
>
> So if you or other can help we with this PHP issue I will be in deep
> gratitude to you.
>
> Her is my PHP in the browserecord.php if it helps
>
> --------------------------- ZIP ZIP ZIP  
> ---------------------------------
>
> <?php
>
>     /**
>    * FileMaker PHP Site Assistant Generated File
> */
>
>
>
> require_once 'fmview.php';
>
> require_once 'FileMaker.php';
>
> require_once 'error.php';
>
>
>
> $cgi = new CGI();
>
> $cgi->storeFile();
>
> $databaseName = 'MD_BackOffice';
>
> $layoutName = 'Webcontacts';
>
> $userName = 'webuser';
>
> $passWord = 'webuser';
>
>
> $fm = & new FileMaker();
>
> $fm->setProperty('database', $databaseName);
>
> $fm->setProperty('username', $userName);
>
> $fm->setProperty('password', $passWord);
>
>
>
> ExitOnError($fm);
>
> $layout = $fm->getLayout($layoutName);
>
> ExitOnError($layout);
>
>
>
> // formats for dates and times
>
> $displayDateFormat = '%m/%d/%Y';
>
> $displayTimeFormat = '%I:%M %P';
>
> $displayDateTimeFormat = '%m/%d/%Y %I:%M %P';
>
> $submitDateOrder = 'mdy';
>
>
> $record = NULL;
>    $response = NULL;
>
> $action = $cgi->get('-action');
>
> $recid = $cgi->get('-recid');
>
>
>
> switch ($action) {
>
> case "delete" :
>
> {
>
> include "deleterecord.php";
>
> break;
>
> }
>
>
> ########### Some more Cases removed ############
>
> case "browse" :
>
> default :
>
> {
>
> $recid = $cgi->get('-recid');
>
> if (!isset ($recid))
>
> $recid = 1;
>
>
> $record = $fm->getRecordById($layoutName, $recid);
>
>
>
> ExitOnError($record);
>
> break;
>
> }
>
> }
>
> ?>
>
>
>
> --------------------------- ZIP ZIP ZIP  
> ---------------------------------
>
>
>
>
>
>
>
>
>
>
>
> On 24/03/10 09.36, "Tim 'Webko' Booth" <tim at nicheit.com.au> wrote:
>
>>
>> On 24/03/2010, at 6:50 PM, Lars Arlér wrote:
>>
>>> Hi Jonathan...
>>>
>>> Very helpful information.
>>> But you have to specify a little more ;-) please
>>>
>>>> 1) Upon initial record creation, create a
>>>> long random (unique) character string that serves
>>>> to identify that record to the outside world. I
>>>> use 20 digits, upper and lower alpha, set by a
>>>> Custom Function.
>>>
>>> Does that mean that I can specify the "FMP recid"
>>> And can/will you share your Custom Function, I haven't
>>> tried to make one yet, is it difficult to make one ??
>>
>> I'm fairly certain that you can set a decent field definition for  
>> this
>> yourself.... Look at Brian Dunnings site for this sort of thing....
>>>
>>>> 3) Upon initial CWP access of the target
>>>> record in question, set the recid into a Session
>>>> variable (not viewable publicly) and use the
>>>> recid later, or
>>>
>>> Are we talking PHP or FMP here ??
>>
>> PHP - initial Custom Web Publishing finds the record (-recid) and you
>> put them into a session variable. I'm also fine with doing a finf
>> based on their input, and grabbing the -recid and then doing a
>> subsequent -edit on that value...
>>
>> Cheers
>> Webko
>
>
>
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list