anonīms Posted March 24, 2009 Report Share Posted March 24, 2009 (edited) Gribu pamēģināt izveidot f-ju, kas ļautu man atvieglot dzīvi. Tātad ir gabals, kas pārbauda vai admins ir ielogojies if(isset($_SESSION['logged']) and $_SESSION['logged']+1800 > time()) { admins redz šo! } lai katru reizi nebūtu jāraksta garo kodu, tad vēlos to visu apvienot f-jā, kas izskatītos apmēram tā admins() { admins redz } Tā maz ir iespējams izveidot? un ja jā, tad varbūt mazu piemēru... Edited March 24, 2009 by anonīms Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 24, 2009 Author Report Share Posted March 24, 2009 (edited) tiku galā function admins() { if(isset($_SESSION['logged']) and $_SESSION['logged']+1800 > time()) { return true; } else { return false; } } $admins = admins(); un tad if($admins) { tu esi admins } else { neko neraadam } sorry par dp Edited March 24, 2009 by anonīms Quote Link to comment Share on other sites More sharing options...
marcis Posted March 25, 2009 Report Share Posted March 25, 2009 Ja jau tu funkciju izsauc tikai vienreiz, lai definētu mainīgo, tad kāda īsti ir jēga no funkcijas? $admins=(isset($_SESSION['logged']) && $_SESSION['logged']+1800 > time())?true:false; 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.