На главную"); } if( file_exists( ENGINE_DIR."/data/partners/{$group}.txt" ) ) { $db = array(); $dbPreview = array(); $file = file( ENGINE_DIR."/data/partners/{$group}.txt" ); foreach( $file as $banner ) { $banner = trim( $banner ); $banner = explode("|", $banner); if( $db[ $banner[0] ] ) { $i = $dbPreview[ $banner[0] ] + 1; $new_id = $banner[0]."_&-{$i}-&"; $dbPreview[ $banner[0] ] = $i; $db[ $new_id ] = $banner; } else { $db[ $banner[0] ] = $banner; $dbPreview[ $banner[0] ] = 1; } } if( $db[$id] ) { $db[$id][12] = intval( $db[$id][12] ) + 1; if( $many and $db[$id][15] ) { $i = 1; if( $db[$id][1] == "full" ) { $full = true; $list = explode("##", $db[$id][4]); } else { $list = explode("##", $db[$id][5]); } foreach( $list as $value ) { if( !$full ) $value = explode("#", $value); if( $i == $many ) { if( $full ) $link = $value; else $link = $value[1]; } $i++; } if( empty( $link ) ) { header( 'Location: /index.php' ); die("Нажмите на меня для перехода"); } } else { $link = $db[$id][4]; } $rec_id = preg_replace("#_&-([0-9]+)-&#Us", "", $db[$id][0]); $rec_name = $db[$id][3]; @unlink( ENGINE_DIR."/data/partners/{$group}.txt" ); $record = fopen( ENGINE_DIR."/data/partners/{$group}.txt" , "w"); foreach( $db as $id => $value ) { $value[0] = preg_replace("#_&-([0-9]+)-&#Us", "", $value[0]); $value = implode("|", $value); fwrite($record, $value."\n"); } fclose($record); if( $bannerconfig['stats'] == "yes" ) { $other = array(); $other_in_array = explode( "#-&-#", $db[$id][23] ); foreach( $other_in_array as $ValueOther ) { $ValueOther = explode( "=", $ValueOther ); $other[ $ValueOther[0] ] = $ValueOther[1]; } if( $other['count_stats'] == 1 ) { $banner_alt_name = $db[$id][3]; if( $_SESSION['dle_user_id'] ) $user_id = intval( $_SESSION['dle_user_id'] ); $ip = $_SERVER['REMOTE_ADDR']; $ThisDate = date("Y")."-".date("m")."-".date("d")." ".date("G").":".date("i").":".date("s"); $new_rec_stats = "{$rec_id}|click|{$rec_name}|{$db[$id][6]}|{$user_id}||{$link}|{$ThisDate}|{$ip}"; $stats_record = fopen( ENGINE_DIR."/data/partners/stats/cashe/global.dat" , "a"); fwrite($stats_record, $new_rec_stats."\n"); fclose($stats_record); } } header( "Location: {$link}" ); die("Нажмите на ссылку для перехода: {$link}"); } else { header( 'Location: /index.php' ); } } else { header( 'Location: /index.php' ); } ?>