mChat add message
Forum rules
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
Ok, great. I'll set up a test site. phpBB 3.0 or 3.1?
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
Now it's up, sorry for the delay. That forum is only up temporarily and will be deleted as soon as your app is done or development stops for some other reason.
You will need to register.
You will need to register.
Code: Select all
mchat.dark-side.net
-
- Member
- Posts: 87
- Joined: 03 Apr 2011, 06:29
Re: mChat add message
ty, but i need to find how the autogenerate form_token is made..
maybe rich can help?
maybe rich can help?
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
deejay_xb wrote:maybe rich can help?
Hope so. I'll play around with the Android studio later to see if I can get the same result as mChat.
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: mChat add message
The form token is generated within the includes/functions.php file within the add_form_key function which is done within mchat.php file via add_form_key('mchat_posting');
-
- Member
- Posts: 87
- Joined: 03 Apr 2011, 06:29
Re: mChat add message
this is in functions.php
time() is current php time;
$token_sid = $user->session_id;
$form_name = 'mchat_posting';
so $token = sha1( time() $user->data['user_form_salt'] mchat_posting $user->session_id )
is this ok?
edit:
example:
time() = 1421591728
user_form_salt = 68cb19d150c03331
form_name = mchat_posting
user_session_id = 866c119c443d2828691acc126bb92291
token = 142159172868cb19d150c03331mchat_posting866c119c443d2828691acc126bb92291
correct or not?
Code: Select all
$now = time();
$token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : '';
$token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid);
time() is current php time;
$token_sid = $user->session_id;
$form_name = 'mchat_posting';
so $token = sha1( time() $user->data['user_form_salt'] mchat_posting $user->session_id )
is this ok?
edit:
example:
time() = 1421591728
user_form_salt = 68cb19d150c03331
form_name = mchat_posting
user_session_id = 866c119c443d2828691acc126bb92291
token = 142159172868cb19d150c03331mchat_posting866c119c443d2828691acc126bb92291
correct or not?
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
Ok, played a bit with this, here is what I found.
That makes $token_sid empty for logged in users. It only holds a value for guests. And the form name is mchat_posting.
This is the data needed to create the token.
Code: Select all
$token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : '';
That makes $token_sid empty for logged in users. It only holds a value for guests. And the form name is mchat_posting.
This is the data needed to create the token.
Code: Select all
$now = time();
$form_salt = $user->data['user_form_salt'];
$form_name = 'mchat_posting';
$token_sid = '';
$token = sha1($now . $form_salt . $form_name . $token_sid);
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
You will also need $config['form_token_lifetime']. If it's -1, then you don't need to bother with the form creation time. If not, you need to.
Code: Select all
$max = max(30, $config['form_token_lifetime']);
$diff = time() - abs($form_creation_time);
if ($diff <= $max) {
// Good to go.
} else {
// Form to old, need a new one.
}
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
@RMcGirr83: Do you have a non mini version of mchat_ajax_mini.js?
@deejay_xb: You really need to get the form token and form created time from mChat. The best would have been a API, but since the author didn't think about that you need to scrape it from the site.
@deejay_xb: You really need to get the form token and form created time from mChat. The best would have been a API, but since the author didn't think about that you need to scrape it from the site.
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: mChat add message
tumba25 wrote:@RMcGirr83: Do you have a non mini version of mchat_ajax_mini.js?
It is in the download of the mod within the contrib directory
- tumba25
- Past Contributor
- Posts: 1058
- Joined: 24 Oct 2007, 13:10
- Real name: Jari Kanerva
- Location: Kokkola, Finland.
Re: mChat add message
RMcGirr83 wrote:tumba25 wrote:@RMcGirr83: Do you have a non mini version of mchat_ajax_mini.js?
It is in the download of the mod within the contrib directory
So it is, thanks.
-
- Member
- Posts: 87
- Joined: 03 Apr 2011, 06:29
Re: mChat add message
ok so token is sha1('time''user_form_salt''mchat_posting')

and it seems that is correct:
and

and it seems that is correct:
Code: Select all
time() = 1421591728
user_form_salt = 68cb19d150c03331
form_name = postform
string = 142159172868cb19d150c03331mchat_posting
token = sha1(142159172868cb19d150c03331mchat_posting)
token = 379ad196d7b4b446d96b882f3ce231ddb50a90fc
and
Code: Select all
mchat autogenerated form_token = 379ad196d7b4b446d96b882f3ce231ddb50a90fc
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: mChat add message
The code you posted doesn't look anything like what tumba25 posted. Well it does but it isn't correct. Use what tumba25 posted.
-
- Member
- Posts: 87
- Joined: 03 Apr 2011, 06:29
Re: mChat add message
do i need something else because:
does not work.. it does nothing, no error, no message in mchat..
Code: Select all
http://www.gameforest.ro/mchat.php?mode=add&message=testdecacat2&addbbcode20=100&addbbcode_custom=%23&creation_time=1421350220&form_token=cc82c5c4493aa22shjewja6800618817930fe57
does not work.. it does nothing, no error, no message in mchat..
Return to “Modders MOD support”
Who is online
Users browsing this forum: Bing [Bot], CommonCrawl [Bot] and 0 guests