Zoom Posted July 16, 2005 Report Share Posted July 16, 2005 (edited) Man ir doma uzrakstit sadu skriptu. Piemeram lietotaja IP ierakstas DB un saglaba tabula "lietotaju_saraksts". Tad, kad ieeju adminlapa un gribu kadu izbanot es ierakstu izveleto IP tabula "IP_ban". Ieejoso lietotaju IP salidzina ar tabulas "IP_ban" IP ierakstitam . Ja kada IP sakrit, tad vnk else ... echo "esi banots", ja nesakrit , tad ar refresh parmet uz lapu. Varetu ta darit ? Vai si lieta kautka citadak darbojas ? P.S meiginasu savu versiju uzrakstit Edited July 16, 2005 by Zoom Link to comment Share on other sites More sharing options...
Kavacky Posted July 16, 2005 Report Share Posted July 16, 2005 Labāk, ja nesakrīt, tad atver lapu, ja sakrīt, tad izvada error uzreiz. Link to comment Share on other sites More sharing options...
Zoom Posted July 16, 2005 Author Report Share Posted July 16, 2005 (edited) bet ja lietotajs iet piemeram nevis caur www.lapa.lv, bet gan caur www.lapa.lv?as=2&kw=los&id=164 Un ja viens iet cauri tadam linkam ?? Tad ka lai to izdara ? nu ka: if (usr_ip == db_ip){ echo "Tu esi banots"; }else{ echo "redirekte uz lapu"; } Sitas jau vieglakais variants nea :ph34r: Edited July 16, 2005 by Zoom Link to comment Share on other sites More sharing options...
Kavacky Posted July 16, 2005 Report Share Posted July 16, 2005 Nu diez vai būtu forši, ja katram būtu pirms refresha iespēja ieraudzīt, ka esi banots. Vienkārši lapas sākumā pārbaude un viss, tāpat kā lietotāja autorizācija. Link to comment Share on other sites More sharing options...
PheliX Posted July 16, 2005 Report Share Posted July 16, 2005 kaada jeega redirekteet ja tajaa redirekteetajaa lapaa nebuus paarbaude? ierakstam linku ar rokaam un juuzaajam ar visiem baniem... paarbaudei jaabuut pirms kautko izvadi KATRAA lapaa Link to comment Share on other sites More sharing options...
bra Posted July 17, 2005 Report Share Posted July 17, 2005 (edited) būtībā elementāri pielabojam augstāk esošo kodu un aidā <?php function banThisUser(db_ip){ if ($_SERVER['REMOTE_ADDR'] == db_ip){ die( "Tu esi banots"); }else{ include("contenta_page.php"); #vai require_once("page.php"); } } ?> ieliekam šo index.php failā pašā augšā vai kādā f-ciju failā un aidā Edited July 17, 2005 by bra Link to comment Share on other sites More sharing options...
Zoom Posted July 17, 2005 Author Report Share Posted July 17, 2005 (edited) es gribu DB ierakstit lietotaja IP. Taja bridi, kad vins ieiet lapa. <?php include("db.php"); $_SERVER['REMOTE_ADDR'] = $usr_ip; $q = "INSERT INTO ban (usr_ip) VALUES('$usr_ip');"; @mysql_query($q,$dbc) or die('Kluuda'.mysql_error()); echo "Tu iegaji ban lapa"; ?> bet kad iegaju DB tabula bija tik ID 1 ierakstijies un viss. Bet ip es neredzeju :( Rekur būs bilde Edited July 17, 2005 by Zoom Link to comment Share on other sites More sharing options...
v3rb0 Posted July 17, 2005 Report Share Posted July 17, 2005 tā iet ka scriptojas ar izslēgtām noticēm! apmaini tak $_SERVER['REMOTE_ADDR'] = $usr_ip; vietām. Link to comment Share on other sites More sharing options...
Zoom Posted July 17, 2005 Author Report Share Posted July 17, 2005 (edited) thx :rolleyes: Man vel viens jautajums. Kapec man rada gan uzrakstu "tu esi banots" un parejo main.php saturu ? Nevar kautka uztaist, lai vins neincludotu main.php, bet lai paliek uz index.php ? Edited July 17, 2005 by Zoom Link to comment Share on other sites More sharing options...
Kavacky Posted July 17, 2005 Report Share Posted July 17, 2005 Varbūt tāpēc, ka tev nav ifs, kas izdod "Tu esi banots" tikai tad, ja patiešām esi? Link to comment Share on other sites More sharing options...
Zoom Posted July 17, 2005 Author Report Share Posted July 17, 2005 es vadijos pec lietotaja bra koda.. Link to comment Share on other sites More sharing options...
Klez Posted July 17, 2005 Report Share Posted July 17, 2005 (edited) mysql_query("CREATE TABLE IF NOT EXISTS ip_adreses (ip VARCHAR (255) DEFAULT '0')"); mysql_query("INSERT INTO `ip_adrese` (`ip`) VALUES('".$_SERVER['REMOTE_ADDR']."') "); function get_ip(){ $all = mysql_query("SELECT COUNT(ip) FROM `banu_tabula` WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."' LIMIT 1"); $one = mysql_fetch_row($all); mysql_free_result($all); return $one[0]; } if (get_ip() > 0) die("Tew ir BANS"); //... te tad taalaak ko nu vien vaig ja neder tad sorry :( P.S ja tu rakstiisi lietotaaja IP tabulaa (tajaa pashaa) tad tew wisi pietotaaji banosies ... :) Testeejis neesmu, bet vaidzeetu straadaat .. Edited July 17, 2005 by Klez Link to comment Share on other sites More sharing options...
Zoom Posted July 18, 2005 Author Report Share Posted July 18, 2005 ko tu gribi, man vel jamacas :) gan ar laiku sataisu. Link to comment Share on other sites More sharing options...
Klez Posted July 18, 2005 Report Share Posted July 18, 2005 a mans variants tew neder ?? ieliec banu_tabula tabulaa savu IP un pameegini :) Link to comment Share on other sites More sharing options...
Recommended Posts