save php variables permanently without database -
in admin area of site there form hostname, username , password mysql database site uses. these values hardcoded php class. can link form can edit variables in php class (and keep results on server, in other words variables hardcoded). i'd keep things in database can't done.
keep values in config file. , make sure not accessible web.
the easiest solution keep values in configuration array - user enters values, generate array it, file_put_contents("config.php", "<?php $config = " . var_export($config))
. method whenever need config array, need include config.php
, it's there.
this untested code, example purposes only. depending on situation, may need solve race conditions, file_put_contents
not enought that. main point of above code is: var_export
returns valid php code, can eval
(if you're evil enough) or echo file , include later.
Comments
Post a Comment