[FX.php List] str_replace " in $lookupResult ?

Alex Gates alex at gandrpublishing.com
Tue May 1 11:38:40 MDT 2007


Hi everyone-

I began this morning by trying to perform a query on our outside web server
and, unsuccessfully, sending it via POST to a public web server in house -
which would then go through another script and write records to our local
(not public) filemaker server.
As Erik pointed out, I was running into problems trying to send an array
with a POST.

After a few hours, I thankfully came up with a functional solution.

Instead of sending all the data via POST, I send the "account number" of the
client via POST to our in-house public web server.  I have a copy of the FX
folder in the same directory as the php script that receives the post - and
this copy of the FX folder contains a server data file for our outside
public web server.
So, the account number is sent from our outside web server to our local web
server - then the local web server queries the outside FileMaker Server and
collects the $foundResults and saves them in a session array - then I push
over to another script (in a different directory that contains a copy of the
FX folder with our local, non-public FileMaker Server data) retrieve the
session arrays, then foreach() through and write the data to our local
filemaker server.

It works like a charm!  Now I don't have to worry about sending a large
amount of data via a POST and hassle with encoding.

I hope this makes sense - if anyone needs more details, feel free to email
me.

Thanks again to everyone for all your suggestions. 


Alex 
 

> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-
> bounces at mail.iviking.org] On Behalf Of Erik Andreas Cayré
> Sent: Tuesday, May 01, 2007 10:53 AM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] str_replace " in $lookupResult ?
> 
> 
> Den 01/05/2007 kl. 21.13 skrev Alex Gates:
> 
> > Hi Erik-
> >
> > I figured it was possible, but I assumed I would need a public IP
> > address
> > for the 2nd FileMaker server in order to make it work.  Am I right?
> 
> Yes, well almost. In fact for my suggestion to work, you need a web
> server with PHP, which is able to talk to the two relevant WPE's
> (never mind the FMS), since thats FX is talking to.
> 
> > I'm collecting the data with a public web server that we have
> > hosted outside
> > -
> >
> > We have a web server hosted internally (with a public IP) that
> > points to our
> > internal filemaker server with a local IP - so I thought I'd POST
> > from our
> > outside web server to the internal web server which would then
> > throw it in
> > to the local filemaker server.
> >
> > I guess I thought I'd need a public IP for our internal filemaker
> > server if
> > I wanted go straight from the outside web server to our local
> > filemaker
> > server - and I assumed the POST method would be more secure than
> > exposing
> > our internal filemaker server to the web via a public IP.
> >
> > Is this logical?
> 
> Maybe...
> 
> I'm not a security expert, so I'm not competent with respect to which
> strategy would be more secure.
> 
> You have also considered exporting to some file (TAB-separated or
> whatever) and reimporting on the other DB?
> 
> Ok, I'll stop trying to talk you out of your current plan (!)
> 
> I think some of your trouble comes from wanting to stuff an array
> ($fixedlookuprecipesResult) into a single form field. It *is* an
> array, right?
> 
> Maybe your solution might be easier with serialize() (http://
> www.php.net/manual/en/function.serialize.php).
> 
> As I understand it, this function is exactly what you need: Generates
> a storable representation of a value
> 
> At the receiving end you would use unserialize() (!) to get your
> array back in a useable form...
> 
> Let us know how you get along...
> 
> Best regards
> 
> /Erik
> 
> 
> > Alex
> >
> >
> > -----Original Message-----
> > From: fx.php_list-bounces at mail.iviking.org
> > [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Erik
> > Andreas
> > Cayré
> > Sent: Tuesday, May 01, 2007 8:02 AM
> > To: FX.php Discussion List
> > Subject: Re: [FX.php List] str_replace " in $lookupResult ?
> >
> >
> > Den 01/05/2007 kl. 20.24 skrev Alex Gates:
> >
> >> Thanks for the help everyone -
> >> I'll give the html_entities() a shot -
> >> Using sessions would be ideal - but I'm actually working on an
> export
> >> process that will perform the query, then POST the result to a
> >> different
> >> page (on a different server) and then loop through and re-create
> >> the records
> >> on a copy of the original database that is hosted on the 2nd server.
> >> This seemed to be the best method.
> >
> > You are aware that you can talk to several different FMSA from just
> > one PHP installation...?
> > I would do what you describe like that...
> >
> >> Thanks again -
> >>
> >> Alex
> >>
> >> -----Original Message-----
> >> From: fx.php_list-bounces at mail.iviking.org
> >> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Erik
> >> Andreas
> >> Cayré
> >> Sent: Tuesday, May 01, 2007 12:51 AM
> >> To: FX.php Discussion List
> >> Subject: Re: [FX.php List] str_replace " in $lookupResult ?
> >>
> >>
> >> Den 01/05/2007 kl. 11.41 skrev Derrick Fogle:
> >>
> >>> When you're putting values into HTML fields, hidden or not, you
> >>> need to use php's html_entities() wrapper to properly encode those
> >>> characters.
> >>>
> >>> <input type="hidden" name="recipes" value='<?php html_entities
> >>> (print_r($fixedlookuprecipesResult)); ?>' />
> >>
> >> I think the contents of value must be enclosed in double quotes
> >> (standard HTML)...
> >>
> >> Have you considered using PHP sessions to carry over data between
> >> pages?
> >>
> >>> I take it you're NOT having trouble with magicquotes? If you were,
> >>> you'd see a bunch of backslash characters getting inserted before
> >>> single and double quotes, and a few other characters, too.
> >>>
> >>>
> >>> On Apr 30, 2007, at 10:34 PM, Alex Gates wrote:
> >>>
> >>>> Greetings everyone-
> >>>> I was hoping someone could help me with my latest head-scratcher.
> >>>>
> >>>> I'm trying to send the results of a find to another page in a
> >>>> hidden field
> >>>> via POST.
> >>>>
> >>>> But, I'm having problems when a double quote is in one of the
> >>>> fields in
> >>>> my result.  My HTML thinks I am ending the value of my hidden
> >>>> field.
> >>>>
> >>>> When I use single quotes around my value like:
> >>>>
> >>>> <input type="hidden" name="recipes" value='<?php
> >>>> print_r($fixedlookuprecipesResult); ?>' />
> >>>>
> >>>> Something like, for example, half 'n half will end my value after
> >>>> the '
> >>>>
> >>>> If I use double quotes around my value like:
> >>>> <input type="hidden" name="recipes" value="<?php
> >>>> print_r($fixedlookuprecipesResult); ?>" />
> >>>>
> >>>> Then something like cut into 1" thick slices will end my value
> >>>> after the "
> >>>>
> >>>> I thought the answer lies with a str_replace, but I can't seem to
> >>>> get it to
> >>>> work even though it is apparently possible to use an array as the
> >>>> subject in
> >>>> a str_replace.
> >>>>
> >>>> With this find:
> >>>>
> >>>> 	$lookuprecipes=new FX($serverIP,$webCompanionPort,'FMPro7');
> >>>> 	$lookuprecipes->SetDBData('myDB.fp7','myLayout', 'all');
> >>>> 	$lookuprecipes->SetDBPassword('xxxxxxx','xxxxx');
> >>>> 	$lookuprecipesResult=$lookuprecipes->FMFindAll();
> >>>>
> >>>> I've tried:
> >>>>
> >>>> 	$fixedlookuprecipesResult = str_replace("' ", "/' ",
> >>>> $lookuprecipesResult);
> >>>>
> >>>> And:
> >>>>
> >>>> 	$fixedlookuprecipesResult = str_replace('" ', '/" ',
> >>>> $lookuprecipesResult);
> >>>>
> >>>> Nothing has worked.
> >>>>
> >>>> I'm assuming this doesn't work because, perhaps, it isn't looking
> >>>> "deep"
> >>>> into the array - but, for example, searching $lookuprecipesResult
> >>>> ['Recipe
> >>>> Ingredients'] gives me an undefined index error.
> >>>>
> >>>>
> >>>> Am I missing something obvious here?
> >>>> Any insight would be greatly appreciated!
> >>>>
> >>>> Thanks!
> >>>>
> >>>> Alex
> >>>>
> >>>> _______________________________________________
> >>>> FX.php_List mailing list
> >>>> FX.php_List at mail.iviking.org
> >>>> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>
> >>>
> >>> Derrick Fogle
> >>> derrick at fogles.net
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> FX.php_List mailing list
> >>> FX.php_List at mail.iviking.org
> >>> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> >>
> >>
> >> ---
> >> Erik Andreas Cayré
> >> Spangsbjerg Møllevej 169
> >> 6705 Esbjerg Ø
> >>
> >> Privat Tel: 75150512
> >> Mobil: 40161183
> >>
> >> ---
> >> »Interesse kan skabe læring på en skala sammenlignet med frygt, som
> >> en nuklear eksplosion i forhold til en kineser.«
> >> --Stanley Kubrick
> >>
> >> »Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af
> >> 'markedsanalyse', men af folk, der er afsindigt irriterede over
> >> tingenes tilstand «
> >> --Tom Peters
> >>
> >> »Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt
> >> nok.«
> >> -- Albert Einstein
> >>
> >> »Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så
> have
> >> tid til at lave det om?«
> >> -- John Wooden, basketball coach
> >>
> >>
> >> _______________________________________________
> >> FX.php_List mailing list
> >> FX.php_List at mail.iviking.org
> >> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> >>
> >> _______________________________________________
> >> FX.php_List mailing list
> >> FX.php_List at mail.iviking.org
> >> http://www.iviking.org/mailman/listinfo/fx.php_list
> >
> >
> >
> > ---
> > Erik Andreas Cayré
> > Spangsbjerg Møllevej 169
> > 6705 Esbjerg Ø
> >
> > Privat Tel: 75150512
> > Mobil: 40161183
> >
> > ---
> > »Interesse kan skabe læring på en skala sammenlignet med frygt, som
> > en nuklear eksplosion i forhold til en kineser.«
> > --Stanley Kubrick
> >
> > »Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af
> > 'markedsanalyse', men af folk, der er afsindigt irriterede over
> > tingenes tilstand «
> > --Tom Peters
> >
> > »Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt
> > nok.«
> > -- Albert Einstein
> >
> > »Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så have
> > tid til at lave det om?«
> > -- John Wooden, basketball coach
> >
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 
> 
> ---
> Erik Andreas Cayré
> Spangsbjerg Møllevej 169
> 6705 Esbjerg Ø
> 
> Privat Tel: 75150512
> Mobil: 40161183
> 
> ---
> »Interesse kan skabe læring på en skala sammenlignet med frygt, som
> en nuklear eksplosion i forhold til en kineser.«
> --Stanley Kubrick
> 
> »Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af
> 'markedsanalyse', men af folk, der er afsindigt irriterede over
> tingenes tilstand «
> --Tom Peters
> 
> »Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt nok.«
> -- Albert Einstein
> 
> »Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så have
> tid til at lave det om?«
> -- John Wooden, basketball coach
> 
> 
> _______________________________________________
> 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