[kwlug-disc] Sending array variable over Web/CGI?

Khalid Baheyeldin kb at 2bits.com
Sat May 12 19:23:20 EDT 2018


Nothing wrong with building an array.

The issue here is that the data is in the URL (array or not), and that
means it will be logged in the server's access logs, and crawlers may
follow it, ...etc. It can also reveal things that you may not want to
reveal. An extreme case is login name and password in the URL!

The proper way to avoid all this is to use POST, where the data is not
logged anywhere, and not visible to anyone (if you use SSL).

On Sat, May 12, 2018 at 6:55 PM, Raymond Chen <raymondchen625 at gmail.com>
wrote:

> What's wrong with the CGI script building an array? I think using the same
> name multiple times is the way to go, at least it's common in other
> language like Java.
>
>
>
> On Sat, May 12, 2018 at 6:39 PM Khalid Baheyeldin <kb at 2bits.com> wrote:
>
>> You should really be using a POST for this, so the data is not in the URL
>> at all.
>>
>> But to your question, you can do:
>>
>> /cgi?A[0]=111&A[1]=222 ... etc.
>>
>> If it does not work, try escaping it with:
>>
>> %5B for [, and %5C for ]
>>
>>
>> On Sat, May 12, 2018 at 5:52 PM, William Park via kwlug-disc <
>> kwlug-disc at kwlug.org> wrote:
>>
>>> Hi all,  (apology if you're seeing it again)
>>>
>>> If I'm sending single valued data over web, eg. a=111, b=222, c=333,
>>> then I can do
>>>     http://.../xxx.cgi?a=111&b=222&c=333
>>>
>>> How do I send array data, like A[1]=111, A[2]=222, A[3]=333 to a CGI
>>> script?  I don't think I can do something like
>>>     http://.../xxx.cgi?A[1]=111&A[2]=222&A[3]=333
>>> Or, can I?
>>>
>>> I have seen places where a same variable is repeated, eg.
>>>     http://.../xxx.cgi?A=111&A=222&A=333
>>> but that means the CGI script has to build the array.
>>> --
>>> William Park <opengeometry at yahoo.ca>
>>>
>>> _______________________________________________
>>> kwlug-disc mailing list
>>> kwlug-disc at kwlug.org
>>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>>
>>
>>
>>
>> --
>> Khalid M. Baheyeldin
>> 2bits.com, Inc.
>> Fast Reliable Drupal
>> Drupal optimization, development, customization and consulting.
>> Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
>> Simplicity is the ultimate sophistication. -- anonymous
>>
>> _______________________________________________
>> kwlug-disc mailing list
>> kwlug-disc at kwlug.org
>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>
>


-- 
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- anonymous
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180512/f30eb590/attachment.htm>


More information about the kwlug-disc mailing list