Jump to content

Recommended Posts

I have a website that i integrate a chat app into it (FREICHAT ) now i wanted to make the user that log in to my the site to chat with user name, according to freichat this idea is 100% possible and they have solution for it. I have done all the want me to do but it is not working, so i came meet my gurus to please help me out below are my code.

<?php
$ses = null; // Return null if user is not logged in 
 
if(isset($_SESSION['username']))
{ 
  if($_SESSION['username'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['username']; //LOOK, now userid will be passed to FreiChat 
  } 
} 
 
if(!function_exists("FreiChatx_get_hash"))
{ 
  function FreiChatx_get_hash($ses){//And the rest of the code as it is . .
 

       if(is_file("C:/wamp/www/Dagogo_temp/freichat/hardcode.php")){

               require "C:/wamp/www/Dagogo_temp/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="http://localhost/Dagogo_temp/freichat/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>                        
	<link rel="stylesheet" href="http://localhost/Dagogo_temp/freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css">
<!--===========================FreiChatX=======END=========================--> 

the next file i change is the hardcore.php

<?php
/* Data base details */
$con = 'mysql'; // MySQL , Oracle , SQLite , PostgreSQL
$username='root'; // Database username
$password=''; //Database password
$client_db_name='online'; //Database name
$host='localhost'; //host
$port=''; //optional port for some servers using different port
$driver='Custom'; //Integration driver
$db_prefix=''; //prefix used for tables in database
$uid='52b2c4244f15f'; //Any random unique number

$PATH = 'freichat/'; // Use this only if you have placed the freichat folder somewhere else
$installed=true; //make it false if you want to reinstall freichat
$admin_pswd='adminpass'; //backend password 

$debug = false;

/* email plugin */
$smtp_username = '';
$smtp_password = '';



/* Custom driver */
$usertable='users'; //specifies the name of the table in which your user information is stored.
$row_username='username'; //specifies the name of the field in which the user's name/display name is stored.
$row_userid='id'; //specifies the name of the field in which the user's id is stored (usually id or userid)
$avatar_field_name = 'avatar';

Please help me out

Link to comment
https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/
Share on other sites

Is not working at all i add  the session start

<?php
session_start();
$ses = null; // Return null if user is not logged in 
 
if(isset($_SESSION['username']))
{ 
  if($_SESSION['username'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['username']; //LOOK, now userid will be passed to FreiChat 
  } 
} 
 
if(!function_exists("FreiChatx_get_hash"))
{ 
  function FreiChatx_get_hash($ses){//And the rest of the code as it is . .
 

       if(is_file("C:/wamp/www/Dagogo_temp/freichat/hardcode.php")){

               require "C:/wamp/www/Dagogo_temp/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="http://localhost/Dagogo_temp/freichat/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>                        
	<link rel="stylesheet" href="http://localhost/Dagogo_temp/freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css">
<!--===========================FreiChatX=======END=========================-->

freichat requires the users id not their username!

 

The three steps you need to do are listed in the wiki

 

 

Integrating FreiChat with any site involves three simple steps:
  • Get the ID of the logged in user.
  • Pass that ID to FreiChat.
  • Tell FreiChat the name of the “user table” along with some details.

I have done that create a session with the id and nothing is working code

<?php
$ses = null;

if(isset($_SESSION['id']))
{ 
  if($_SESSION['id'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['id']; //LOOK, now userid will be passed to FreiChat 
  } 
} 
 
if(!function_exists("FreiChatx_get_hash"))
{ 
  function FreiChatx_get_hash($ses){//And the rest of the code as it is . .
 

       if(is_file("C:/wamp/www/Dagogo_temp/freichat/hardcode.php")){

               require "C:/wamp/www/Dagogo_temp/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="http://localhost/Dagogo_temp/freichat/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>                        
	<link rel="stylesheet" href="http://localhost/Dagogo_temp/freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css">
Edited by IlaminiAyebatonyeDagogo
  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.