query('UPDATE '.$db->prefix.'links_links SET `hits` = `hits` + 1 WHERE `id` = '.$_GET['id'].' ') or error('Unable to insert the category '. print_r($db->error()),__FILE__, __LINE__, $db->error()); $query = $db->query('SELECT `url` FROM '.$db->prefix.'links_links WHERE `id` = '.$_GET['id'].' ') or error('Unable select the link '. print_r($db->error()),__FILE__, __LINE__, $db->error()); $link = $db->fetch_assoc( $query ); header("Location: ".$link['url'].""); exit(); } session_start(); define('PUN_ROOT', './'); define('PUN_MAIN', 1); @include PUN_ROOT.'config.php'; require PUN_ROOT.'include/common.php'; require PUN_ROOT.'include/email.php'; require_once PUN_ROOT."lang/".$pun_user['language']."/Links_with_category.php"; // title $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_links['page_title']; require PUN_ROOT.'header.php'; if ( $pun_config['o_links_debug_info'] == '1' ) { function parsetime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $start_time = parsetime(); } if ( $pun_config['o_links_captcha'] == '1' ) { function captcha() { global $lang_links; // Function demands a started session, check here if the session is started if ( session_id() == '' ) { message("The captcha function for the form could not be started, so out of security reasons this page is disabled"); } $numbers = array( 0 => "".$lang_links['zero']."", 1 => "".$lang_links['one']."", 2 => "".$lang_links['two']."", 3 => "".$lang_links['three']."", 4 => "".$lang_links['four']."", 5 => "".$lang_links['five']."", 6 => "".$lang_links['six']."", 7 => "".$lang_links['seven']."", 8 => "".$lang_links['eight']."", 9 => "".$lang_links['nine']."", 10 => "".$lang_links['ten']."" ); $possibilities = array( array("dummy", "dummy"), array("+", "".$lang_links['plus'].""), array("-", "".$lang_links['minus'].""), array("*", "".$lang_links['times']."") ); // Het eerste getal van de rekensom (random) $first = rand( 1,count( $numbers )-1 ); $second = rand( 1,count( $possibilities )-1 ); $third = rand( 1,count( $numbers )-2 ); if ( ( $first <= $third ) ) { $first = '10'; } $firstInt = $first; $secondInt = $possibilities[$second][0]; $thirdInt = $third; $firstText = $numbers[$first]; $secondText = $possibilities[$second][1]; $thirdText = $numbers[$third]; $tmpResult = '$result = '.$firstInt.$secondInt.$thirdInt.';'; eval($tmpResult); // Set the session $_SESSION['result'] = $result; // return the captcha to the user return $lang_links['what_is']." ".$firstText." ".$secondText." ".$thirdText."?*"; } } // if the insert button is hit, insert the link here if ( isset( $_POST['insert'] ) ) { $category = $_POST['category']; $name_link = $_POST['name_link']; $url = $_POST['url']; // if the name of the link is empty show message if ( $name_link == '' ) { message(''.$lang_links['error_name_link'].''); } // if the link is empty show message if ( !preg_match( "/^[a-zA-z0-9:\/\.\-\?&_=]+$/",$url ) ) { message(''.$lang_links['error_url'].''); } if ( $pun_config['o_links_captcha'] == '1' ) { // if the captcha is on and did not match show message if ( $_POST['captcha'] != $_SESSION['result'] ) { message( ''.$lang_links['error_captcha'].'' ); } } if ( $pun_config['o_links_review'] == '1' ) { $show = 1; $target = '_blank'; } else { $show = 0; $target = ''; } $url = $db->escape($url); $url = str_replace('&', '&', $url); $url = str_replace('&', '&', $url); $db->query("INSERT INTO `".$db->prefix."links_links` (`name_link`, `url`, `category`, `target`, `show`) VALUES ('".$db->escape($name_link)."', '".$url."', '".$category."', '".$target."', '".$show."') ") or error('Unable to insert the category '. print_r($db->error()),__FILE__, __LINE__, $db->error()); // if the webmaster wants an email when a link is inserted then send it here if ( $pun_config['o_links_send_mail'] == '1' ) { $get_category = $db->query('SELECT * FROM `'.$db->prefix.'links_category` WHERE `id` = '.$category.' ') or error('Unable to get the category '. print_r($db->error()),__FILE__, __LINE__, $db->error()); $link_category = $db->fetch_assoc($get_category); $admin_mail = $pun_config['o_webmaster_email']; $subject = $lang_links['new_link_posted'].' '.$pun_config['o_board_title'].''; $message = $lang_links['mail_message']."\n"; $message .= $lang_links['link_name'].' : '.$name_link.''."\n"; $message .= $lang_links['link_url'].' : '.$url.''."\n"; $message .= $lang_links['category'].' : '.$link_category['category'].''."\n"; $message .= $lang_links['mail_message_2'].' : '.$pun_config['o_base_url'].''; pun_mail( $admin_mail, $subject, $message, pun_htmlspecialchars( $pun_config['o_board_title'] ) ); } $updated = true; if ( $updated ) { // Regenerate the config cache require_once PUN_ROOT.'include/cache.php'; generate_config_cache(); $redirect = str_replace("?new_link", "", $_SERVER['REQUEST_URI']); redirect($redirect, $lang_links['link_saved']); } } elseif ( isset( $_GET['new_link'] ) ) { // check here if anybody may post a link, if not show message if ( $pun_config['o_links_guest_posts'] == '0' ) { message( $lang_links['error_no_post'] ); } $query = $db->query('SELECT * FROM `'.$db->prefix.'links_category` ORDER BY `category` ASC ') or error('Unable to fetch category list ', __FILE__, __LINE__, $db->error()); ?>