djmartins Posted November 27, 2005 Report Share Posted November 27, 2005 Var taa lai konkreti noraaditaas ip adreses tik var redzet konkreto lapu un nepiedrosiem parmet uz kaut kadu citu siem nenojausot kas tur iistaniba zem taa linka slepjas apaksaa? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted November 27, 2005 Report Share Posted November 27, 2005 elementarna vatson :) if ($_SERVER['REMOTE_ADDR'] == 'atljautaa adrese') { raadam lapu } else { redirekteejam uz citu lapu } viss............ Link to comment Share on other sites More sharing options...
bubu Posted November 27, 2005 Report Share Posted November 27, 2005 (edited) Var ar apache mod_rewrite to panākt, var arī caur php skriptu: if (in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '159.148.123.111', ...))) { // te daram to, ja ip ir tai masīvā } else { // te daramies, ja ip nav tai masīvā } Edited November 27, 2005 by bubu Link to comment Share on other sites More sharing options...
john.brown Posted November 27, 2005 Report Share Posted November 27, 2005 Jā. No $_SERVER['REMOTE_ADDR'] nolasi to usera ip, un pēc tam salīdzini ar savu db. Ja atļauts, rādi lapu, ja nē, dod header("Location:url_uz_kurieni_sūtīt"). Link to comment Share on other sites More sharing options...
djmartins Posted November 27, 2005 Author Report Share Posted November 27, 2005 tnx :) Link to comment Share on other sites More sharing options...
rpr Posted November 27, 2005 Report Share Posted November 27, 2005 tad jau labaak: header("HTTP/1.0 403 Forbidden"); exit; Link to comment Share on other sites More sharing options...
djmartins Posted November 27, 2005 Author Report Share Posted November 27, 2005 <? if ($_SERVER['REMOTE_ADDR'] == '192.255.36.88') { index.php; } else { sorry.php; } ?> veci !rakstot saadi jebkuraa gadiijuma mainot vai nemainot to ip neaiziet uz sorry.php var teikt ka nestraada sis kods!Kadel? Link to comment Share on other sites More sharing options...
Klez Posted November 27, 2005 Report Share Posted November 27, 2005 (edited) tapeec ka kods liiks! vai ariii rokas,smadzenes un kods Edited November 27, 2005 by Klez Link to comment Share on other sites More sharing options...
blackhalt Posted November 27, 2005 Report Share Posted November 27, 2005 <?php if ($_SERVER['REMOTE_ADDR'] == '192.255.36.88'){ die('nomiru'); } // ?> Link to comment Share on other sites More sharing options...
Klez Posted November 27, 2005 Report Share Posted November 27, 2005 <? if ($_SERVER['REMOTE_ADDR'] == '192.255.36.88') { include('index.php'); } else { include('sorry.php'); } ?> Link to comment Share on other sites More sharing options...
php_Stopp Posted November 27, 2005 Report Share Posted November 27, 2005 (edited) vai nu tā kā Klez teica, vai arī, ja tu gribi lai aiziet uz to sorry.php vai index.php, tad header("Location: index.php"); vai attiecīgi header("Location: sorry.php"); bet abos variantos jautu nebūsi bloķējis pieeju failam index.php vai sorry.php neatļautām ip adresēm.. Edited November 27, 2005 by php_Stopp Link to comment Share on other sites More sharing options...
Grey_Wolf Posted November 27, 2005 Report Share Posted November 27, 2005 tas kods jaaliek ieksh index.php un pielikt sessiju kur ja ir atljauja ieraksta kaadu identifikaatoru kuru attieciigi katraa failla paarbauda ja ir tad turpina ja naff tad redirektee uz index.php.... Link to comment Share on other sites More sharing options...
Recommended Posts