This topic is locked
[SOLVED]

 help with setting chat

3/20/2020 10:06:48 AM
PHPRunner General questions
C
cristi author

I try to include freichat in the phprunner application.

Anyone here tried this before?

I used their documentation here

I enable debug in the admin backed and in the google developer tools there is no error: "FreiChatX script initiated (17)"

The script asks for a session with userid which is implemented and checked that is O.K. - I ran an echo on the page...

I try to display the chat on the list page with empty table and I need to add a piece of code:

<!--===========================FreiChat=======START=========================-->

<!-- For uninstalling ME , first remove/comment all FreiChat related code i.e below code

Then remove FreiChat tables frei_session & frei_chat if necessary

The best/recommended way is using the module for installation -->
<?php

$ses=null;
if(!function_exists("freichatx_get_hash")){

function freichatx_get_hash($ses){
if(is_file("/var/www/chat/freichat/hardcode.php")){
require "/var/www/chat/freichat/hardcode.php";
$temp_id = $ses . $uid;
return md5($temp_id);
}

else

{

echo "<script>alert('module freichatx says: hardcode.php file not found!');</script>";

}
return 0;

}

}

?>

<script type="text/javascript" language="javascipt" src="https://heras.geoecomar.ro/chat/freichat/client/main.php?id=<?php'>https://heras.geoecomar.ro/chat/freichat/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>

<link rel="stylesheet" href="https://heras.geoecomar.ro/chat/freichat/client/jquery/freichat_themes/freichatcss.php"'>https://heras.geoecomar.ro/chat/freichat/client/jquery/freichat_themes/freichatcss.php"; type="text/css">

<!--===========================FreiChatX=======END=========================-->


Now, I added the code as follows:
In the headers.htm I inserted:

<script type="text/javascript" language="javascipt" src="https://heras.geoecomar.ro/chat/freichat/client/main.php?id=<?php'>https://heras.geoecomar.ro/chat/freichat/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>

<link rel="stylesheet" href="https://heras.geoecomar.ro/chat/freichat/client/jquery/freichat_themes/freichatcss.php"'>https://heras.geoecomar.ro/chat/freichat/client/jquery/freichat_themes/freichatcss.php"; type="text/css">


Rest of the code I added as a code snippet on the list page with $_SESSION['userid'] getting the value in an after successful login event...

echo $_SESSION["userid"];

$ses=null;

if(isset($_SESSION['userid']))

{

if($_SESSION['userid'] != null) // Here null is guest

{

$ses=$_SESSION['userid']; //LOOK, now userid will be passed to FreiChat
}

}



if(!function_exists("FreiChat_get_hash"))

{

function FreiChat_get_hash($ses){
if(is_file("/var/www/chat/freichat/hardcode.php")){
require "/var/www/chat/freichat/hardcode.php";
$temp_id = $ses . $uid;
return md5($temp_id);
}

else

{

echo "<script>alert('module freichatx says: hardcode.php file not found!');</script>";

}
return 0;

}

}


The problem is that the chat script runs but it is getting no users even if the Users table added with phprunner is visible in the chat administration backed...

Admin 3/20/2020

I'm not familiar with firechat but $_SESSION['userid'] doesn't look right, should be $_SESSION['UserID']

C
cristi author 3/21/2020



I'm not familiar with firechat but $_SESSION['userid'] doesn't look right, should be $_SESSION['UserID']


Of course!!!

You're the man - as always.

Thank you!

It works now although I am now more inclined towards Firebase chat because it offers authentication with JWT - already implemented in phprunner.

need2sleepDevClub member 3/31/2020

Sounds like an interesting idea. Looks like an integrated chat. Seems sketchy though. Site has expired certificates. Broken links, broken English. Can you trust it?
I was thinking of implementing something like this for customers to chat with sales reps. Do you have any luck with this snipped? Is it secure and simple to setup?

C
cristi author 4/2/2020



Sounds like an interesting idea. Looks like an integrated chat. Seems sketchy though. Site has expired certificates. Broken links, broken English. Can you trust it?
I was thinking of implementing something like this for customers to chat with sales reps. Do you have any luck with this snipped? Is it secure and simple to setup?


It was simple and it is running on my site for some time now without problems - I like the fact that integrates with phprunner generated script users - so anyone registered on the site is automatically registered as a user in the chat - two bugs however:

  1. the user authentication is by session and it is not always transmitted by the php snippet to the chat system - resolved by defining the session in the php file responsible with initiating the chat.
  2. files send between users - the same problem with sessions and because of this the upload control was sometimes blank page
    I wanted a chat script that was free, integrated with my already defined users in the database and allowed file uploads and after many testing this script was the one that satisfied my requirements the best.

    Here is their docs page.
    If you need help contact me on pm.

need2sleepDevClub member 4/2/2020



It was simple and it is running on my site for some time now without problems - I like the fact that integrates with phprunner generated script users - so anyone registered on the site is automatically registered as a user in the chat - two bugs however:

  1. the user authentication is by session and it is not always transmitted by the php snippet to the chat system - resolved by defining the session in the php file responsible with initiating the chat.
  2. files send between users - the same problem with sessions and because of this the upload control was sometimes blank page
    I wanted a chat script that was free, integrated with my already defined users in the database and allowed file uploads and after many testing this script was the one that satisfied my requirements the best.

    Here is their docs page.
    If you need help contact me on pm.


cool thanks for the information