FreiChat related discussions
Deactivate chat history saving in database

Hi all!, I have been installed successfuly freichat in my site and everything works as spected, but i want to deactivate the chat history saving in db. I dont want to register any conversation. I try modifying arg.php but the chat history still saving in bd. What can I do?

Regards,
JM

Hi all!, I have been installed successfuly freichat in my site and everything works as spected, but i want to deactivate the chat history saving in db. I dont want to register any conversation. I try modifying arg.php but the chat history still saving in bd. What can I do? Regards, JM

But if you completely disable chathistory , then the messages wont be
persistent while surfing on your website .

I mean everytime you load any page all your messages would be deleted
since the chathistory is not saved .
Do you really want that ?

But if you completely disable chathistory , then the messages wont be persistent while surfing on your website . I mean everytime you load any page all your messages would be deleted since the chathistory is not saved . Do you really want that ?
Necessity is the mother of all inventions!

Not exactly. I would like to have a chat history persisted in session, but i dont want that my dba can read all the messages in the chat. The people of the site dont trust in the chat system because they have afraid that someone else can read they messages. And the fact is that is happening. So i need some way to encrypt o do something for avoid that effect and demonstrate that anyone else can read they messages! understand me? (My english isn't as effective like i want)

Regards,
JM

Not exactly. I would like to have a chat history persisted in session, but i dont want that my dba can read all the messages in the chat. The people of the site dont trust in the chat system because they have afraid that someone else can read they messages. And the fact is that is happening. So i need some way to encrypt o do something for avoid that effect and demonstrate that anyone else can read they messages! understand me? (My english isn't as effective like i want) Regards, JM

Well, I started to modified the code to encrypt the message before they were inserting in DB and decrypt them whem they are selecting from de DB.

I change the function post_mess in server/freichat.php:

if ($_POST['message_type'] == 'normal' || $_POST['message_type'] == 1) {
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $to, $to_name, $encrypted_mesg, $time, $message_type, '-1'));
} else {
//$chatroom_mesg_time = $time;
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $room_id, $room_id, $encrypted_mesg, $time, $message_type, $room_id));
}


With the above code i could save the messages encrypted, but now I need to decrypt them but I can find the point of code to make that. If some freichat developer read this post, could you tell me where I can get the message from the DB and then decrypt it.

I am using the single chat, not chatrooms.

Regards,
JM

Well, I started to modified the code to encrypt the message before they were inserting in DB and decrypt them whem they are selecting from de DB. I change the function post_mess in server/freichat.php: <code> if ($_POST['message_type'] == 'normal' || $_POST['message_type'] == 1) { $chatroom_mesg_time = $_POST['chatroom_mesg_time']; $encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key)))); $insert_mesg_query->execute(array($frm_id, $usr_name, $to, $to_name, $encrypted_mesg, $time, $message_type, '-1')); } else { //$chatroom_mesg_time = $time; $chatroom_mesg_time = $_POST['chatroom_mesg_time']; $encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key)))); $insert_mesg_query->execute(array($frm_id, $usr_name, $room_id, $room_id, $encrypted_mesg, $time, $message_type, $room_id)); } </code> With the above code i could save the messages encrypted, but now I need to decrypt them but I can find the point of code to make that. If some freichat developer read this post, could you tell me where I can get the message from the DB and then decrypt it. I am using the single chat, not chatrooms. Regards, JM

find the function named as get_messages().
it returns an array of messages, just loop through the messages and decrypt them.

find the function named as get_messages(). it returns an array of messages, just loop through the messages and decrypt them.
Necessity is the mother of all inventions!

Ok, I added this to the function:

foreach($result as $row){
$row[5] = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($row[5]), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
}

But nothing happens!

Any ideas?

Ok, I added this to the function: foreach($result as $row){ $row[5] = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($row[5]), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); } But nothing happens! Any ideas?

it should have worked.
try

$row['message'] instead of $row[5];

it should have worked. try <code> $row['message'] instead of $row[5]; </code>
Necessity is the mother of all inventions!

Well, I made it works! But now, when I refresh the page all sending message are show encrypted. I suppose that is because i must to do the same in another method, but which? I am so newbie with PHP!! hahaha!

Another thing, I am think in delete all messages sent between two user when the user close it session. I could see that the session is managed in database, so I suppose that the event of closing the session is handled in some place. Where is that?

If someone else is interested in that feature I could send the code with the new features. Obviously, those new features must be configure-ables.

Regards!
JM

Well, I made it works! But now, when I refresh the page all sending message are show encrypted. I suppose that is because i must to do the same in another method, but which? I am so newbie with PHP!! hahaha! Another thing, I am think in delete all messages sent between two user when the user close it session. I could see that the session is managed in database, so I suppose that the event of closing the session is handled in some place. Where is that? If someone else is interested in that feature I could send the code with the new features. Obviously, those new features must be configure-ables. Regards! JM
87
7
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft