Help with php code

Discussion in 'PHP' started by web@master24, Aug 16, 2009.

  1. #1
    Hi, im have a code for the user select the language, the next code is the code what detect the session and include the language file in the site:

    if($_SESSION['lang']){
        //A session has been created with a selected language
       
        if($_SESSION['lang'] == "en"){
            include_once($web_root."includes/english.php");
        }
        elseif($_SESSION['lang']== "es"){
            include_once($web_root."includes/language.php");
        }
        else{
            echo "<h2>An unknown choice is stored in the lang</h2>";
        }
    }
    else{
        //A language has not yet been selected by the user,  so use the default language
        include_once($web_root."includes/spanish.php");
    }
    PHP:
    The think, is i change my website, and now i want this code dont load the language file, i want the code send the user to a url, example:

    Is the user select spanish send to: www.myweb.com/es

    and if select the english send to :www.myweb.com/en

    i hope somebody can helpme, thanks
     
    web@master24, Aug 16, 2009 IP
  2. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #2
    
    if($_SESSION['lang']){
        //A session has been created with a selected language
       
        if($_SESSION['lang'] == "en"){
            @header("Location: http://myweb.com/en");
        }
        elseif($_SESSION['lang']== "es"){
            @header("Location: http://myweb.com/es");
        }
        else{
            echo "<h2>An unknown choice is stored in the lang</h2>";
        }
    }
    else{
        //A language has not yet been selected by the user,  so use the default language
        //don't change the location and do nothing?
    }
    
    PHP:
    And if you support many languages, you might try something more like this:

    
    if($_SESSION['lang']){
        //A session has been created with a selected language
        @header("Location: http://myweb.com/{$_SESSION['lang']}");
    }
    
    PHP:
     
    Gray Fox, Aug 16, 2009 IP
  3. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Thanks man, works, only i dont understand the:

    if($_SESSION['lang']){
    //A session has been created with a selected language
    @header("Location: http://myweb.com/{$_SESSION['lang']}");
    }
     
    web@master24, Aug 16, 2009 IP
  4. bluebenz

    bluebenz Well-Known Member

    Messages:
    876
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    138
    #4
    
    
    header("Location: ..");
    
    
    Code (markup):
    is send the browser back to a URL specified after "Location: "..
     
    bluebenz, Aug 16, 2009 IP
  5. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #5
    The second code redirects user to
    
    "http://myweb.com/" . $_SESSION['lang'];
    
    PHP:
    So your $_SESSION['lang'] can contain any language string and it will redirect user to http://myweb.com/[lang]
    That might be a better solution only if you have many language options on your website, but if you only use English and Spanish, first solution is much better.
     
    Gray Fox, Aug 16, 2009 IP
  6. j4jawaid

    j4jawaid Peon

    Messages:
    94
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In this code he is trying to firs check whether $_SESSION['lang'] exists or not if it exists then redirect to http://myweb.com/{$_SESSION['lang']} . For example if $_SESSION['lang'] ="en" it would redirect to http://myweb.com/en
    if $_SESSION['lang'] ="fr" it would redirect to http://myweb.com/fr

    and so on a small code to do your work making your life easier. still have any confusion? straight away ask me. i am here to help you guyz. :)
     
    j4jawaid, Aug 16, 2009 IP
  7. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #7
    Hi, thanks man works great, only i have a question, look, the script what i have is the attmp3 script, the deal is the script have templates, so have a init.php but im put there and not redirect correctly, here is a coded of template main:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script language="JavaScript" type="text/JavaScript" src="http://www.mimp3.net/livehelp/include/javascript.php"></script>
    <LINK REL="SHORTCUT ICON" HREF="http://www.mimp3.net/favicon.ico" />
    {headers}
    <link rel="stylesheet" type="text/css" href="{THEME}/css/unity_general.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/unity_general_1024.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/unity_footer.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/unity_header.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/ym_music.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/ym_popup.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{THEME}/css/smartsearch.css" media="screen" />
    <link href="{THEME}/css/engine.css" rel="stylesheet" />
    </head>
    
    <body>
    {AJAX}
    <div id="uni_wrapper">
    	<div id="uni_container">
    		<div id="uni_header">
    			<div class="uni_header_leftCorner"></div>
    			<div class="uni_header_inner">
    				<div class="brand_logo">
    					<!--<a href="{homepage}"/><img src="{THEME}/images/logo_attmp3.jpg"></a>-->
    				</div>
    				<div class="top_bar">
    					<ul class="link_list">
    				<li class="lower_newmail">
    					<img src="{THEME}/images/blank.gif" alt="" class="img_home"> <span class="home"></span> 
    
    			{login}
    
    			
    		</div>		
    		<div id="box_menu">			
    			<ul id="a_menu" class="clearfix">
    				<li class="active">
    				  <p class="f_menu"><a href="{homepage}" class="item"><span>Principal</span></a></p>
    				</li>
    				<li ><a href="{homepage}playlist/" class="item" ><span>TOP playlists</span></a></li>
    				<li ><a href="{homepage}?do=addnews" class="item" ><span>Agregar Articulo</span></a></li>
    				<li ><a href="{homepage}tutoriales.html" class="item"><span>Tutoriales</span></a></li>
    			    <li ><a style="cursor: pointer;" onclick="popUp('{homepage}engine/mp3/playlist.php',506,300,2);" class="item"><span>Crear Playlist</span></a></li>
    				<li ><a href="{homepage}mu.html" class="item"><span>Megaupload Premium</span></a>
                    <li ><a href="http://www.viciovirtual.com" target="_blank" class="item"><span>Foro</span></a>
                    <li class="li_end">
                    
                    <a class="item" style="cursor: pointer;" onclick="openLiveHelp(); return false"><span style="cursor:pointer">Ayuda Online</span></a>
                    </li>
                    
                   
    </ul>
    
    		</div>
    <div id="uni_content_outer">
    <div id="uni_content">
    	<div id="ymms_2cl">
    	  <div id="ymms_2cl_t"><!-- START 652x156 AdPeeps.com Code -->
    <p align="center">
    <iframe src="http://www.mimp3.net/ad/adpeeps.php?bfunction=showad&amp;uid=100000&amp;bmode=off&amp;bzone=default&amp;bsize=652x156&amp;btype=4&amp;bpos=default&amp;ver=2.0&amp;btarget=_blank" frameborder="0" width="652" height="156" scrolling="no" marginheight="0" marginwidth="0">
    <ilayer src="http://www.mimp3.net/ad/adpeeps.php?bfunction=showad&amp;uid=100000&amp;bmode=off&amp;bzone=default&amp;bsize=652x156&amp;btype=4&amp;bpos=default&amp;ver=2.0&amp;btarget=_blank" frameborder="0" width="652" height="156"></ilayer>
    </iframe>
    </p>
    <!-- END AdPeeps.com Code --></div>
       
    
    
    <div id="ymms_2cl_l">
    			<div id="bcate_ll">
    	<div class="bcate_ll_header">
    		<div class="bcate_ll_h_l">
    			<div class="bcate_ll_h_r">
    				<p class="bcate_ll_title">Artistas</p>
    			</div>
    		</div>
    	</div>
    	<ul class="boxcate_ll_content">
        
    			{artist}
    			
    	</ul>
    </div>		</div>
    	  <div id="ymms_2cl_r">
    		  
    <style>
    .smartSearch{top:56; _top:56;}
    </style>
    <script>var searchpage = '{homepage}thuy.php';</script>
    
    <div id="ym_mus_tabsearch">
    	<form name="frmSearch" id="frmSearch" method="get" onSubmit="checkFormSearch(loai, tukhoa);return false;">
    	<div class="tab_menu">
    		<ul>
    			<li class="active" id="tab90" onclick="photo_active_tab(this,0); setFromSearchType(0,'txtKeyword0'); return false;"><a href="#"><span><strong>Mp3</strong></span></a></li>
    			<li id="tab92" onclick="photo_active_tab(this,0); setFromSearchType(2,'txtKeyword2'); return false;"><a href="#"><span><strong>Letras de Canciones</strong></span></a></li>
    			<li id="tab93" onclick="photo_active_tab(this,0); setFromSearchType(3,'txtKeyword3'); return false;"><a href="#"><span><strong>Albums</strong></span></a></li>
    			<li id="tab94" onclick="photo_active_tab(this,0); setFromSearchType(4,'txtKeyword4'); return false;"><a href="#"><span><strong>Listas de reproduccion</strong></span></a></li>
    			<li id="tab95" onclick="photo_active_tab(this,0); setFromSearchType(5,'txtKeyword5'); return false;"><a href="#"><span><strong>Videos</strong></span></a></li>
    		</ul>
    	</div>
    	<div class="tab_content">
    		<input type="hidden" name="type"/>
    		<input type="hidden" name="alpha" />
    		<input type="hidden" name="tag" />
    		<div class="song_ctn" id="cont90">
    				<input autocomplete="off" onkeypress="return getWordsFromInput(event, this.id)" onkeydown="setIndexSmartSearch(event, this.id)" name="txtKeyword0" id="txtKeyword0" type="text" class="txt_field" value="Ingresa las palabras para buscar Mp3s en MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar Mp3s en MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar Mp3s en MiMp3!'"/>
    			<input name="" type="button" class="search_btn" value="Buscar MP3s!" onclick="checkFormSearch(0,'txtKeyword0');"/>
    		</div>
    		<div class="song_ctn" id="cont91" style="display:none;">
    			<input onkeypress="return getWordsFromInput(event, this.id)" onkeydown="setIndexSmartSearch(event, this.id)" name="txtKeyword1" id="txtKeyword1" type="text" class="txt_field" value="Ingresa las palabras para buscar Artist with MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar Artist with MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar Artist with MiMp3!'"/> <input name="" type="button" class="search_btn" value="Artist Search!" onclick="checkFormSearch(1,'txtKeyword1');" />
    		</div>
    		<div class="song_ctn" id="cont92" style="display:none;">
    			<input onkeypress="return getWordsFromInput(event, this.id)" onkeydown="setIndexSmartSearch(event, this.id)" name="txtKeyword2" id="txtKeyword2" type="text" class="txt_field" value="Ingresa las palabras para buscar Letras en MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar Letras en MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar Letras en MiMp3!'"/> <input name="" type="button" class="search_btn" value="Buscar Letras!" onclick="checkFormSearch(2,'txtKeyword2');" />
    		</div>
    		<div class="song_ctn" id="cont93" style="display:none;">
    			<input onkeypress="return getWordsFromInput(event, this.id)" onkeydown="setIndexSmartSearch(event, this.id)" name="txtKeyword3" id="txtKeyword3" type="text" class="txt_field" value="Ingresa las palabras para buscar Albums en MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar Albums en MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar Albums en MiMp3!'"/> <input name="" type="button" class="search_btn" value="Buscar Albums!" onclick="checkFormSearch(3,'txtKeyword3');" />
    		</div>
    		<div class="song_ctn" id="cont94" style="display:none;">
    			<input onkeypress="return getWordsFromInput(event, this.id)" onkeydown="setIndexSmartSearch(event, this.id)" name="txtKeyword4" id="txtKeyword4" type="text" class="txt_field" value="Ingresa las palabras para buscar Playlist en MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar Playlist en MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar Playlist en MiMp3!'"/> <input name="" type="button" class="search_btn" value="Buscar Playlist!" onclick="checkFormSearch(4,'txtKeyword4');" />
    		</div>
    		<div class="song_ctn" id="cont95" style="display:none;">
    			<input name="txtKeyword5" id="txtKeyword5" type="text" class="txt_field" value="Ingresa las palabras para buscar VideoClips en MiMp3!" onfocus="if (this.value=='Ingresa las palabras para buscar VideoClips en MiMp3!') this.value=''" onblur="if (this.value=='') this.value='Ingresa las palabras para buscar VideoClips en MiMp3!'"/>
    			<input name="" type="button" class="search_btn" value="Buscar Videos!" onclick="checkFormSearch(5,'txtKeyword5');" />
    		</div>
    	</div>
    	<input type="image" src="" width="0" height="0"/>
    	</form>
    </div>
    <div id="divSmartSearch" class="smartSearch" style="display:none;"></div>		  
    {speedbar}
    
    {AjaxMp3}
    {info}
    {topmusic}
    {banner_300nr}
    {content}
    {useronline}</div>
    	</div>
    	<div id="ymms_2cr">
    	  <div id="salient_month">
    <div class="content_salient_month">
    
    <div class="title"><span class="text">   Lo + TOP de MiMp3</span></div>
    <div class="event">
      <div class="topic_title"><span class="name">Cancion de la semana</span></div>									
      <p class="title_event">
      	<a href="http://www.mimp3.net/playmusic/VW5rbm93bg,,/U2hha2lyYSAtIExhICBMb2Jh/aHR0cDovL3d3dzBqdGVrLndyenV0YS5wbC9zci9mLzRCTFBEY0dtM0tSLy5tcDM," title="Top 10 nữ Idol trước giờ G">
    	Shakira - La Loba</a>
      </p>
      <p class="content_event"><object type='application/x-shockwave-flash' data='http://www.mimp3.net/mp3/thuyplayer.swf' id='audioplayer1' width='290' height='24'><param name='movie' value='http://www.mimp3.net/mp3/thuyplayer.swf'><param name='FlashVars' value='playerID=1&bg=0xf2fcc8&leftbg=0xdcfb9c&lefticon=0x86b454&rightbg=0xfd996d&rightbghover=0xfd8048&righticon=0xffffff&righticonhover=0xfffa6d&text=0x666666&slider=0xa1b746&track=0xFFFFFF&border=0x666666&loader=0xe6fd88&soundFile=http://www.mimp3.net/mp3/thuyrd.php?mp3=aHR0cDovL3d3dzBqdGVrLndyenV0YS5wbC9zci9mLzRCTFBEY0dtM0tSLy5tcDM,'><param name='quality' value='high'><param name='menu' value='false'><param name='wmode' value='transparent'></object>&nbsp;</p>
    </div>
    <div class="song">
      <div class="topic_title"><span class="name">Votanos</span></div>
      <ul class="lst_song">
     	  <li>
     	    <p align="center"><div style="width: 97px; height:116px;">
     	      <div align="center"><a href="http://mimp3.tutop.com"  target="_blank"><img src="http://www.tutop.com/imagenes/votacion/tutop_boton_3.gif" width="97" height="96" border="0"><img src="http://www.tutop.com/imagen_posicion.php?id=17213" border="0" width="97" height="20"></a></div>
     	    </div>&nbsp;</p>
     	  </li>
      	  </ul>
    </div>
    <div class="singer">
      <div class="topic_title"><span class="name">mantente conectado a mimp3</span></div>
      <p align="center" class="singer_name"> <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/es_LA" type="text/javascript"></script><script type="text/javascript">FB.init("c081917afcda6cedbc643bbed1cf6cb0");</script><fb:fan profile_id="105417903947" stream="" connections="10" width="300"></fb:fan>&nbsp;
      <div class="view_more"></div>
      </div>
    </div>
    </div>
    <div id="ymms_2cr">
    	   <div id="ymmus_tagcloud">
    
    	<div class="bcate_ll_header">
    		<div class="bcate_ll_h_r">
    			<div class="bcate_ll_h_l">Encuesta</div>
    		</div>
    	</div>
    	<div class="tagcloud_content">{vote}</div></div>
    {topplaylist}
    {tags}
    {playlisttags}
    
    
    
    
    
        
        <div id="ymmus_tagcloud">
    
    	<div class="bcate_ll_header">
    		<div class="bcate_ll_h_r">
    			<div class="bcate_ll_h_l">Publicidad</div>
    		</div>
    	</div>
    	<div class="tagcloud_content">{banner_250}</div>
        </div>
    
    	</div>
    </div>
    </div>
    <script>
    function showContent(content, type, page)
    {
    	strContent = document.getElementById(content).innerHTML;
    	if (strContent == '')
    	{
    		ajax_showContent(content, type, page);
    	}
    }
    gPage = 'public';
    </script>
      <div id="uni_footer">
    		<div class="uni_footer_bottom_outer">
    			<div id="uni_footer_inner">
    			<div id="uni_footer_1">
    				<div id="search_bottom">
    					<form id="uni_form2" name="uni_form2" onSubmit="" action="{homepage}thuy.php" method="get">
    						<span>Buscar:</span>
    				        <input name="key" id="uni_txtSearch2" type="text" class="uni_khung_search" value="" />		
    						<input name="uni_flag2" id="uni_flag2" type="hidden" value="0" />
    						<input id="uni_btuSearch2" name="uni_btuSearch2" type="submit" value="Search" class="uni_nut_search"/>
    					</form>
    				</div>
    				
                  <div id="uni_module_list">
    				
    				<div class="col_01">
    					<p>Publicidad</p>
    				</div>
    					<div class="col_02">
    						<p>&nbsp;</p>
    						<p>{banner_google-ads-botton}</p>
    					</div>
    				<div class="col_03">
    					<p>&nbsp;</p>
    				</div>
    					<div class="col_04">
    						<p>&nbsp;</p>
    				</div>
    					<div class="col_05">
    						<p>&nbsp;</p>
    				</div>
    					<div class="col_06">
    						<p>&nbsp;</p>
    				</div>
    			  </div>
    			</div>
    			<div class="uni_footer_bottom"></div>
    			<div id="uni_footer_2">
    				<div id="uni_siteinfo_menu">
    						<ul>
    							<li><script type="text/javascript" src="http://widgets.amung.us/colored.js"></script><script type="text/javascript">WAU_colored('gn7c4oupvl9f', '8cc63ffffdea')</script></li> 
    							<a href="http://www.up2host.com" target="_blank">Sube 
    						tus archivos a 10 servidores al mismo tiempo</a>
    						| <a href="http://www.waveofmp3.com/" target="_blank">MP3 Music</a>
    						</ul>				
    				</div>
    				<div class="uni_siteinfo_copyright">
    					 Copyright © 2008-2009 MiMp3.net &amp; Johnatan G.. Todos los derechos reservados</div>
    			</div>
    			</div>
    			</div>
    		</div>
    </div></div>
    </div>
    {popbox}
    {musicload}
    	 			<script src="{THEME}/java/general.js"></script>
    	 			<script src="{THEME}/java/music_smartsearch.js"></script>
    	 			<script src="{THEME}/java/music_search.js"></script>
    	
                    <script language="javascript" type="text/javascript" src="{THEME}/java/jquery-1.2.3.pack.js"></script>
                    <script language="javascript" type="text/javascript" src="{THEME}/java/sleight.js"></script>
                    <script language="javascript" type="text/javascript" src="{THEME}/java/common.js"></script>
                    <script language="javascript" type="text/javascript" src="{THEME}/java/caobox.js"></script>
                    <script language="JavaScript" type="text/javascript" src="{THEME}/java/js_active_menu.js"></script>
                    <script language="javascript" type="text/javascript" src="{THEME}/java/tab.js"></script>
    
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-5762938-2");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    </div></div>
    
    PHP:

    continue in the next post....
     
    web@master24, Aug 17, 2009 IP
  8. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #8
    and this is the code of init.php:

    <?php
    if(!defined('DATALIFEENGINE'))
    {
      die("Hacking attempt!");
    }
    
    @include (ENGINE_DIR.'/data/config.php');
    
    if ($config['http_home_url'] == "") {
    
    	$config['http_home_url'] = explode("index.php", $_SERVER['PHP_SELF']);
    	$config['http_home_url'] = reset($config['http_home_url']);
    	$config['http_home_url'] = "http://".$_SERVER['HTTP_HOST'].$config['http_home_url'];
    
    }
    
    if (!$config['version_id']) die("Datalife Engine not installed. Please run install.php");
    
    require_once ENGINE_DIR.'/classes/mysql.php';
    require_once ENGINE_DIR.'/data/dbconfig.php';
    require_once ENGINE_DIR.'/modules/functions.php';
    require_once ENGINE_DIR.'/modules/gzip.php';
    
    $Timer = new microTimer;
    $Timer->start();
    
    check_xss ();
    
    	$cron = false;
    	$_TIME = time()+($config['date_adjust']*60);
    
    	$cron_time = get_vars ("cron");
    
    	if (date("Y-m-d", $cron_time) != date("Y-m-d", $_TIME)) $cron = 2;
    	elseif ($config['cache_count'] AND (($cron_time + (3600*2)) < $_TIME)) $cron = 1;
    
    	if ($cron) 	include_once ENGINE_DIR.'/modules/cron.php';
    
    if (isset($_REQUEST['year']))      $year      = intval($_GET['year']); else $year = '';
    if (isset($_REQUEST['month']))     $month     = @$db->safesql(strip_tags (str_replace('/', '', $_GET['month']))); else $month = '';
    if (isset($_REQUEST['day']))       $day       = @$db->safesql(strip_tags (str_replace('/', '', $_GET['day']))); else $day = '';
    if (isset($_REQUEST['user']))      $user      = @$db->safesql(strip_tags (str_replace('/', '', urldecode($_GET['user'])))); else $user = '';
    if (isset($_REQUEST['news_name'])) $news_name = @$db->safesql(strip_tags (str_replace('/', '', $_GET['news_name']))); else $news_name = '';
    if (isset($_REQUEST['newsid']))    $newsid    = intval($_GET['newsid']); else $newsid = 0;
    if (isset($_REQUEST['cstart']))    $cstart    = intval($_GET['cstart']); else $cstart = 0;
    if (isset($_REQUEST['news_page'])) $news_page = intval($_GET['news_page']); else $news_page = 0;
    if (isset($_REQUEST['catalog']))   $catalog   = @$db->safesql(substr(strip_tags (str_replace('/', '', urldecode($_GET['catalog']))),0,3)); else $catalog = '';
    if (isset($_REQUEST['category'])) {
    	if (substr($_GET['category'], -1, 1) == '/') $_GET['category'] = substr($_GET['category'], 0, -1);
    	$category  = explode('/',$_GET['category']);
    	$category  = end($category);
    	$category  = $db->safesql(strip_tags($category));
    } else $category = '';
    
    $PHP_SELF = $config['http_home_url']."index.php";
    $pm_alert = "";
    $ajax = "";
    
    $metatags = array (
    'title' 		=>	$config['home_title'],
    'description'	=>	$config['description'],
    'keywords'		=>	$config['keywords'],
    );
    
    //################# Îïðåäåëåíèå ãðóïï ïîëüçîâà òåëåé
    $user_group = get_vars ("usergroup");
    
    if (!$user_group) {
      $user_group = array ();
    
        $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
    
      while($row = $db->get_row()){
    
       $user_group[$row['id']] = array ();
    
         foreach ($row as $key => $value)
         {
           $user_group[$row['id']][$key] = $value;
         }
    
      }
      set_vars ("usergroup", $user_group);
      $db->free();
    }
    //####################################################################################################################
    //                    Îïðåäåëåíèå êà òåãîðèé è èõ ïà ðà ìåòðû
    //####################################################################################################################
    $cat_info = get_vars ("category");
    
    if (!is_array($cat_info)) {
    $cat_info = array ();
    
    $db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC");
    while($row = $db->get_row()){
    
       $cat_info[$row['id']] = array ();
    
         foreach ($row as $key => $value)
         {
           $cat_info[$row['id']][$key] = stripslashes($value);
         }
    
    }
    set_vars ("category", $cat_info);
    $db->free();
    }
    
    //####################################################################################################################
    //                    Îïðåäåëåíèå çà áà íåííûõ ïîëüçîâà òåëåé è IP
    //####################################################################################################################
    $banned_info = get_vars ("banned");
    
    if (!is_array($banned_info)) {
    $banned_info = array ();
    
    $db->query("SELECT * FROM " . USERPREFIX . "_banned");
    while($row = $db->get_row()){
    
    	if ($row['users_id']) {
    
           $banned_info['users_id'][$row['users_id']] = array('users_id' => $row['users_id'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
    
        } else {
     
           $banned_info['ip'][$row['ip']] = array('ip' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
       }
    
    }
    set_vars ("banned", $banned_info);
    $db->free();
    }
    
    $category_skin = "";
    
    if ($category != '') $category_id = get_ID ($cat_info, $category); else $category_id = false;
    
    if ($category_id) $category_skin = $cat_info[$category_id]['skin'];
    
    
    // #################################
    if ($news_name != '' OR $newsid) {
    
     $allow_sql_skin = false;
    
     foreach ($cat_info as $cats) {
       if ($cats['skin'] != '') $allow_sql_skin = true;
     }
    
       if ( $allow_sql_skin ) {
    
          if (!$newsid)
             $sql_skin = $db->super_query("SELECT category FROM " . PREFIX . "_post where month(date) = '$month' AND year(date) = '$year' AND dayofmonth(date) = '$day' AND alt_name ='$news_name'");
          else
             $sql_skin = $db->super_query("SELECT category FROM " . PREFIX . "_post where  id = '$newsid' AND approve = '1'");
    
          $base_skin = explode (',' , $sql_skin['category']);
    
          $category_skin = $cat_info[$base_skin[0]]['skin'];
    
          unset ($sql_skin);
          unset ($base_skin);
    
        }
    
    }
    
    if ($_GET['do'] == "static") {
    
    	$name 	= $db->safesql($_GET['page']);
    	$static_result = $db->super_query("SELECT * FROM " . PREFIX . "_static WHERE name='$name'");
    	$category_skin = $static_result['template_folder'];
    
    }
    
    
     if ($category_skin != "")
     {
    	if (@is_dir(ROOT_DIR.'/templates/'.$category_skin))
    		{
    			$config['skin'] = $category_skin;
    		}
    
     } elseif (isset($_REQUEST['action_skin_change'])) {
    
    	$_REQUEST['skin_name'] = explode (DIRECTORY_SEPARATOR, $_REQUEST['skin_name']);
    	$_REQUEST['skin_name'] = end ($_REQUEST['skin_name']);
    
    	if (@is_dir(ROOT_DIR.'/templates/'.$_REQUEST['skin_name']) AND $_REQUEST['skin_name'] != '')
    		{
    			$config['skin'] = $_REQUEST['skin_name'];
    			set_cookie ("dle_skin", $_REQUEST['skin_name'], 365);
    		}
    
     } elseif (isset($_COOKIE['dle_skin']) AND $_COOKIE['dle_skin'] != '') {
    
    	if (@is_dir(ROOT_DIR.'/templates/'.$_COOKIE['dle_skin']))
    		{
    			$config['skin'] = $_COOKIE['dle_skin'];
    		}
     }
    
    if (isset($config["lang_".$config['skin']]) AND $config["lang_".$config['skin']] != '') { 
    
         include_once ROOT_DIR.'/language/'.$config["lang_".$config['skin']].'/website.lng';
    
    } else {
    
         include_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
    
    }
    
    $config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
    
    require_once ENGINE_DIR.'/classes/templates.class.php';
    
    $tpl = new dle_template;
    $tpl->dir = ROOT_DIR.'/templates/'.$config['skin'];
    define('TEMPLATE_DIR', $tpl->dir);
    
    
    $login_panel = "";
    
    if ($config['allow_registration'] == "yes") {
    
    include_once ENGINE_DIR.'/modules/sitelogin.php';
    
    $blockip = check_ip ($banned_info['ip']);
    
    if (($is_logged AND $member_id['banned'] == "yes") OR $blockip) include_once ENGINE_DIR.'/modules/banned.php';
    
      if ($config['allow_alt_url'] == "yes") {
    
       if ($is_logged) {
        $link_profile = ($config['ajax']) ? $config['http_home_url']."user/".urlencode($member_id['name'])."/\" onclick=\"DlePage('subaction=userinfo&user=".urlencode($member_id['name'])."'); return false;" : $config['http_home_url']."user/".urlencode($member_id['name'])."/";
        $link_stats = ($config['ajax']) ? $config['http_home_url']."statistics.html\" onclick=\"DlePage('do=stats'); return false;" : $config['http_home_url']."statistics.html";
        $link_addnews = $config['http_home_url']."addnews.html";
        $link_newposts = ($config['ajax']) ? $config['http_home_url']."newposts/\" onclick=\"DlePage('subaction=newposts'); return false;" : $config['http_home_url']."newposts/";
        $link_favorites = ($config['ajax']) ? $config['http_home_url']."favorites/\" onclick=\"DlePage('do=favorites'); return false;" : $config['http_home_url']."favorites/";
        $link_logout = $PHP_SELF."?action=logout";
        $link_pm = ($config['ajax']) ? $PHP_SELF."?do=pm\" onclick=\"DlePage('do=pm'); return false;" : $PHP_SELF."?do=pm";
        $adminlink = $config['http_home_url'].$config['admin_path']."?mod=main";
       }
        $link_regist = ($config['ajax']) ? $PHP_SELF."?do=register\" onclick=\"DlePage('do=register'); return false;" : $PHP_SELF."?do=register";
        $link_lost = ($config['ajax']) ? $PHP_SELF."?do=lostpassword\" onclick=\"DlePage('do=lostpassword'); return false;" : $PHP_SELF."?do=lostpassword";
    
     } else {
    
       if ($is_logged) {
        $link_profile = ($config['ajax']) ? $PHP_SELF."?subaction=userinfo&user=".urlencode($member_id['name'])."\" onclick=\"DlePage('subaction=userinfo&user=".urlencode($member_id['name'])."'); return false;" : $PHP_SELF."?subaction=userinfo&user=".urlencode($member_id['name']);
        $link_stats = ($config['ajax']) ? $PHP_SELF."?do=stats\" onclick=\"DlePage('do=stats'); return false;" : $PHP_SELF."?do=stats";
        $link_addnews = $PHP_SELF."?do=addnews";
        $link_favorites = ($config['ajax']) ? $PHP_SELF."?do=favorites\" onclick=\"DlePage('do=favorites'); return false;" : $PHP_SELF."?do=favorites";
        $link_newposts = ($config['ajax']) ? $PHP_SELF."?subaction=newposts\" onclick=\"DlePage('subaction=newposts'); return false;" : $PHP_SELF."?subaction=newposts";
        $link_logout = $PHP_SELF."?action=logout";
        $adminlink = $config['admin_path']."?mod=main";
        $link_pm = ($config['ajax']) ? $PHP_SELF."?do=pm\" onclick=\"DlePage('do=pm'); return false;" : $PHP_SELF."?do=pm";
       }
        $link_regist = ($config['ajax']) ? $PHP_SELF."?do=register\" onclick=\"DlePage('do=register'); return false;" : $PHP_SELF."?do=register";
        $link_lost = ($config['ajax']) ? $PHP_SELF."?do=lostpassword\" onclick=\"DlePage('do=lostpassword'); return false;" : $PHP_SELF."?do=lostpassword";
     }
    
    
    include_once $tpl->dir.'/login.tpl';
    
    	if ($is_logged) {
    
        	 set_cookie ("dle_newpm", $member_id['pm_unread'], 365);
    
                if ($member_id['pm_unread'] > intval($_COOKIE['dle_newpm'])) {
    
                    include_once ENGINE_DIR.'/modules/pm_alert.php';
    
                }
    
    	}
    
    	if ($is_logged AND $user_group[$member_id['user_group']]['time_limit']) {
    
    	   if ($member_id['time_limit'] != "" AND (intval($member_id['time_limit']) < $_TIME)) {
    
    		$db->query("UPDATE " . USERPREFIX . "_users set user_group='{$user_group[$member_id['user_group']]['rid']}', time_limit='' WHERE user_id='$member_id[user_id]'");
    		$member_id['user_group'] = $user_group[$member_id['user_group']]['rid'];
    
    	   }  
    	}
    
    }
    
    if (!$is_logged) $member_id['user_group'] = 5;
    
    if ($config['site_offline'] == "yes")
    	include_once ENGINE_DIR.'/modules/offline.php';
    
    require_once ENGINE_DIR.'/modules/calendar.php';
    
    if ($config['allow_topnews'] == "yes")
    	include_once ENGINE_DIR.'/modules/topnews.php';
    
    require_once ROOT_DIR.'/engine/engine.php';
    
    if ($config['allow_votes'] == "yes")
    	include_once ENGINE_DIR.'/modules/vote.php';
    
    if(!defined('BANNERS'))
    {
    	if ($config['allow_banner'])
    		include_once ENGINE_DIR.'/modules/banners.php';
    }
    
    if ($config['rss_informer'])
    	include_once ENGINE_DIR.'/modules/rssinform.php';
    
    	require_once ENGINE_DIR.'/modules/mp3/popbox.php';
    //for home page and search music
    	require_once ENGINE_DIR.'/modules/category_block.php';
    	require_once ENGINE_DIR.'/modules/mp3/topmusic.php';
    	require_once ENGINE_DIR.'/modules/mp3/topvideo.php';
    	require_once ENGINE_DIR.'/modules/mp3/topuser.php';
    	require_once ENGINE_DIR.'/modules/mp3/artist.php';
    	require_once ENGINE_DIR.'/modules/mp3/searchtag.php';
    	require_once ENGINE_DIR.'/modules/mp3/usertop.php';
    	require_once ENGINE_DIR.'/modules/mp3/playlisttag.php';
    	require_once ENGINE_DIR.'/modules/mp3/topplaylist.php';
    //for Playlist page
    	require_once ENGINE_DIR.'/modules/mp3/uservideo.php';
    	require_once ENGINE_DIR.'/modules/mp3/otherplaylist.php';
    	require_once ENGINE_DIR.'/modules/mp3/usermusicinfo.php';
    //Online
    	require_once ENGINE_DIR.'/modules/online.php';
    
    ?>
    PHP:
    and im add the code but dosnt redirect correct, my website is http://tinyurl.com/6empkf (spanish version) and http://tinyurl.com/pp6ucy (english version) (now im delete the code) but how i can put for works good, thanks man i hope you can help me
     
    web@master24, Aug 17, 2009 IP