$v) { $message = sprintf("%s\n%s: %s", $message, $k, $v); } $from = sprintf("From: %s\r\n", $_POST['email']); $reply = sprintf("Reply-To: %s\r\n", $_POST['email']); $headers = $from . $reply . 'X-Mailer: PHP/' . phpversion(); mail('maria@northwestway.it', 'Accomodation request', $message, $headers); } function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } $handle = fopen($_SERVER["DOCUMENT_ROOT"]. '/index-it.txt', "r"); $level = substr_count($_SERVER["PHP_SELF"], '/') - 1; $self = dirname($_SERVER["PHP_SELF"]); $c = 0; while (!feof($handle)) { $buffer = fgets($handle, 4096); if ($c % 2 == 0) { preg_match('/^\s*([\w\s]*)\W*([^<]*)/', $buffer, $parts); $menu[$c/2]['title'] = $parts[2]; $menu[$c/2]['link'] = $parts[1]; } else { $menu[$c/2]['master'] = preg_replace('/\/[^\/]*$/','',substr(trim($buffer),1)); $menu[$c/2]['level'] = substr_count($menu[$c/2]['master'], '/'); if (preg_match('/\/index.html$/',substr(trim($buffer),1))) { $menu[$c/2]['level'] = substr_count($menu[$c/2]['master'], '/') - 1; $masters[$menu[$c/2]['master']] = $menu[$c/2]['link']; } $menu[$c/2]['uri'] = substr(trim($buffer),1); } $c ++; } $contents = preg_replace('/\.php$/', ".html", basename($_SERVER["PHP_SELF"])); if (file_exists($contents)) { $handle = fopen($contents, "r"); while (!feof($handle)) { $buffer = fgets($handle, 4096); if (!$foundit && (preg_match('/^\s*<body\s/', $buffer))) { $foundit =1; $buffer = ''; } elseif (preg_match('/^\s*<title>([\w\s]*)\W*([^<]*)/', $buffer, $parts)) { printf('<html><head>'); echo ("<title>$parts[2]\n"); printf(''); printf(''); $dir = "/var/www/share/.vhost.saltway.it/immagini/ Foto Random Headline/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (is_file(sprintf("%s/%s", $dir, $file))) { $images[] = $file; } } closedir($dh); } } // seed with microseconds srand(make_seed()); $r = rand(0,count($images)-1); printf('
An easy accomodation in NorthWest Italy
', $images[$r]); ksort($masters); printf('
'); } if ($foundit) { if (!(preg_match('/<\/body>|<\/html>/',$buffer))) { echo $buffer; } } } fclose($handle); printf(' '); printf('
'); printf(''); } ?>