I somehow thought that it would be nice to make a module for managing configs, so that you can download the daddy via ftp, set passwords and then use it in any CMS / scripts / applications. What I would like from him: universality (storage of any variables), speed, ease, protected "admin" editor, methods for changing-saving. Because the search was not pleased, but the work of craftsmen leaves much to be desired, I decided to do it myself.
Immediate questions:
- in what format to store configs? (we need speed and versatility, hand editing is absolutely not important, because it is clearly not ini and obviously not xml, I look towards serialize, waiting for criticism or approval)
- Does anyone have any ideas for the "value of function" type? For now, I’m thinking of making a static array, so that at each access it will not produce functions, and set variables with a special type (see the appendix). What for? For example, to auto-install paths. As an option - stupidly eval'it code (interesting arguments for / against).
- Does anyone know a thing like winbinder , but more pleasant to handle? I would like to do an independent editor for this case, and I don’t really want to write a parser-serializer from scratch = /
- and the question is clearly experienced hackers (in the original sense) - how to stop parsing and interpreting the script in a certain place, or simply insert a non-executable area into the file? (see attachment 2)
Application:
if (!in_array($function_id, $static_array)) $static_array[$function_id] = create_function('', $function_code); return $static_array[$function_id]();
Appendix 2:
<? // исполняемая область exit; ?> неисполняемая область, набор случайных символов, в которой может встретиться "<?" или "<?php", а также непечатаемые символы (%00-%09 например) есть ли способ где-то в районе "exit;" остановить парсинг, чтобы этот файл отработал без ошибок? Без обработки неисполняемой области. Может быть что-то связанное с HEREDOC, мне чутье подсказывает. <? // исполняемая область, ее можно исключить ?>
PS: if it goes, of course, I will share the result)
UPDATE: joyful update!) 4 question solved by myself. If anyone is interested, this is an idea for php-sfx archives. If you create a heredoc tag from sha1 (mt_rand (0, 100000). $ _ SERVER ['SERVER_NAME']. 'Still a bunch of variables'), you can even shove archives into each other without steaming. Those who like the idea - use)
<? if (!$f = fopen(__FILE__, 'rb')) die('Pls open read rights'); $CONTENT = ''; while (!feof($f) && (trim($s = fgets($f)) != '<<<PHPSFX8BAE970D3871669D96F9DF91C41735A14F8873A6')) {}; while (!feof($f) && (trim($s = fgets($f)) != 'PHPSFX8BAE970D3871669D96F9DF91C41735A14F8873A6;')) $CONTENT .= $s; fclose($f); echo '<pre>'.htmlspecialchars($CONTENT).'</pre>'; echo '<pre>'.htmlspecialchars(file_get_contents(__FILE__)).'</pre>'; exit; <<<PHPSFX8BAE970D3871669D96F9DF91C41735A14F8873A6 ?>aas das d<?asd $@#^ @W SC GDG SDG Q@#% ! %@ @#% @# @#@@@@@@@@@@@@@@@@@<?ASDasdasd PHPSFX8BAE970D3871669D96F9DF91C41735A14F8873A6; ?>
This is a test script, demo here .