Devils666 Posted March 14, 2010 Report Share Posted March 14, 2010 (edited) problēma ar šo kodu: if(isset($_GET['lapa'])) { switch($_GET['lapa']) { case 'forums': echo "seit bus forums"; break; } } else { echo "čau"; } viss ir skaisti līdz bridim, kad lietotājs uzraksta nevis index.php vai index.php?lapa=forums, bet gan piem index.php?lapa=9jafowef kā varetu uztaisīt, lai parāditos, ka lapa nav atrasta vai kaut ko tadu? mēgināju else if($_GET['p'] != 'forums'){ echo "sūkā ledu"; } bet nez kapēc neiet Edited March 14, 2010 by Devils666 Quote Link to comment Share on other sites More sharing options...
chizijs Posted March 14, 2010 Report Share Posted March 14, 2010 .htaccess ErrorDocument 404 /?p=404 Un pieliec case '404': echo 'Lapa netika atrasta!'; break; Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 14, 2010 Report Share Posted March 14, 2010 (edited) else if($_GET['p'] != 'forums'){ echo "sūkā ledu"; } "Sūkā ledu!" :D :D Problēma: Man neiet šāds risinājums... HTACCESS: ErrorDocument 404 /error.php Lapa "error.php" ir izveidota. Piemēram, ieejot "127.0.0.1/d" neveras vaļā "error.php", bet gan standarta 404 lapa. Viss "griežās uz" XAMPP. Pārrestartēju XAMPP. :) Hmm... Edited March 14, 2010 by daGrevis Quote Link to comment Share on other sites More sharing options...
Devils666 Posted March 14, 2010 Author Report Share Posted March 14, 2010 :D tas tikai tā, kā piemēra pec un nu ErrorDocument 404 /?p=404 neder, jo tas ir tada gadijuma ja uzraksta piem indexxxx.php Quote Link to comment Share on other sites More sharing options...
briedis Posted March 14, 2010 Report Share Posted March 14, 2010 switch($smth){ case "kautkas" : echo "lalala"; break; default: echo "nasing spešal found"; } Quote Link to comment Share on other sites More sharing options...
Devils666 Posted March 14, 2010 Author Report Share Posted March 14, 2010 (edited) tas jau it ka derētu, bet man tas nasing spešas nāk klāt ari tad, kad lapa ir atrasta Edited March 14, 2010 by Devils666 Quote Link to comment Share on other sites More sharing options...
briedis Posted March 14, 2010 Report Share Posted March 14, 2010 tas jau it ka derētu, bet man tas nasing spešas nāk klāt ari tad, kad lapa ir atrasta Ja switcā kāds case atbilst un ir vajadzīgais break; case'a beigās, tad defaults neizpildās. R-T-F-M! 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.