tiy Posted December 12, 2005 Report Share Posted December 12, 2005 Lasu te par session_ funkcijam un nevaru iebraukt, vinam obligati jabut pirms visas izvadishanas. Un kas ir SID. Link to comment Share on other sites More sharing options...
v3rb0 Posted December 12, 2005 Report Share Posted December 12, 2005 * session_start(), ko tev noteikti vajadzes, ir jabut pirmajam. * SID- sessijas id Link to comment Share on other sites More sharing options...
tiy Posted December 12, 2005 Author Report Share Posted December 12, 2005 kads id ir pieskirts shinivarianta un ka pareizi ir pieskirt id, vai session dati bus ka globa lie vai vinus vajaga parsutit no vienas lapas uz otru. Gribetos zinat vai var ka globalos izveidot un ka? <?php // page1.php session_start(); echo 'Welcome to page #1'; $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; $_SESSION['time'] = time(); // Works if session cookie was accepted echo '<br /><a href="page2.php">page 2</a>'; // Or maybe pass along the session id, if needed echo '<br /><a href="page2.php?' . SID . '">page 2</a>'; ?> Link to comment Share on other sites More sharing options...
Paulinjsh Posted December 12, 2005 Report Share Posted December 12, 2005 Sesijas dati ir globaalie un tiek paarsuutiiti starp saitu! Link to comment Share on other sites More sharing options...
[Ya] Posted December 12, 2005 Report Share Posted December 12, 2005 jebkurā lapā var dabūt tos $_SESSION tikai lapas sākumā jābūt session_start(); attieciigi ja failaa index.php nodefinējas, tad pārējos failso dabūsim to pašu ārā .... kamēr protams browseri nēesam aiztaisījuši Link to comment Share on other sites More sharing options...
tiy Posted December 12, 2005 Author Report Share Posted December 12, 2005 (edited) Ja es uz vienas lapas uzrakstu <?php session_start(); $_SESSION['favcolor'] = 'green'; ?> , bet uzcitas es jau varu rakstit <?php $color=$_SESSION['favcolor']; //un $color=green; // vai es te talak varu turpinat pashu saitu ehco" <html><head>..... "; ?> Edited December 12, 2005 by tiy Link to comment Share on other sites More sharing options...
[Ya] Posted December 12, 2005 Report Share Posted December 12, 2005 tev tak apskaidroja, visās lapās jāliek priekšā session_start(); Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 12, 2005 Report Share Posted December 12, 2005 tiy--> pats php kods var atrasties jebkuraa lapas vietaa iznjemot seesion_start() un ja ir nepiechieshams redirekteet uz citu lapu - tad tas Pirms jebkaadas izvades <?php session_start() ?> HTML tekstc <?php echo $katkaads_mainiigasi; ?> turpinam html <?php atkal koda gabals ?> P.S. dazreiz vajag parbaudiit vai vispaar sesiju starteet: <?php if (bla bla) { sesiion_start(); } else { sesiju nelaizam } ?> Link to comment Share on other sites More sharing options...
php_Stopp Posted December 12, 2005 Report Share Posted December 12, 2005 un visus $_SESSION tu vari pārbaudīt/nodēvēt par kādu mainīgo arī pēc jebkādiem outputiem.. vienīgais jābūt pirmajam session_start(); Link to comment Share on other sites More sharing options...
tiy Posted December 13, 2005 Author Report Share Posted December 13, 2005 <html> .... .. <?php echo ... if (.....) { session_start(); .... } ?> </body> </html> Es nezinu ko, bet es funkcija izsaucu session_start ,tad pieskiru datus un viss it ka strada. Vai var rasties kadas problemas. Link to comment Share on other sites More sharing options...
Roze Posted December 13, 2005 Report Share Posted December 13, 2005 Eh nu cik reizes lai saka - vaig: <? session_start(); ?> <html> .... <? // kaut kaads cits php if() { .. } ?> </html> Link to comment Share on other sites More sharing options...
Recommended Posts