andrisp Posted April 14, 2005 Author Report Share Posted April 14, 2005 bladies delfin par risinaajumu, bet es jau paspeeju uzrakstiit kodu, kas select rezultaatu, ja tur ir vairaakas ip, sadala pa daljaam un katru dalju atseviskji paarbauda ar $ip veelreiz, viss straadaa - bet tavu regexpu pierakstiishu ;). tagad man ir jauna probleema, $rinda - select rezultaats un $adrese - IP function checkIPagain($rinda, $adrese) { if (preg_match(",", $rinda[ip])) { $ip = ereg_replace (" ", "", $rinda[ip]); $ip = split(",", $ip); foreach($ip as $ip2) { if ($ip2 == $adrese) { return TRUE; } else { return FALSE; } } } else { if ($rinda[ip] == $adrese) { return TRUE; } else { return FALSE; } } } itkaa visu izdara, bet met aaraa - Warning: No ending delimiter ',' found in /home/db/public_html/inc/functions.php on line 104 if (preg_match(",", $rinda[ip])) <---- shii ir 104 liinija Link to comment Share on other sites More sharing options...
рпр Posted April 14, 2005 Report Share Posted April 14, 2005 nu logjiski, jo nepareia regulaaraa ekspresija. diivains tev programmeeshanas stils. vienaa vietaa izmanto preg_match otraa ereg_replace... Link to comment Share on other sites More sharing options...
Delfins Posted April 14, 2005 Report Share Posted April 14, 2005 bladies delfin wtf !? :) blj. NESAPROTU, kapec tu vel talak mocies... function checkIPagain($rinda, $adrese) { return preg_match( "/{$ip}( +|,|$)/", $rinda['ip'] ); } Link to comment Share on other sites More sharing options...
Delfins Posted April 14, 2005 Report Share Posted April 14, 2005 es tač tev iedevu SQL regexpu... kur to var smuki dabūt... $sql = ' select ... ip regexp "'.$adrese.'( +|,|$)" '; while( $rinda = ) { // ... do stuff } Link to comment Share on other sites More sharing options...
Delfins Posted April 14, 2005 Report Share Posted April 14, 2005 tev ir nepareiza REGEXP izteiksme "," => "/,/" a bet ereg() nostrādās gan iepriekšējais ... Link to comment Share on other sites More sharing options...
andrisp Posted April 14, 2005 Author Report Share Posted April 14, 2005 paldies visiem, kas paliidzeeja un meegjinaaja paliidzeet ;) . un protams viss beigaas izveershas ljoti vienkaarshi :) iztiku ar ip REGEXP '$adrese(,|$)' Link to comment Share on other sites More sharing options...
Recommended Posts