daGrevis Posted March 27, 2010 Report Share Posted March 27, 2010 Labvakar! Ir iespējams kā šo funkciju pierakstīt īsāk?? Vai arī loģiskāk... function siggned_in() { $i = isSet($_SESSION['user__signed_in']) and $_SESSION['user__signed_in']; return $i; } Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 27, 2010 Author Report Share Posted March 27, 2010 Āāā :D function siggned_in() { return isSet($_SESSION['user__signed_in']) and $_SESSION['user__signed_in']; } Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 27, 2010 Report Share Posted March 27, 2010 siggned in nav pareizi - pareizi ir signed in. Tāpat arī, ja nav ielogojies, tad izdzēs sesijas mainīgo, pretējā gadījumā, lai stāv un tad var rakstīt: function signed_in() { return isset($_SESSION['user__signed_in']); } Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 27, 2010 Author Report Share Posted March 27, 2010 Fixed. rATRIJS, tā valodas kļūda vairāk bija neuzmanības kļūda. Vai pareizāk -> man bija pieradums rakstīt nepareizi... :) Tev jau labi, Tu dzīvo Anglijā! :D Quote Link to comment Share on other sites More sharing options...
Mr.Key Posted March 27, 2010 Report Share Posted March 27, 2010 saprotu, ka tas ir kāds pārbaudes uzdevums. konkrētā rindiņa ir analoģiska function signed_in() { return !empty($_SESSION['user__signed_in']); } Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 27, 2010 Author Report Share Posted March 27, 2010 saprotu, ka tas ir kāds pārbaudes uzdevums. konkrētā rindiņa ir analoģiska function signed_in() { return !empty($_SESSION['user__signed_in']); } Kad īsti ir jāizmanto 'isSet', kad 'empty', kad tas ar '!' priekšā?? Man vienā pārbaudes skriptā ir... Kā ir? :D if(isSet($username) && !empty($username) and isSet($password) && !empty($password)) {} Quote Link to comment Share on other sites More sharing options...
waplet Posted March 27, 2010 Report Share Posted March 27, 2010 ! nozīmē NOT .. jeb NAV TUKŠŠ Quote Link to comment Share on other sites More sharing options...
marcis Posted March 27, 2010 Report Share Posted March 27, 2010 php.net/isset php.net/empty - šis, starpcitu, ietver arī isset() funcionalitāti Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 27, 2010 Author Report Share Posted March 27, 2010 Skaidrs, jāmācās lasīt manuālis. :D Tātad, varu izmantot tikai '!empty()'... :) Quote Link to comment Share on other sites More sharing options...
2easy Posted March 27, 2010 Report Share Posted March 27, 2010 Skaidrs, jāmācās lasīt manuālis. :D oo kāda atklāsme!!! :P 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.