Forum Moderators: coopster

Message Too Old, No Replies

query string

query string

         

medicine

6:54 pm on Jun 16, 2007 (gmt 0)

10+ Year Member



Something went wrong the last time I posted this topic. First it went into the "Hams" section and second I lost access to it. So I am posting it again. My question is

Is it possible to set a public object property through the browser query string?

dreamcatcher

6:57 pm on Jun 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry about that medicine, my fault. You had posted 3 times and I was trying to remove the duplicates. For some reason the system nuked the lot.

dc

medicine

6:59 pm on Jun 16, 2007 (gmt 0)

10+ Year Member



Sorry for the 3 replies. My browser got stuck and I clicked multiple times and boom there were three posts. Sorry.

coopster

11:58 am on Jun 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, medicine.

No, it is not possible to directly set a PHP public object property through the browser query string. Not unless you have the PHP script in the REQUEST containing the QUERY_STRING parse the data and set the public object property. For example, let's say your link is http://example.com/path/to/phpscript.php?property=newproperty. phpscript.php might do something like this ...

<?php 
$newproperty = (isset($_GET['property'])) ? $_GET['property'] : '';
$myClass = new myClass();
$myClass->newproperty = $newproperty;
?>

medicine

5:12 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



Thanks. The reason why I asked was because I usually set the properties and then invoke functions which use the set property instead of sending any function arguments and was worried about query string hacker attacks. Thanks for your help.