KBEngine官方论坛

 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 配置 开服
查看: 1086|回复: 17

HTML account management demo?

[复制链接]

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
发表于 2016-2-2 23:19:44 | 显示全部楼层 |阅读模式
While I plan on using the Unity client for the actual game, I'd like to impliment account management functions via a simple web page.  Functions such as account creation, password reset, and editing associated data (Real Name, e-mail, etc).

Is there a demo or some tips on how to best go about creating a web interface to that portion of the engine only?  I'm not interested in creating a full-blown HTML game client, just account management.
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-3 00:57:28 | 显示全部楼层
You can refer to html5demo(https://github.com/kbengine/kbengine_cocos2d_js_demo).

You can use the JS plug-in communication with the server, through an administrator game account to modify the game datas.
You can also use the administrator account to call the database API(Kbengine.exec***) to modify the datas.
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-3 00:57:34 | 显示全部楼层
You can refer to html5demo(https://github.com/kbengine/kbengine_cocos2d_js_demo).

You can use the JS plug-in communication with the server, through an administrator game account to modify the game datas.
You can also use the administrator account to call the database API(Kbengine.exec***) to modify the datas.
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-3 04:38:51 | 显示全部楼层
I looked at that, seemed to be significantly more complex than I needed, as it incorporates a full game.  I'll look at it again and try to grab only the bits dealing with account creation.

Thank you!
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-3 09:12:02 | 显示全部楼层
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-5 22:45:15 | 显示全部楼层
This is massive overkill for what I want to do from the web interface.

I do not want a "game client" from the web.  No entities should be created in game, the web-based interactions should never "enter world" etc.

I simply want to give users a way to manage their account information without having to use the graphical game client.  I want users to come to a web page and be able to read about my game, create an account, set their email address, reset their password, update their meta-data, etc.  All simply mysql data manipulation.  A user that is "logged in" to the account management tool should not be considered "logged in" to the game.  They are simply able to update their account meta-data.

I guess the right way to do what I want is to simply use a cgi script to manipulate the mysql data directly.  My concern with this approach is that I don't fully understand the schema and am concerned that manipulating it outside of kbengine might make the data unusable to KBE (ie: the game client might not be able to login after I modify the tables).  Also, I know that KBE doesn't always interact with the database, that a lot of components keep data in memory and only update the database occasionally.  Thus I am concerned that direct changes to the backend DB might result in data synchronization issues.

Thoughts?
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-6 02:19:19 | 显示全部楼层
It looks like many of the features I'm looking for are already part of the built-in email registration and http_cb_handler.cpp code, so there is some sort of precedence for what I am attempting to accomplish.  I may be able to simply put a web front-end on the http_cb_handler interface, although the API it exposes does not seem to be documented.
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-6 13:21:51 | 显示全部楼层
Cezero 发表于 2016-2-5 22:45
This is massive overkill for what I want to do from the web interface.

I do not want a "game client ...

Through a page to modify(Directly modify the database) the email and password is no problem.
They are stored in the KBE account table (kbe_accountinfos), this part of the data will not be covered by the game regularly archived.

Create an account: also can be through the web page to MySQL written directly, kbe_accountinfos and tbl_account table, but tbl_account form may according to need to play the game often change, so static write table needs to know how to use the correct form structure field.

Read the game: through the web page to read the game data, such as: (charts, friends,...)
You can do the work regularly in the game, and ultimately through the web page to read the database directly.
In V0.8 framework has been supported mount 65535 different database (MySQL and redis,...), but the redis support is not complete, can be in the future, some data into redis, and read through the web page.

And a method can support read and write data, in KBEngine script (Python), create a socket, through KBEngine.registerReadFileDescriptor KBEngine.registerWriteFileDescriptor to read and write data, reference: http://bbs.kbengine.org/forum.ph ... &extra=page%3D3

热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-6 13:24:28 | 显示全部楼层
If you need more functionality, you can only communicate directly with the engine and extend the C++.
C++ extension is not a document,  I am sorry!
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-6 13:28:15 | 显示全部楼层
Cezero 发表于 2016-2-6 02:19
It looks like many of the features I'm looking for are already part of the built-in email registrati ...

Http_cb_handler currently only complete limited functionality, such as: email activation, password recovery.
If you have the help you can use, if you need more, you need to expand.
Only the code does not have documents :)
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-6 21:08:52 | 显示全部楼层
Given how new I am to kbengine, I'm avoiding changes to the source for now, although I am sure at some point I'll have to extend it :)

Concerns I have with manipulating kbe_accountinfos table directly are around the fields entityDBID, bindata and flags.

entityDBID: Is this just a unique number?  When creating a new account, can I set it to whatever I like as along as it's unique?
flags: what are these?  Is there an enum or bitfield in the code somewhere I can reference?
bindata: what is this used for, if anything?

Thank you!
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-7 00:32:50 | 显示全部楼层
Figured out flags, there is an enum:

  1. ./lib/common/common.h
  2. enum ACCOUNT_FLAGS
  3. {
  4.   ACCOUNT_FLAG_NORMAL = 0x00000000,
  5.   ACCOUNT_FLAG_LOCK = 0x000000001,
  6.   ACCOUNT_FLAG_NOT_ACTIVATED = 0x000000002
  7. };
复制代码


Looks like bindata is provided as a place for random binary data storage, so unless I want to use it, I can just leave it null.

So I was able to create an account with direct sql queries.  Figured out I had to add an entry to tbl_Account with a matching id to entity DBID for login to fully work.  This leads me to my next question:

I understand what all of the columns in tbl_Account are, as they directly map to the persistent properties defined in Account.def (ie: sm_lastSelectedCharacter is the field corresponding to the lastSelectedCharacter property in Account.def), however, there is one property that appears in the database even though it is not in the .def file: sm_autoLoad.

What does this property do, and what are valid values for it?

Thank you!
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-7 13:18:46 | 显示全部楼层
EntityDBID refers to the Account(entity) in the tbl_Account table in the ID. Can not easily fill.


bindata : bindata custom binary data submitted by the client when the account is registered. (Reference: byte[] datas, in https://github.com/kbengine/kben ... r/KBEngine.cs#L1244)
  1.                 public void createAccount(string username, string password, byte[] datas)
  2.                 {
  3.                         KBEngineApp.app.username = username;
  4.                         KBEngineApp.app.password = password;
  5.                         KBEngineApp.app._clientdatas = datas;
  6.                        
  7.                         KBEngineApp.app.createAccount_loginapp(true);
  8.                 }
复制代码

热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-7 13:24:20 | 显示全部楼层
Cezero 发表于 2016-2-7 00:32
Figured out flags, there is an enum:

Entity contains some default archive properties, such as: position, direction, autoload.
tbl_autoload by API: "def writeToDB(.., autoload=false)" to set up, if true, then the next server starts, the entity will be automatically loaded from the database by the engine to the memory.
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

4

主题

20

帖子

96

积分

注册会员

Rank: 2

积分
96
 楼主| 发表于 2016-2-7 13:29:25 | 显示全部楼层
Excellent, so for Account, I'll want to keep sm_autoLoad false.
回复

使用道具 举报

30

主题

7138

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
16457
QQ
发表于 2016-2-7 14:59:08 | 显示全部楼层
Yes, the account should be false, when writing SQL, set to false.
热爱游戏、热爱开源!
柯标
3603661@qq.com

柯标
3603661@qq.com
回复

使用道具 举报

10

主题

39

帖子

171

积分

注册会员

Rank: 2

积分
171
发表于 2016-11-30 17:21:09 | 显示全部楼层
诶诶诶? 我咋感觉来错地方了
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2017-5-15 14:08:18 | 显示全部楼层
You get a lot done on the Internet, and that means you probably have a lot of accounts on many different websites.  But did you know that if you use the same password on every website or almost use the same password and change it a little bit for each site you’re more vulnerable to a cyber attack. Because if just one of these websites gets broken into, thieves can get ahold of the passwords of everyone on that site and can use them to break into accounts on other sites.You can use the Best Password Manager App
to manage your passwords safely.Password Manager App
is program you can download for your phone or computer that will create, store, and even automatically fill in unique passwords on websites and other online services.

[url=http://www.passwordmanagers.net/][/url]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|KBEngine Forum

GMT+8, 2018-12-10 18:31 , Processed in 0.039155 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表