Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: no same nicks? (in comments)  (Read 10673 times)

0 Members and 1 Guest are viewing this topic.

dakky

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
no same nicks? (in comments)
« on: February 02, 2005, 11:56:38 pm »

I mean how to make that no one can post a coment if the access right to post comment is set to public level even to ones who aren't registered. I would like to make that noone can enter their name if the name they entered is same with one of the registered users. I.E. I am admin and my nick is "dakky". Now someone comes and post comment on any picture and type name dakky .. so the only difference between me and that user is a color (in fact a link, blue is a link, black is a non-auth. user without link)

Hope u understand, I dont like every day loggin in and changing nicknames of those ppl who use my name to post "rude" comments (i.e. I'm saying something to some girl or ... you know)
« Last Edit: February 16, 2005, 08:13:43 am by GauGau »
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: no same nicks? (in comments)
« Reply #1 on: February 03, 2005, 08:42:32 am »

So basicly what you are looking for is a way to make the posting of comments on pictures a publicly avaible thing but with the restriction that the comments do not get posted if a registered username is used by a anonymous user.

Sounds like a good idea. Would be nice to add a little popup screen when that happens asking you if you would like to login first.

Not sure if this could become a feature or would be better of becoming a mod.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: no same nicks? (in comments)
« Reply #2 on: February 03, 2005, 04:25:32 pm »

is a valid feature request imo, so I'm moving it from "coppermine.sourceforge.net  |  Support  |  CPG 1.3 Standalone Support  |  Permissions & Access Rights" to the "feature requests" board (although I think this has been requested before).
Anyway, allowing anonymous comments is not recommended...

Joachim
Logged

dakky

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: no same nicks? (in comments)
« Reply #3 on: February 03, 2005, 09:45:59 pm »

either anonymous comments or no comments at all. no one would bother to register if he/she came just to see few pictures. and he/she will probably never come again.. so.. (in 30 days, 3200 pictures viewed) ... and only ~20 comments...
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: no same nicks? (in comments)
« Reply #4 on: February 04, 2005, 07:59:22 am »

Same here, only a few make the effort of registering so they are able to post comments. A welcome feature indeed if this is implemented.
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: no same nicks? (in comments)
« Reply #5 on: February 04, 2005, 12:33:55 pm »

Wouldn't an "approve comments" feature be more appropriate?  If users are posing rude comments, the can pick any nickname.  If you can approve comments before they go live, you can prevent any rude comments from being seen.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: no same nicks? (in comments)
« Reply #6 on: February 04, 2005, 01:02:43 pm »

Or you combine the two options. Making commenting not possible using a already registered nickname and when using a random nickname the comment has to be approved first.
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: no same nicks? (in comments)
« Reply #7 on: February 04, 2005, 10:25:23 pm »

for the easy part ( no "Anonymous" comment using a registered nickname ), that should do the trick ( case insensitive check )

in db_input.php:

find
Code: [Select]
        if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie

and add right after:
Code: [Select]
if (mysql_result(mysql_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
    cpg_die(ERROR, 'A registered user is using this nickname, login or use another one' ,__FILE__,__LINE__);

-matt-

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: no same nicks? (in comments)
« Reply #8 on: February 07, 2005, 10:44:33 am »

Thanks Matt. Works perfectly  ;D
Logged

Vadim

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: no same nicks? (in comments)
« Reply #9 on: February 12, 2005, 09:44:08 pm »

I applied similar mod for an update action.
Because user can first name himself with a not used name, and then change it to some registred users name ;)
Logged

George_CC

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 135
    • Web-Engines: installation, design, modifications of CMS
Re: no same nicks? (in comments)
« Reply #10 on: February 12, 2005, 10:30:53 pm »

Hmmm... And if there are 1000 registered users in a gallery. Guest writing comment. Under the nick, for example, George. Error. Ok, go back, change nick to.. fore example.. George_Too.. Error. And going away.
Another way to solve this problem: many boards using prefixes to guest usernames: unregistered user typing "George", and his comment displaying under the name "Guest_george". It is simple to realisation:

adding record in config table:
INSERT INTO `cpg_config` ( `name` , `value` ) VALUES ('guest_prefix', 'Guest');

Adding in language file in $lang_config_data array after
'User settings',
this string:
array('Guest username prefix', 'guest_prefix', 0),

in db_input.php
find
if ($msg_body == '') cpg_die(ERROR, $lang_db_input_php['err_comment_empty'], __FILE__, __LINE__);
add after
if (!USER_ID and !strstr($msg_author, $CONFIG['guest_prefix'])) $msg_author = $CONFIG['guest_prefix'].$msg_author;

find
if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
and add after
$msg_author = $CONFIG['guest_prefix'].$msg_author;

That's all... ;)

Warning: it's NOT TESTED for now, written directly in forum :)

George_CC

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 135
    • Web-Engines: installation, design, modifications of CMS
Re: no same nicks? (in comments)
« Reply #11 on: February 12, 2005, 10:36:25 pm »

2Vadim: to prevent this in db_input.php find:
if ($msg_body == '') cpg_die(ERROR, $lang_db_input_php['err_comment_empty'], __FILE__, __LINE__);
and add after
if (!USER_ID and mysql_result(mysql_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
    cpg_die(ERROR, 'A registered user is using this nickname, login or use another one' ,__FILE__,__LINE__);
}

*offtopic*
Are you russian? (seeng your nick)

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: no same nicks? (in comments)
« Reply #12 on: February 14, 2005, 06:59:03 am »

@George: you are right, adding a prefix like "*Guest* to unregistered users is the easiest and best solution to implement.

Joachim
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: no same nicks? (in comments)
« Reply #13 on: February 14, 2005, 12:25:07 pm »

@GauGau & George_CC: I do agree too, but with a small remark:

if you have a registered user "lambda" that goes on your website, see a picture and is too lazy to login (personal expericence, users are lazzzzy), comments he will leave will end with the username "Guest_lambda"...
Which also means that anybody will be able to leave a message under the "Guest_lambda" nickname too
That's why i still like the idea of  additionally checking for a registered user, with a message suggesting to login...ok maybe i'm just brainstorming too much on this one... ::) ;)

-matt-

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: no same nicks? (in comments)
« Reply #14 on: February 14, 2005, 01:11:14 pm »

well, in this case you shouldn't allow anonymous comments in the first place imo. However, the actual code that is meant to make it into the coppermine core code could have some fallback functions - it's all a matter of coding, or rather: who's willing to code it. Personally, I see little point in commenting at all, and I never allow anonymous comments nor uploads, simply because there are a lot of trolls, spammers and other stupid people around.

Joachim
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: no same nicks? (in comments)
« Reply #15 on: February 14, 2005, 10:44:28 pm »

it's all a matter of coding, or rather: who's willing to code it.

You kinda asked for it...;)
And moreover I did it cause i think comments can be pretty cool sometimes ( even anonymous, i repeat myself and dakky and Hein in this thread, users are lazy, it's often wether anonymous comments or no comments at all.. )

So attached are the following features ( i used the last 1.4 files ):
- anonymous users can't post comments under a registered nickname
- anonymous comments are prefixed ( prefix settable in config under the comments settings ). @Vadim & George_CC: in 1.4 ( don't know about 1.3x ) when an anonymous user edit a comment, only the msg body is changed, not the author name, so the author prefix add and the registered user check can be done only when inserting new comments
- doc updated too

-matt-

Vadim

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: no same nicks? (in comments)
« Reply #16 on: February 15, 2005, 12:22:31 am »

Strange, but really anonymous cannot change his nick, but I had such problems in 1.3.1 if i'm not mistaken.

*offtop*
@George_CC: Yeah, I'm Russian, but I was born and now living in Estonia  :)
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: no same nicks? (in comments)
« Reply #17 on: February 15, 2005, 12:39:53 am »

Strange, but really anonymous cannot change his nick, but I had such problems in 1.3.1 if i'm not mistaken.

Just checked at the CVS tree: it indeed used to be like that, and was fixed with v1.3 of db_input.php ( June 04 )

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: no same nicks? (in comments)
« Reply #18 on: February 15, 2005, 06:45:46 am »

@Matt: thanks for the contrib, added an item to the dev todo list to implement your hack into the core code, not sure if this will happen for cpg1.4.x though, as we're nearing the feature-freeze stage.

Joachim
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: no same nicks? (in comments)
« Reply #19 on: February 15, 2005, 08:10:35 am »

@nol33t: this is an excellent contribution, you even thought of modifying the documentation and adding the help icon links. I just committed it to the devel branch - great work. There were some minor glitches I had to correct though:

  • Code: [Select]
    cpg_die(ERROR, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);must be
    Code: [Select]
    cpg_die($lang_error, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
  • Although the code works as you provided it, you should always use the (redundant) extra curly braces to show the structures of your code (and to make it more readible for others), so
    Code: [Select]
                if (mysql_result(cpg_db_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))[/li][/list]
        cpg_die(ERROR, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
    should be
    Code: [Select]
                if (mysql_result(cpg_db_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
                {
                  cpg_die($lang_error, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
                }

  • The database update has to be both in update.sql and basic.sql (basic.sql is being used for fresh installs)
Anyway, great job! Looking forward to more of your contributions ;D

Joachim
Logged
Pages: [1] 2   Go Up
 

Page created in 0.03 seconds with 20 queries.