Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Name auth system, exploit?

Name auth system, exploit?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zeno   USA  (2,871 posts)  Bio
Date Fri 24 Sep 2004 02:32 AM (UTC)
Message
If I deny a name, they change it, then both characters now exist. For example, Bob renames to Bobby, both Bob and Bobby remain, so they have duplicate equipment now, etc. This is pretty bad. How would I fix this?

  oldname = ch->name;

  sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(argument[0]),
                        capitalize( argument ) );
  if ( stat( fname, &fst ) != -1 )
  {
    send_to_char("That name is already taken.  Please choose another.\n\r", ch);
    return;
  }

  STRFREE( ch->name );
  ch->name = STRALLOC( argument );
  STRFREE( ch->pcdata->filename );
  ch->pcdata->filename = STRALLOC( argument );
  send_to_char("Your name has been changed.\n\r", ch);
  ch->pcdata->auth_state = 0;
  sprintf( buf, "%s changed name to %s.", oldname, ch->name);
  to_channel( buf, CHANNEL_AUTH, "Auth", LEVEL_NEOPHYTE );
  return;
}

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Fri 24 Sep 2004 06:05 AM (UTC)

Amended on Fri 24 Sep 2004 06:07 AM (UTC) by Greven

Message
You can add this in like such:
  oldname = ch->name;

  sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(argument[0]),
                        capitalize( argument ) );
  if ( stat( fname, &fst ) != -1 )
  {
    send_to_char("That name is already taken.  Please choose another.\n\r", ch);
    return;
  }

  
  sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(ch->name[0]),
                        capitalize( ch->name ) );
  if (access(fname, F_OK) == 0)
    unlink(fname);

  STRFREE( ch->name );
  ch->name = STRALLOC( argument );
  STRFREE( ch->pcdata->filename );
  ch->pcdata->filename = STRALLOC( argument );
  send_to_char("Your name has been changed.\n\r", ch);
  ch->pcdata->auth_state = 0;
  sprintf( buf, "%s changed name to %s.", oldname, ch->name);
  to_channel( buf, CHANNEL_AUTH, "Auth", LEVEL_NEOPHYTE );
  return;
}


That should check if they have a pfile (perhaps they have not been authed yet), and if they do, remove it.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,635 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.