GeRik Posted December 3, 2009 Report Share Posted December 3, 2009 Kads nevaretu pateikt kur ir vaina ? <? $languages = array('en' => 'English', 'ru' => 'Russian', 'lv' => 'Latvian'); if (isset($_GET['valoda'])) { $lang = $_GET['valoda']; setcookie('valoda', $lang, time()+(3600*24*365)); }else if (isset($_COOKIE['valoda'])) { $lang = $_COOKIE['valoda']; } else { $lang = 'lv'; } if (!(in_array($lang, array_keys($languages)))) { die("ERROR: Trukst Valodas fails!"); } include("valoda/$lang.php"); include("config/config.php"); ?> Quote Link to comment Share on other sites More sharing options...
Val Posted December 3, 2009 Report Share Posted December 3, 2009 kāda ir vaina? Quote Link to comment Share on other sites More sharing options...
GeRik Posted December 3, 2009 Author Report Share Posted December 3, 2009 Vinsh kad nomaina Valodas tad ja uzspiez uz kada linka valoda atpakalj uzliekas uz default Quote Link to comment Share on other sites More sharing options...
waplet Posted December 3, 2009 Report Share Posted December 3, 2009 Valodas Met Atpakalj uz Default Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted December 3, 2009 Report Share Posted December 3, 2009 Minējums - nenostrādā setcookie()... Ja ieslēgtu kļūdu paziņoumus, tad iespējams redzētu "headers already sent" kļūdu. Quote Link to comment Share on other sites More sharing options...
GeRik Posted December 3, 2009 Author Report Share Posted December 3, 2009 (edited) ja uzrada Headers already sent tad ko man iisti dariit O_o uzrada uz liiniju tur kur ir setcookie Edited December 3, 2009 by GeRik Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 3, 2009 Report Share Posted December 3, 2009 Tev šis kods ir jāliek pirms jebkāda output'a - cik var malt vienu un to pašu? http://php.lv/f/topic/7294-headers-already-sent/ <- šis topiks ir pašā priekšā!!! Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted December 3, 2009 Report Share Posted December 3, 2009 Lasīt to, kas tādēļ, ka daudziem un bieži gadās, ir piesprausts Iesācēju sadaļas galvgalī! http://php.lv/f/topic/7294-headers-already-sent/ Quote Link to comment Share on other sites More sharing options...
GeRik Posted December 3, 2009 Author Report Share Posted December 3, 2009 (edited) Nu es izlasiju un nedabuju risinajumu <? session_start(); $languages = array('en' => 'English', 'lv' => 'Latvian', 'ru' => 'Russian'); if (isset($_GET['lang'])) { $lang = $_GET['lang']; setcookie('lang', $lang, time()+(3600*24*365)); }else if (isset($_COOKIE['lang'])) { $lang = $_COOKIE['lang']; } else { $lang = 'lv'; } if (!(in_array($lang, array_keys($languages)))) { die("ERROR: Bad Language String Provided!"); } include "language/{$lang}.php"; include("config/config.php"); ?> Un man shis Skripts atrodas Pasha pasha augsha pectam seko tikai <!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> u.t.t ! Pievienoju to session start un iznakums shads Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\AppServ\www\index.php:1) in C:\AppServ\www\index.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\index.php:1) in C:\AppServ\www\index.php on line 2 Problema bij ar tiem BOM kodiem Paldies visiem :) Edited December 3, 2009 by GeRik Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.