return false; } function locate_and_include($pattern) { $filepath = locate($pattern); if ($filepath == false) { return false; } include_once $filepath; return true; } // Run the common initialization tasks //include configuration file $custom_path = locate('custom.php'); if ($custom_path == false) { error_found(E_USER_ERROR, "The custom.php file does not exist. Please copy the default.php file and mofify it to your environment", "init.php", 8); } include_once $custom_path; function error_found($level, $mymsg, $errfile, $errline) { // header("Location: upss1.php"); header("Message: " . $mymsg . ' - ' . $errfile . '(' . $errline . ')'); global $allowedErrors, $allowingErrors; if ($allowingErrors && in_array($mymsg, $allowedErrors)) { return true; } include_once locate('upss.php'); exit; } set_error_handler('error_found'); //include database connection details
} } if (!empty($command)) { // REtrieving target URL from url param containing shorten URL $handler = fopen($_SERVER['DOCUMENT_ROOT'] . "/features/fdb/" . $command, "r+"); if ($handler) { $linkinfo = fscanf($handler, "%s %s %s %s\n"); fseek($handler, -5, SEEK_END); $redirect = $linkinfo[0]; $hits = sprintf('%05d', intval($linkinfo[3]) + 1); echo $hits . ',' . $redirect; fwrite($handler, $hits); fclose($handler); header('HTTP/1.1 301 Moved Permanently'); header("Location: " . $redirect); header("Result: Redirect to " . $redirect); exit; } else { error_found(E_USER_ERROR, "No shorten URL found for url=" . $command . " Redirecting to home (" . $home . ")", "ffwd.php", 27); } } else { error_found(E_USER_ERROR, "Empty command"); // Proxies. } header('HTTP/1.1 301 Moved Permanently'); header("Location: http://" . $home . "/" . $command); header("Result: Exiting http://" . $home . "/" . $command); ?>
</thead> <tbody> <?php global $site; echo $site; if (!empty($site)) { // REtrieving target URL from url param containing shorten URL $result = mysql_query("SELECT url_link, url_hits, url_ip, url_date FROM urls"); if (!$result) { error_found(E_USER_ERROR, "Could not successfully get the shortener stats (" . mysql_error() . ")"); // Proxies. } if (mysql_num_rows($result) == 0) { // No shorten URL found. Redirecting to home error_found(E_USER_ERROR, "No rows found in urls TABLE. Redirecting to home (" . $home . ")", "fwd.php", 27); } else { ?> <?php while ($row = mysql_fetch_assoc($result)) { ?> <tr> <td style="padding:0"><a href="<?php echo $row["url_link"]; ?> " target="_blank"><?php echo "[DB]" . $row["url_link"]; ?> </a></td> <td style="text-align:center;padding:0"><?php echo $row["url_hits"];