0byt3m1n1
Path:
/
data
/
applications
/
aps
/
gallery
/
2.2-08
/
scripts
/
[
Home
]
File: file-util.php
<?php function print_stderr($message) { fwrite(STDERR, $message); } function read_file($file) { return fread(fopen($file, 'r'), filesize($file)); } function write_file($file, $content) { $fp = fopen($file, 'wb'); if (!$fp) { print "Unable to write file $file.\n"; exit(1); } fputs($fp, $content, strlen($content)); fclose($fp); } function php_quote($val) { $res_val = str_replace("\\", "\\\\", $val); $res_val = str_replace("'", "\\'", $res_val); return $res_val; } function modify_file($file_source, $file_dest, $modify_hash) { $file_content = read_file($file_source); foreach($modify_hash as $param => $val){ $file_content = str_replace($param, php_quote($val), $file_content); } write_file($file_dest, $file_content); } function modify_content($file_source, $modify_hash) { $file_content = read_file($file_source); foreach($modify_hash as $param => $val){ $file_content = str_replace($param, mysql_real_escape_string($val), $file_content); } return $file_content; } ?>