swad-core/swad_nickname.c

502 lines
19 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_nickname.c: Users' nicknames
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
2018-04-24 13:21:53 +02:00
Copyright (C) 1999-2018 Antonio Ca<EFBFBD>as Vargas
2014-12-01 23:55:08 +01:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <string.h> // For string functions
2014-12-12 22:39:55 +01:00
#include "swad_account.h"
2018-10-15 14:07:12 +02:00
#include "swad_box.h"
2014-12-01 23:55:08 +01:00
#include "swad_database.h"
#include "swad_global.h"
#include "swad_parameter.h"
#include "swad_QR.h"
2018-10-15 14:07:12 +02:00
#include "swad_table.h"
2014-12-01 23:55:08 +01:00
#include "swad_user.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
2018-10-15 14:07:12 +02:00
#define Nck_NICKNAME_SECTION_ID "nickname_section"
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private variables *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
2018-10-15 14:07:12 +02:00
static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname);
2014-12-01 23:55:08 +01:00
static void Nck_RemoveNicknameFromDB (const char *Nickname);
/*****************************************************************************/
/********* Check whether a nickname (with initial arroba) if valid ***********/
/*****************************************************************************/
bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
{
2017-01-28 15:58:46 +01:00
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
2014-12-01 23:55:08 +01:00
unsigned Length;
const char *Ptr;
/***** A nickname must start by '@' *****/
if (NicknameWithArroba[0] != '@') // It's not a nickname
return false;
/***** Make a copy of nickname *****/
2017-01-15 18:02:52 +01:00
Str_Copy (NicknameWithoutArroba,NicknameWithArroba,
2017-01-17 03:10:43 +01:00
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
2014-12-01 23:55:08 +01:00
Str_RemoveLeadingArrobas (NicknameWithoutArroba);
Length = strlen (NicknameWithoutArroba);
/***** A nick (without arroba) must have a number of characters
2017-03-07 01:56:41 +01:00
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA *****/
if (Length < Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA ||
Length > Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA)
2014-12-01 23:55:08 +01:00
return false;
/***** A nick can have digits, letters and '_' *****/
for (Ptr = NicknameWithoutArroba;
*Ptr;
Ptr++)
if (!((*Ptr >= 'a' && *Ptr <= 'z') ||
(*Ptr >= 'A' && *Ptr <= 'Z') ||
(*Ptr >= '0' && *Ptr <= '9') ||
(*Ptr == '_')))
return false;
return true;
}
/*****************************************************************************/
/************* Get nickname of a user from his/her user's code ***************/
/*****************************************************************************/
2017-01-17 03:10:43 +01:00
bool Nck_GetNicknameFromUsrCod (long UsrCod,
2017-03-07 01:56:41 +01:00
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1])
2014-12-01 23:55:08 +01:00
{
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
bool Found;
/***** Get current (last updated) user's nickname from database *****/
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
2017-03-24 01:09:27 +01:00
" WHERE UsrCod=%ld ORDER BY CreatTime DESC LIMIT 1",
2014-12-01 23:55:08 +01:00
UsrCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get nickname"))
{
/* Get nickname */
row = mysql_fetch_row (mysql_res);
2017-01-17 03:10:43 +01:00
Str_Copy (Nickname,row[0],
2017-03-07 01:56:41 +01:00
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
2014-12-01 23:55:08 +01:00
Found = true;
}
else
{
2017-01-17 03:10:43 +01:00
Nickname[0] = '\0';
2014-12-01 23:55:08 +01:00
Found = false;
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return Found;
}
/*****************************************************************************/
/************** Get user's code of a user from his/her nickname **************/
/*****************************************************************************/
2015-03-05 01:55:46 +01:00
// Nickname may have leading '@'
2014-12-01 23:55:08 +01:00
// Returns true if nickname found in database
long Nck_GetUsrCodFromNickname (const char *Nickname)
{
2017-01-17 03:10:43 +01:00
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
2014-12-01 23:55:08 +01:00
char Query[512];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long UsrCod = -1L;
2015-10-07 19:55:13 +02:00
if (Nickname)
if (Nickname[0])
{
/***** Make a copy without possible starting arrobas *****/
2017-01-15 18:02:52 +01:00
Str_Copy (NicknameWithoutArroba,Nickname,
2017-01-17 03:10:43 +01:00
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
2015-10-07 19:55:13 +02:00
Str_RemoveLeadingArrobas (NicknameWithoutArroba);
/***** Get user's code from database *****/
/* Check if user code from table usr_nicknames is also in table usr_data */
2015-11-21 20:23:28 +01:00
sprintf (Query,"SELECT usr_nicknames.UsrCod"
" FROM usr_nicknames,usr_data"
2015-10-07 19:55:13 +02:00
" WHERE usr_nicknames.Nickname='%s'"
" AND usr_nicknames.UsrCod=usr_data.UsrCod",
NicknameWithoutArroba);
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's code"))
{
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get user's code */
UsrCod = Str_ConvertStrCodToLongCod (row[0]);
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
2014-12-01 23:55:08 +01:00
return UsrCod;
}
/*****************************************************************************/
/*********************** Show form to change my nickname *********************/
/*****************************************************************************/
2018-10-15 14:07:12 +02:00
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname)
2014-12-01 23:55:08 +01:00
{
2018-10-15 14:07:12 +02:00
Nck_ShowFormChangeUsrNickname (IMustFillNickname);
}
/*****************************************************************************/
/*********************** Show form to change my nickname *********************/
/*****************************************************************************/
// Not yet used
void Nck_ShowFormChangeOtherUsrNickname (void)
{
Nck_ShowFormChangeUsrNickname (false); // IMustFillNickname
}
/*****************************************************************************/
/*********************** Show form to change my nickname *********************/
/*****************************************************************************/
static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
{
extern const char *Hlp_PROFILE_Account;
2015-07-28 00:16:09 +02:00
extern const char *The_ClassForm[The_NUM_THEMES];
2018-10-15 14:07:12 +02:00
extern const char *Txt_Nickname;
extern const char *Txt_Before_going_to_any_other_option_you_must_fill_your_nickname;
2014-12-01 23:55:08 +01:00
extern const char *Txt_Current_nickname;
extern const char *Txt_Other_nicknames;
2017-03-01 18:53:51 +01:00
extern const char *Txt_QR_code;
2014-12-01 23:55:08 +01:00
extern const char *Txt_Use_this_nickname;
extern const char *Txt_New_nickname;
extern const char *Txt_Change_nickname;
extern const char *Txt_Save;
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2018-10-15 14:07:12 +02:00
char StrRecordWidth[10 + 1];
2014-12-01 23:55:08 +01:00
unsigned NumNicks;
unsigned NumNick;
2018-10-15 14:07:12 +02:00
/***** Start section *****/
Lay_StartSection (Nck_NICKNAME_SECTION_ID);
2014-12-01 23:55:08 +01:00
/***** Get my nicknames *****/
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
2017-03-24 01:09:27 +01:00
" WHERE UsrCod=%ld"
2014-12-01 23:55:08 +01:00
" ORDER BY CreatTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod);
NumNicks = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get nicknames of a user");
2018-10-15 14:07:12 +02:00
/***** Start box *****/
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
Box_StartBox (StrRecordWidth,Txt_Nickname,Acc_PutLinkToRemoveMyAccount,
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show possible alert *****/
if (Gbl.Alert.Section == (const char *) Nck_NICKNAME_SECTION_ID)
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
/***** Help message *****/
if (IMustFillNickname)
Ale_ShowAlert (Ale_WARNING,
Txt_Before_going_to_any_other_option_you_must_fill_your_nickname);
/***** Start table *****/
Tbl_StartTableWide (2);
2014-12-01 23:55:08 +01:00
/***** List my nicknames *****/
for (NumNick = 1;
NumNick <= NumNicks;
NumNick++)
{
/* Get nickname */
row = mysql_fetch_row (mysql_res);
if (NumNick == 1)
/* The first nickname is the current one */
fprintf (Gbl.F.Out,"<tr>"
2018-10-15 14:07:12 +02:00
"<td class=\"REC_C1_BOT RIGHT_TOP\">"
"<label for=\"Nick\" class=\"%s\">"
2014-12-23 22:47:09 +01:00
"%s:"
2018-10-15 14:07:12 +02:00
"</label>"
2014-12-23 22:47:09 +01:00
"</td>"
2018-10-15 14:07:12 +02:00
"<td class=\"REC_C2_BOT LEFT_TOP USR_ID\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Current_nickname);
2014-12-01 23:55:08 +01:00
else // NumNick >= 2
{
2015-03-24 17:47:26 +01:00
fprintf (Gbl.F.Out,"<tr>");
2014-12-01 23:55:08 +01:00
if (NumNick == 2)
2018-10-15 14:07:12 +02:00
fprintf (Gbl.F.Out,"<td rowspan=\"%u\""
" class=\"REC_C1_BOT RIGHT_TOP\">"
"<label for=\"Nick\" class=\"%s\">"
"%s:"
"</label>"
"</td>",
2015-03-24 17:47:26 +01:00
NumNicks - 1,
2015-07-28 00:16:09 +02:00
The_ClassForm[Gbl.Prefs.Theme],
2015-03-24 17:47:26 +01:00
Txt_Other_nicknames);
2018-10-15 14:07:12 +02:00
fprintf (Gbl.F.Out,"<td class=\"REC_C2_BOT LEFT_TOP DAT\">");
2014-12-01 23:55:08 +01:00
/* Form to remove old nickname */
2018-10-15 14:07:12 +02:00
Act_StartFormAnchor (ActRemOldNic,Nck_NICKNAME_SECTION_ID);
2016-12-24 14:26:50 +01:00
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"Nick\""
" value=\"%s\" />",
2014-12-01 23:55:08 +01:00
row[0]);
2017-06-11 19:13:28 +02:00
Ico_PutIconRemove ();
2018-10-15 14:07:12 +02:00
Act_EndForm ();
2014-12-01 23:55:08 +01:00
}
/* Nickname */
2018-10-15 14:07:12 +02:00
fprintf (Gbl.F.Out,"@%s",row[0]);
2014-12-01 23:55:08 +01:00
/* Link to QR code */
if (NumNick == 1 && Gbl.Usrs.Me.UsrDat.Nickname[0])
2017-04-17 19:03:21 +02:00
Lay_PutContextualLink (ActPrnUsrQR,NULL,Usr_PutParamMyUsrCodEncrypted,
2017-03-01 18:53:51 +01:00
"qr64x64.gif",
Txt_QR_code,NULL,
NULL);
2014-12-01 23:55:08 +01:00
2015-09-18 02:15:35 +02:00
2014-12-01 23:55:08 +01:00
/* Form to change the nickname */
if (NumNick > 1)
{
2018-10-15 14:07:12 +02:00
fprintf (Gbl.F.Out,"<br />");
Act_StartFormAnchor (ActChgNic,Nck_NICKNAME_SECTION_ID);
2016-12-24 14:26:50 +01:00
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"NewNick\""
" value=\"@%s\" />",
2015-03-24 17:47:26 +01:00
row[0]); // Nickname
2017-06-11 19:02:40 +02:00
Btn_PutConfirmButtonInline (Txt_Use_this_nickname);
2018-10-15 14:07:12 +02:00
Act_EndForm ();
2014-12-01 23:55:08 +01:00
}
2015-03-24 17:47:26 +01:00
fprintf (Gbl.F.Out,"</td>"
"</tr>");
2014-12-01 23:55:08 +01:00
}
/***** Form to enter new nickname *****/
fprintf (Gbl.F.Out,"<tr>"
2018-10-15 14:07:12 +02:00
"<td class=\"REC_C1_BOT RIGHT_TOP\">"
"<label for=\"NewNick\" class=\"%s\">"
"%s:"
"</label>"
2014-12-23 22:47:09 +01:00
"</td>"
2018-10-15 14:07:12 +02:00
"<td class=\"REC_C2_BOT LEFT_TOP DAT\">",
2015-07-28 00:16:09 +02:00
The_ClassForm[Gbl.Prefs.Theme],
2014-12-01 23:55:08 +01:00
NumNicks ? Txt_New_nickname : // A new nickname
Txt_Nickname); // The first nickname
2018-10-15 14:07:12 +02:00
Act_StartFormAnchor (ActChgNic,Nck_NICKNAME_SECTION_ID);
fprintf (Gbl.F.Out,"<input type=\"text\" id=\"NewNick\" name=\"NewNick\""
2016-12-10 18:32:35 +01:00
" size=\"18\" maxlength=\"%u\" value=\"@%s\" />"
2018-10-15 14:07:12 +02:00
"<br />",
2017-03-07 01:56:41 +01:00
1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
2015-03-24 17:47:26 +01:00
Gbl.Usrs.Me.UsrDat.Nickname);
2017-06-11 19:02:40 +02:00
Btn_PutCreateButtonInline (NumNicks ? Txt_Change_nickname : // I already have a nickname
2015-03-24 17:47:26 +01:00
Txt_Save); // I have no nickname yet);
2018-10-15 14:07:12 +02:00
Act_EndForm ();
2015-03-13 00:16:02 +01:00
fprintf (Gbl.F.Out,"</td>"
"</tr>");
2018-10-15 14:07:12 +02:00
/***** End table and box *****/
Box_EndBoxTable ();
/***** End section *****/
Lay_EndSection ();
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
/******************************* Remove nickname *****************************/
/*****************************************************************************/
void Nck_RemoveNick (void)
{
extern const char *Txt_Nickname_X_removed;
extern const char *Txt_You_can_not_delete_your_current_nickname;
2017-03-07 01:56:41 +01:00
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
2014-12-01 23:55:08 +01:00
/***** Get new nickname from form *****/
2017-03-07 01:56:41 +01:00
Par_GetParToText ("Nick",NicknameWithoutArroba,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
2014-12-01 23:55:08 +01:00
if (strcasecmp (NicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.Nickname)) // Only if not my current nickname
{
/***** Remove one of my old nicknames *****/
Nck_RemoveNicknameFromDB (NicknameWithoutArroba);
/***** Show message *****/
2018-10-15 14:07:12 +02:00
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
2017-05-10 10:25:01 +02:00
sprintf (Gbl.Alert.Txt,Txt_Nickname_X_removed,NicknameWithoutArroba);
2014-12-01 23:55:08 +01:00
}
else
2018-10-15 14:07:12 +02:00
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
sprintf (Gbl.Alert.Txt,"%s",Txt_You_can_not_delete_your_current_nickname);
}
2014-12-01 23:55:08 +01:00
/***** Show my account again *****/
2018-10-15 14:07:12 +02:00
Acc_ShowFormChgMyAccount ();
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
/******************* Remove an old nickname from database ********************/
/*****************************************************************************/
static void Nck_RemoveNicknameFromDB (const char *Nickname)
{
char Query[256];
/***** Remove an old nickname *****/
sprintf (Query,"DELETE FROM usr_nicknames"
2017-03-24 01:09:27 +01:00
" WHERE UsrCod=%ld AND Nickname='%s'",
2014-12-01 23:55:08 +01:00
Gbl.Usrs.Me.UsrDat.UsrCod,Nickname);
DB_QueryREPLACE (Query,"can not remove an old nickname");
}
/*****************************************************************************/
/******************************* Update nickname *****************************/
/*****************************************************************************/
void Nck_UpdateNick (void)
{
extern const char *Txt_The_nickname_X_matches_the_one_you_had_previously_registered;
extern const char *Txt_The_nickname_X_had_been_registered_by_another_user;
extern const char *Txt_Your_nickname_X_has_been_registered_successfully;
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
char Query[1024];
2017-01-28 15:58:46 +01:00
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
2014-12-01 23:55:08 +01:00
/***** Get new nickname from form *****/
2017-01-17 03:10:43 +01:00
Par_GetParToText ("NewNick",NewNicknameWithArroba,Nck_MAX_BYTES_NICKNAME_FROM_FORM);
2014-12-01 23:55:08 +01:00
if (Nck_CheckIfNickWithArrobaIsValid (NewNicknameWithArroba)) // If new nickname is valid
{
/***** Remove arrobas at the beginning *****/
2017-01-15 18:02:52 +01:00
Str_Copy (NewNicknameWithoutArroba,NewNicknameWithArroba,
2017-01-17 03:10:43 +01:00
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
2014-12-01 23:55:08 +01:00
Str_RemoveLeadingArrobas (NewNicknameWithoutArroba);
/***** Check if new nickname exists in database *****/
if (!strcmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname match exactly the new nickname
{
2018-10-15 14:07:12 +02:00
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
2017-05-10 10:25:01 +02:00
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
2014-12-01 23:55:08 +01:00
NewNicknameWithoutArroba);
}
2018-10-10 23:56:42 +02:00
else if (strcasecmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname does not match, not even case insensitive, the new nickname
2014-12-01 23:55:08 +01:00
{
/***** Check if the new nickname matches any of my old nicknames *****/
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
2017-03-24 01:09:27 +01:00
" WHERE UsrCod=%ld AND Nickname='%s'",
2014-12-01 23:55:08 +01:00
Gbl.Usrs.Me.UsrDat.UsrCod,NewNicknameWithoutArroba);
if (!DB_QueryCOUNT (Query,"can not check if nickname already existed")) // No matches
{
/***** Check if the new nickname matches any of the nicknames of other users *****/
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
2017-03-24 01:09:27 +01:00
" WHERE Nickname='%s' AND UsrCod<>%ld",
2014-12-01 23:55:08 +01:00
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
2018-10-10 23:56:42 +02:00
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that my nickname
2014-12-01 23:55:08 +01:00
{
2018-10-15 14:07:12 +02:00
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
2017-05-10 10:25:01 +02:00
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_had_been_registered_by_another_user,
2014-12-01 23:55:08 +01:00
NewNicknameWithoutArroba);
}
}
}
2018-10-15 14:07:12 +02:00
if (Gbl.Alert.Type == Ale_NONE)
2014-12-01 23:55:08 +01:00
{
// Now we know the new nickname is not already in database and is diffent to the current one
Nck_UpdateMyNick (NewNicknameWithoutArroba);
2017-01-15 22:58:26 +01:00
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
2017-03-07 01:56:41 +01:00
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
2014-12-01 23:55:08 +01:00
2018-10-15 14:07:12 +02:00
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
2017-05-10 10:25:01 +02:00
sprintf (Gbl.Alert.Txt,Txt_Your_nickname_X_has_been_registered_successfully,
2014-12-01 23:55:08 +01:00
NewNicknameWithoutArroba);
}
}
else // New nickname is not valid
{
2018-10-15 14:07:12 +02:00
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
2017-05-10 10:25:01 +02:00
sprintf (Gbl.Alert.Txt,Txt_The_nickname_entered_X_is_not_valid_,
2014-12-01 23:55:08 +01:00
NewNicknameWithArroba,
2017-03-07 01:56:41 +01:00
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
2014-12-01 23:55:08 +01:00
}
/***** Show my account again *****/
2018-10-15 14:07:12 +02:00
Acc_ShowFormChgMyAccount ();
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
/********************** Update my nickname in database ***********************/
/*****************************************************************************/
void Nck_UpdateMyNick (const char *NewNickname)
{
char Query[512];
/***** Update my nickname in database *****/
sprintf (Query,"REPLACE INTO usr_nicknames"
2017-03-13 13:17:53 +01:00
" (UsrCod,Nickname,CreatTime)"
" VALUES"
2017-03-24 01:09:27 +01:00
" (%ld,'%s',NOW())",
2014-12-01 23:55:08 +01:00
Gbl.Usrs.Me.UsrDat.UsrCod,NewNickname);
DB_QueryREPLACE (Query,"can not update your nickname");
}