anonīms Posted November 9, 2011 Report Share Posted November 9, 2011 (edited) <pre class="prettyprint">if (in_array($user_ip, $blocklist) AND $user_ip != 'tava_ip')</pre> EDIT: nokavēju ;((( Edited November 9, 2011 by anonīms Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 9, 2011 Report Share Posted November 9, 2011 Kāpēc kačājam Google PR? :D Nav vieglāk parādīt kādu paziņojumu, atbilstošāku. Kas vainas manam variantam? Smuki izvadam 'Fuck you!'. :) Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2011 Author Report Share Posted November 9, 2011 vienalga pārsūta mani uz google :? Quote Link to comment Share on other sites More sharing options...
nemakuphp Posted November 9, 2011 Report Share Posted November 9, 2011 Tu savu IP norādīji? Nenorādīji savu iekšējo IP? Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2011 Author Report Share Posted November 9, 2011 jā, norādīju Quote Link to comment Share on other sites More sharing options...
anonīms Posted November 9, 2011 Report Share Posted November 9, 2011 nu hūūūūū*j zin ;D izņem in_array un "paspēlējies" bez viņa Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2011 Author Report Share Posted November 9, 2011 es jums varbūt čakarēju smadzenes.. tas izskatās šādi if($data['blocklist']=="yes"){ $blocklist = explode("\n", file_get_contents('misc/blocklist.txt')); if ($user_ip != "62.63.xxx.xx" && in_array($user_ip, $blocklist)) { header("location:http://www.google.com"); } }else{ echo "saturs"; } Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 9, 2011 Report Share Posted November 9, 2011 1) Ceru, ka tie x'iņi tur nav, 2) Kur tiek definēts $user_ip?, 3) Gadījumā nevajag norādīt arī 127.0.0.1 un localhost? Pag... tur kkas nav loģiski. Padomā kad izmantot && un kad izmantot ||. :) Labojums: Un tur nevajag else. Vai arī tu liksi visu, visu pārejo kodu iekš else bloka? :) Vienkārši if un, ja nosacījums izpildās (IP ir black-listā), pārtraucam lapas darbību. Quote Link to comment Share on other sites More sharing options...
briedis Posted November 9, 2011 Report Share Posted November 9, 2011 Pēc header("Location:...") vajag exit() Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted November 9, 2011 Report Share Posted November 9, 2011 Neaizmirsti par tādu lietu kā Proxy..ka atradīsies vesela čupa gudrīšu kas maskēsies aiz Proxy... Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted November 9, 2011 Report Share Posted November 9, 2011 Pēc header("Location:...") vajag exit() Briedi Tu gadījumā neizdemolēji restorānu? :D http://zinas.nra.lv/video/1310-briedis-izdemole-restoranu.htm Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 11, 2011 Author Report Share Posted November 11, 2011 nu tā.. šitā strādā: $user_ip = getenv("REMOTE_ADDR"); $blocklist = explode("\n", file_get_contents('misc/blocklist.txt')); if ($user_ip != "62.63.xxx.xx" || in_array($user_ip, $blocklist)) { header("location:http://www.google.com"); exit(); } bet kā lai es izmantoju slēdzi if($data['blocklist']=="yes"){ }else{ echo "saturs"; } Quote Link to comment Share on other sites More sharing options...
anonīms Posted November 11, 2011 Report Share Posted November 11, 2011 Nu Tev tak vienreiz jau pateica. Ja tajā ifā ir redirekts, kad kāda velna pēc vajag pēc tam to else? if($data['blocklist']=="yes"){ //header } print 'saturs'; 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.