latheesan
02-13-2006, 04:25 PM
I have an admin interface where admin has the option to enter ad code, e.g. adsense code on the form and then hit "save" button.
once the admin press the "save" button, the data from the form will be stored on a php file called ads.php in this format.
<?php
$enable_ads = 'yes';
$ad_type = 'inline';
$ad_code 'Adsense Code Here';
?>
now, this ads.php file will be loaded inside of other scripts, e.g. index.php
One of the member who tested my script commented this:
I can see that you can inject arbitrary PHP in there
So, how can i prevent this? Is there a safe method of writing form data into a php file, whilst eliminating any risk of injection of arbitrary PHP?
once the admin press the "save" button, the data from the form will be stored on a php file called ads.php in this format.
<?php
$enable_ads = 'yes';
$ad_type = 'inline';
$ad_code 'Adsense Code Here';
?>
now, this ads.php file will be loaded inside of other scripts, e.g. index.php
One of the member who tested my script commented this:
I can see that you can inject arbitrary PHP in there
So, how can i prevent this? Is there a safe method of writing form data into a php file, whilst eliminating any risk of injection of arbitrary PHP?
