Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
MySql - bad words

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
clown



Joined: 19 Oct 2004
Posts: 181
Location: Brestovac DC

PostPosted: 06.10.2005 23:22    Post subject: MySql - bad words Add user to your forum ignore list Reply with quote

recimo da imam guestbook sa ovakvim query ulazom:

Code:

$query = "INSERT INTO guestbook ( nick , mjesto, mail, post ) VALUES ( '$nick' , '$mjesto' , '$mail', '$post' )";


zanima me kako da zabranim ulaze onima koji u bilo koje polje upisu: npr. b@b@
probao sam otprilike sa sljedecim:

Code:

... WHERE nick NOT LIKE '%$badword%' || mail NOT LIKE '%$badword%'  ...


gdje sam $badword definirao ali ne funkcionira nego se i dalje unose
molim tocan query, hvala puno
Back to top
View user's profile Send private message
les



Joined: 25 Oct 2004
Posts: 370

PostPosted: 07.10.2005 00:14    Post subject: Add user to your forum ignore list Reply with quote

Zašto sa MySQL-om određivat koja vrijednost se može unijeti a koja ne (iskreno to mi nije palo nikad na pamet) Smile
Po meni je puno bolje rješenje provjeru vrijednosti koje se unesu u neko polje forme napraviti sa PHP-om ili JavaScriptom i na osnovu toga onda dalje formirat kveri...
Back to top
View user's profile Send private message Send e-mail
clown



Joined: 19 Oct 2004
Posts: 181
Location: Brestovac DC

PostPosted: 07.10.2005 00:25    Post subject: Add user to your forum ignore list Reply with quote

hvala na odgovoru ali nisi mnogo pomogao...
kako bi recimo zabranio unos vrijednosti u bazu ako vrijednost unosa uvijek u sebi ima jedan dio isti, a drugi razlicit.
npr. da zelis zabraniti unose ciji mailovi zavrsavaju sa @microsoft.com ???
konkretno pitanje za konkretan odgovor, hvala puno
Back to top
View user's profile Send private message
les



Joined: 25 Oct 2004
Posts: 370

PostPosted: 07.10.2005 00:45    Post subject: Add user to your forum ignore list Reply with quote

Evo ovako na brzinu po sjećanju - ima i elegantnijih rješenja za ovo:

<?
$mail= 'bill@microsoft.com';
$provjera = strstr($mail, '@');
?>
$provjera je u ovom slučaju jednaka @microsoft.com.
Funkcija strstr daje dio stringa od prvog pojavljivanja zadanog znaka (u ovom slučaju @) do kraja stringa. Stvoriš neku varijablu, pridjeliš joj vrijednost '@microsoft.com' ($nešto='@microsoft.com') i uspoređuješ sa onim što dobiješ kao varijablu $provjera. Ako su iste, ne dozvoliš unos vrijednosti...
Back to top
View user's profile Send private message Send e-mail
clown



Joined: 19 Oct 2004
Posts: 181
Location: Brestovac DC

PostPosted: 07.10.2005 01:02    Post subject: Add user to your forum ignore list Reply with quote

brate, hvala ti k'o bratu, taj sam odgovor cekao...
Back to top
View user's profile Send private message
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 07.10.2005 09:33    Post subject: Add user to your forum ignore list Reply with quote

ja bi ti preporucio da malo provjeris regular expressione, jesu pain za naucit, ali daju ultimate power za baratanje sa tekstom.

http://php.linux.hr/manual/en/ref.pcre.php
www.regular-expressions.info

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group