R4imis

del mysql registracijos/prisijungimo BĖDA

Recommended Posts

Sveiki visi taigi iškilo bėda su registracija/prisijungimu. Kaip įeinu į serva nesvarbu su kokiu nick'u rašo, jog acc jau uzregistruotas ir reikia prisijungti, nors to acc dar nereginau. Kame diela gal padėsit? clear.png

Štai kodas:

public OnPlayerConnect(playerid)
{
new query[126],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM Vartotjai WHERE Vardas = '%s'", pName);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() )
{
 SendClientMessage(playerid, -1, "Šis vartotojas jau registruotas prašome įvestisti savo slaptažodį");
 ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Prisijungimas", "Norėdamas prisijungti įvestisk žemiau savo slaptažodį", "Prisijungti", "Išeiti");
}
else
{
 SendClientMessage(playerid, -1, "Šis vartotojas dar neregistruotas prašome užsiregistruoti įvesdami slaptažodį");
 ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Registracija", "Norėdamas prisiregistruoti įvesk sugalvota slaptažodį", "Registruotis", "Išeiti");
}
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
 if(response)
 {
  new query[126], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(query, sizeof(query), "SELECT * FROM Vartotojai WHERE Vardas = '%s', AND Slaptazodis = '%s'", pName, inputtext);
  mysql_query(query);
  mysql_store_result();
  if(mysql_num_rows() == 1)
  {
   SendClientMessage(playerid, -1, "Sėkmingai prsijungei");
   //PrisijungesZaidejas(playerid);
  }
  else
  {
   SendClientMessage(playerid, -1, "Neteisingas slaptazodis");
   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Prisijungimas", "Norėdamas prisijungti įvesk savo slaptažodį", "Prisijungti", "Išeiti");
  }
 }
}
if(dialogid == 1)
{
 if(response)
 {
  new query[126], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(query, sizeof(query), "INSERT INTO Vartotojai VALUES ('%s', '%s')", pName, inputtext);
  mysql_query(query);
  SendClientMessage(playerid, -1, "Tu sėkmingai užsiregistravai");
 }
}
return 1;
}

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

logas:

[00:02:42]

[00:02:42] ---------------------------

[00:02:42] MySQL Debugging activated (09/07/13)

[00:02:42] ---------------------------

[00:02:42]

[00:02:42] >> mysql_connect( )

[00:02:42] CMySQLHandler::CMySQLHandler() - constructor called.

[00:02:42] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "Mokinuos" | Username: "root" ...

[00:02:42] CMySQLHandler::Connect() - Connection was successful.

[00:02:42] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:03:02] >> mysql_query( Connection handle: 1 )

[00:03:02] CMySQLHandler::Query(SELECT * FROM Vartotjai WHERE Vardas = 'kkkk') - An error has occured. (Error ID: 1146, Table 'mokinuos.vartotjai' doesn't exist)

[00:03:02] >> mysql_store_result( Connection handle: 1 )

[00:03:02] CMySQLHandler::StoreResult() - No data to store.

[00:03:02] >> mysql_num_rows( Connection handle: 1 )

[00:03:02] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[00:03:10] >> mysql_query( Connection handle: 1 )

[00:03:10] CMySQLHandler::Query(SELECT * FROM Vartotojai WHERE Vardas = 'kkkk', AND Slaptazodis = 'uuu') - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' AND Slaptazodis = 'uuu'' at line 1)

[00:03:10] >> mysql_store_result( Connection handle: 1 )

[00:03:10] CMySQLHandler::StoreResult() - No data to store.

[00:03:10] >> mysql_num_rows( Connection handle: 1 )

[00:03:10] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

new query[126],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM Vartotjai WHERE Vardas = '%s'", pName);
mysql_query(query);

nera tokios lenteles.

GetPlayerName(playerid, pName, sizeof(pName));
  format(query, sizeof(query), "SELECT * FROM Vartotojai WHERE Vardas = '%s', AND Slaptazodis = '%s'", pName, inputtext);
  mysql_query(query);
  mysql_store_result();

nuimk kableli pries AND

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

new query[126],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM Vartotjai WHERE Vardas = '%s'", pName);
mysql_query(query);

nera tokios lenteles.

GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM Vartotojai WHERE Vardas = '%s', AND Slaptazodis = '%s'", pName, inputtext);
mysql_query(query);
mysql_store_result();

nuimk kableli pries AND

Kableli niėmiau letelę sukūriau (tiksliau tereikėjo vartotojai is mazos raides :D), o dabar neįrašo vartotojo į duom bazę ta prasme visą laik reikia regintis iš naujo.

va darbar toks logas:

[00:23:33]

[00:23:33] ---------------------------

[00:23:33] MySQL Debugging activated (09/07/13)

[00:23:33] ---------------------------

[00:23:33]

[00:23:33] >> mysql_connect( )

[00:23:33] CMySQLHandler::CMySQLHandler() - constructor called.

[00:23:33] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "Mokinuos" | Username: "root" ...

[00:23:33] CMySQLHandler::Connect() - Connection was successful.

[00:23:33] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:23:52] >> mysql_query( Connection handle: 1 )

[00:23:52] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[00:23:52] >> mysql_store_result( Connection handle: 1 )

[00:23:52] CMySQLHandler::StoreResult() - Result was stored.

[00:23:52] >> mysql_num_rows( Connection handle: 1 )

[00:23:52] CMySQLHandler::NumRows() - Returned 0 row(s)

[00:23:55] >> mysql_query( Connection handle: 1 )

[00:23:55] CMySQLHandler::Query(INSERT INTO vartotojai VALUES ('kkkk', 'toletas')) - An error has occured. (Error ID: 1136, Column count doesn't match value count at row 1)

[00:25:30] >> mysql_query( Connection handle: 1 )

[00:25:30] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[00:25:30] >> mysql_store_result( Connection handle: 1 )

[00:25:30] CMySQLHandler::StoreResult() - Result was stored.

[00:25:30] >> mysql_num_rows( Connection handle: 1 )

[00:25:30] CMySQLHandler::NumRows() - Returned 0 row(s)

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

Blogai naudoji. šablonas:

INSERT INTO lentelė (Stulpelis1,stulpelis2) VALUES (verte1,verte2)

Su registracija viskas čiki Dq labai, o žiūrėk dabar padariau, kad saugotų pozicija, bet man jos nesaugo kame bėfa?

Mysql logas:

[00:39:35]

[00:39:35] ---------------------------

[00:39:35] MySQL Debugging activated (09/07/13)

[00:39:35] ---------------------------

[00:39:35]

[00:39:35] >> mysql_connect( )

[00:39:35] CMySQLHandler::CMySQLHandler() - constructor called.

[00:39:35] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "Mokinuos" | Username: "root" ...

[00:39:35] CMySQLHandler::Connect() - Connection was successful.

[00:39:35] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:39:56] >> mysql_query( Connection handle: 1 )

[00:39:56] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[00:39:56] >> mysql_store_result( Connection handle: 1 )

[00:39:56] CMySQLHandler::StoreResult() - Result was stored.

[00:39:56] >> mysql_num_rows( Connection handle: 1 )

[00:39:56] CMySQLHandler::NumRows() - Returned 1 row(s)

[00:39:59] >> mysql_query( Connection handle: 1 )

[00:39:59] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk' AND Slaptazodis = 'ta') - Successfully executed.

[00:39:59] >> mysql_store_result( Connection handle: 1 )

[00:39:59] CMySQLHandler::StoreResult() - Result was stored.

[00:39:59] >> mysql_num_rows( Connection handle: 1 )

[00:39:59] CMySQLHandler::NumRows() - Returned 1 row(s)

[00:39:59] >> mysql_query( Connection handle: 1 )

[00:39:59] CMySQLHandler::Query(SELECT * FROM Vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[00:39:59] >> mysql_store_result( Connection handle: 1 )

[00:39:59] CMySQLHandler::StoreResult() - Result was stored.

[00:39:59] >> mysql_fetch_row_format( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchRow() - Return: kkkkltalll

[00:39:59] >> mysql_fetch_field_row( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchField("Vardas") - kkkk

[00:39:59] >> mysql_fetch_field_row( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchField("Slaptazodis") - ta

[00:39:59] >> mysql_fetch_field_row( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchField("ZaidejasX") -

[00:39:59] >> mysql_fetch_field_row( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchField("ZaidejasY") -

[00:39:59] >> mysql_fetch_field_row( Connection handle: 1 )

[00:39:59] CMySQLHandler::FetchField("ZaidejasZ") -

[00:39:59] >> mysql_fetch_row_format( Connection handle: 1 )

[00:40:09] >> mysql_query( Connection handle: 1 )

[00:40:09] CMySQLHandler::Query(UPDATE Vartotojai SET Vardas = 'kkkk' AND Slaptazodis = 'ta' ZaidejasX = '2009.539550' ZaidejasY = '1343.972900' ZaidejasZ '10.) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ZaidejasX = '2009.539550' ZaidejasY = '1343.972900' ZaidejasZ '10.' at line 1)

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

UPDATE lentele SET Kazkas='1', Kazkas2='4', Kazkasdar='5' WHERE Vardas='Vardas_P'

toki formata naudok

Vistiek aš kažko nepagaunu kas čia blogai..

Va mano kodas:

Čia užkrovimas:

stock PrisijungesZaidejas(playerid)
{
new query[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM vartotojai WHERE Vardas = '%s'", pName);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "l"))
{
 mysql_fetch_field_row(Zaidejas[playerid][vardas], "Vardas");
 mysql_fetch_field_row(Zaidejas[playerid][slaptazodis], "Slaptazodis");
 mysql_fetch_field_row(query, "ZaidejasX"); Zaidejas[playerid][Pozicija][0] = floatstr(query);
 mysql_fetch_field_row(query, "ZaidejasY"); Zaidejas[playerid][Pozicija][1] = floatstr(query);
 mysql_fetch_field_row(query, "ZaidejasZ"); Zaidejas[playerid][Pozicija][2] = floatstr(query);
 SetSpawnInfo(playerid, 0, 299, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], 0, 0, 0, 0, 0, 0, 0);
}
}

O čia saugojimas:

stock IsaugomZaideja(playerid)
{
new query[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerPos(playerid, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2]);
format(query, sizeof(query), "UPDATE vartotojai SET Vardas = '%s', AND Slaptazodis = '%s', ZaidejasX = '%f', ZaidejasY = '%f', ZaidejasZ = '%f', WHERE Vardas = '%s'", pName, Zaidejas[playerid][slaptazodis], Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], pName);
mysql_query(query);
printf("Playerid %d (%s) buvo išsaugota", playerid, pName);
}

Ką šitame kode pakeisti? Aš nesuprantu..

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

stock IsaugomZaideja(playerid)
{
new query[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerPos(playerid, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2]);
format(query, sizeof(query), "UPDATE vartotojai SET ZaidejasX = '%f', ZaidejasY = '%f', ZaidejasZ = '%f', WHERE Vardas = '%s'", Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], pName);
mysql_query(query);
printf("Playerid %d (%s) buvo išsaugota", playerid, pName);
}

stock PrisijungesZaidejas(playerid)
{
new query[500], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM vartotojai WHERE Vardas = '%s'", pName);
mysql_query(query);
mysql_store_result();
new fetch[50];
while(mysql_fetch_row_format(query))
{
 mysql_fetch_field_row(Zaidejas[playerid][vardas], "Vardas");
 mysql_fetch_field_row(Zaidejas[playerid][slaptazodis], "Slaptazodis");
 mysql_fetch_field_row(fetch, "ZaidejasX"); Zaidejas[playerid][Pozicija][0] = floatstr(fetch);
 mysql_fetch_field_row(fetch, "ZaidejasY"); Zaidejas[playerid][Pozicija][1] = floatstr(fetch);
 mysql_fetch_field_row(fetch, "ZaidejasZ"); Zaidejas[playerid][Pozicija][2] = floatstr(fetch);
 SetSpawnInfo(playerid, 0, 299, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], 0, 0, 0, 0, 0, 0, 0);
}
}

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

stock IsaugomZaideja(playerid)
{
new query[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerPos(playerid, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2]);
format(query, sizeof(query), "UPDATE vartotojai SET ZaidejasX = '%f', ZaidejasY = '%f', ZaidejasZ = '%f', WHERE Vardas = '%s'", Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], pName);
mysql_query(query);
printf("Playerid %d (%s) buvo išsaugota", playerid, pName);
}

stock PrisijungesZaidejas(playerid)
{
new query[500], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM vartotojai WHERE Vardas = '%s'", pName);
mysql_query(query);
mysql_store_result();
new fetch[50];
while(mysql_fetch_row_format(query))
{
mysql_fetch_field_row(Zaidejas[playerid][vardas], "Vardas");
mysql_fetch_field_row(Zaidejas[playerid][slaptazodis], "Slaptazodis");
mysql_fetch_field_row(fetch, "ZaidejasX"); Zaidejas[playerid][Pozicija][0] = floatstr(fetch);
mysql_fetch_field_row(fetch, "ZaidejasY"); Zaidejas[playerid][Pozicija][1] = floatstr(fetch);
mysql_fetch_field_row(fetch, "ZaidejasZ"); Zaidejas[playerid][Pozicija][2] = floatstr(fetch);
SetSpawnInfo(playerid, 0, 299, Zaidejas[playerid][Pozicija][0], Zaidejas[playerid][Pozicija][1], Zaidejas[playerid][Pozicija][2], 0, 0, 0, 0, 0, 0, 0);
}
}

Krc.. perdariau pagal kaip čia parodei bet vistiek nesaugo...

mysql logas:

[16:07:25]

[16:07:25] ---------------------------

[16:07:25] MySQL Debugging activated (09/07/13)

[16:07:25] ---------------------------

[16:07:25]

[16:07:25] >> mysql_connect( )

[16:07:25] CMySQLHandler::CMySQLHandler() - constructor called.

[16:07:25] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "Mokinuos" | Username: "root" ...

[16:07:25] CMySQLHandler::Connect() - Connection was successful.

[16:07:25] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[16:07:46] >> mysql_query( Connection handle: 1 )

[16:07:46] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[16:07:46] >> mysql_store_result( Connection handle: 1 )

[16:07:46] CMySQLHandler::StoreResult() - Result was stored.

[16:07:46] >> mysql_num_rows( Connection handle: 1 )

[16:07:46] CMySQLHandler::NumRows() - Returned 1 row(s)

[16:07:54] >> mysql_query( Connection handle: 1 )

[16:07:54] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk' AND Slaptazodis = 'taaaa') - Successfully executed.

[16:07:54] >> mysql_store_result( Connection handle: 1 )

[16:07:54] CMySQLHandler::StoreResult() - Result was stored.

[16:07:54] >> mysql_num_rows( Connection handle: 1 )

[16:07:54] CMySQLHandler::NumRows() - Returned 0 row(s)

[16:07:56] >> mysql_query( Connection handle: 1 )

[16:07:56] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk' AND Slaptazodis = 'ta') - Successfully executed.

[16:07:56] >> mysql_store_result( Connection handle: 1 )

[16:07:56] CMySQLHandler::StoreResult() - Result was stored.

[16:07:56] >> mysql_num_rows( Connection handle: 1 )

[16:07:56] CMySQLHandler::NumRows() - Returned 1 row(s)

[16:07:56] >> mysql_query( Connection handle: 1 )

[16:07:56] CMySQLHandler::Query(SELECT * FROM vartotojai WHERE Vardas = 'kkkk') - Successfully executed.

[16:07:56] >> mysql_store_result( Connection handle: 1 )

[16:07:56] CMySQLHandler::StoreResult() - Result was stored.

[16:07:56] >> mysql_fetch_row_format( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchRow() - Return: kkkkltalll

[16:07:56] >> mysql_fetch_field_row( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchField("Vardas") - kkkk

[16:07:56] >> mysql_fetch_field_row( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchField("Slaptazodis") - ta

[16:07:56] >> mysql_fetch_field_row( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchField("ZaidejasX") -

[16:07:56] >> mysql_fetch_field_row( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchField("ZaidejasY") -

[16:07:56] >> mysql_fetch_field_row( Connection handle: 1 )

[16:07:56] CMySQLHandler::FetchField("ZaidejasZ") -

[16:07:56] >> mysql_fetch_row_format( Connection handle: 1 )

[16:08:11] >> mysql_query( Connection handle: 1 )

[16:08:11] CMySQLHandler::Query(UPDATE vartotojai SET ZaidejasX = '2045.705444', ZaidejasY = '1322.072143', ZaidejasZ = '10.671875', WHERE Vardas = 'kkkk') - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE Vardas = 'kkkk'' at line 1)

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

Prisijungti prie diskusijos

Palikti atsakymą galite iš karto, o užsiregistruoti vėliau. Jeigu jau turite paskyrą mūsų forume, Prisijunkite.

Svečias
Atsakyti šioje temoje...

×   Įklijuotas tekstas turi teksto formatavimą.   Pašalinti teksto formatavimą

  Galimi tik 75 veidukai.

×   Nuoroda buvo automatiškai įterpta.   Įterpti nuorodą paprastai

×   Jūsų ankstesnis pranešimas buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.


  • Šiame puslapyje naršo:   0 nariai

    Nėra registruotų narių peržiūrinčių šį forumą.

  • eneba
  • eneba
  • eneba



  • SuperGames programele
  • SuperGames programele