$v) { $v = htmlspecialchars($v); $v = str_replace("\t", ' ', $v); fwrite($f, "$k>$v\t"); } fclose($f); } $message_template = fopen('message.inc.php', 'r'); $message_template = fread($message_template, filesize('message.inc.php')); $f = fopen('db.index', 'r'); $index = array_reverse(split("\n",fread($f, filesize('db.index')+1))); fclose($f); $orig_index = $index; $i = isset($_GET['skip']) ? (int)$_GET['skip'] : '0'; $k = $i+$per_page; while($i > 0) { array_shift($index); $i--; } while($k < count($orig_index)) { array_pop($index); $k++; } $i = 0; while($i'.($i/$per_page+1). ' '; $i+=$per_page; } foreach ($index as $message) { $message_info = split("\t", $message); foreach ($message_array as $k=>$v) { $message_array[$k] = ''; } foreach ($message_info as $field) { $option = split('>', $field); foreach ($fields as $config_field=>$config_value) { if ($config_field == $option[0]) { $message_array[$config_field] = str_replace('{'.$config_field.'}', $option[1], $config_value); } } } $template = $message_template; foreach ($message_array as $field=>$value) { $template = str_replace('{'.$field.'}', $value, $template); } foreach ($fields as $config_field=>$config_value) { $template = str_replace('{'.$config_field.'}', '', $template); } print $template; } require 'footer.inc.php'; ?>