This is the session.php from my community where I have added Freichat. But users always be logged in as guest. The user session gives me the correct user id. I cannot find what is wrong.
<!--===========================Community=======START=========================-->
<?php $session_uid=$_SESSION['uid'];
// Session Private
if(!empty($session_uid))
{
$uid=$session_uid;
$login='1';
}
else if($_GET['username'] || $_GET['msgID'])
{
$uid=$Wall->User_ID($username);
$login='0';
}
else
{
$url=$base_url.'login.php';
header("location:$url");
}
?>
<!--===========================Community=======END=========================-->
<!--===========================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; // Return null if user is not logged in
if(isset($_SESSION['uid']))
{
if($_SESSION['uid'] != null) // Here null is guest
{
$ses=$_SESSION['uid']; //LOOK, now userid will be passed to FreiChat
setcookie("freichat_user", "LOGGED_IN", time()+3600, "/"); // *do not change -> freichat code
echo '<script type="text/javascript">alert("' . $ses . '")</script>';
} else {
$ses = null;
setcookie("freichat_user", null, time()+3600, "/"); // *do not change -> freichat code
}
}
if(!function_exists("freichatx_get_hash")){
function freichatx_get_hash($ses){
if(is_file("/websitename/httpd.www/freichat/hardcode.php")){
require "/websitename/httpd.www/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=".../freichat/client/main.php?id=<?php%20echo%20%24ses;?>&xhash=<?php%20echo%20freichatx_get_hash(%24ses);%20?>"></script><link rel="stylesheet" href=".../freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css"><!--===========================FreiChatX=======END=========================-->
This is the session.php from my community where I have added Freichat. But users always be logged in as guest. The user session gives me the correct user id. I cannot find what is wrong.
&lt;!--===========================Community=======START=========================--&gt;
&lt;?php
$session_uid=$_SESSION['uid'];
// Session Private
if(!empty($session_uid))
{
$uid=$session_uid;
$login='1';
}
else if($_GET['username'] || $_GET['msgID'])
{
$uid=$Wall-&gt;User_ID($username);
$login='0';
}
else
{
$url=$base_url.'login.php';
header("location:$url");
}
?&gt;
&lt;!--===========================Community=======END=========================--&gt;
&lt;!--===========================FreiChat=======START=========================--&gt;
&lt;!-- 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 --&gt;
&lt;?php
$ses = null; // Return null if user is not logged in
if(isset($_SESSION['uid']))
{
if($_SESSION['uid'] != null) // Here null is guest
{
$ses=$_SESSION['uid']; //LOOK, now userid will be passed to FreiChat
setcookie("freichat_user", "LOGGED_IN", time()+3600, "/"); // *do not change -&gt; freichat code
echo '&lt;script type="text/javascript"&gt;alert("' . $ses . '")&lt;/script&gt;';
} else {
$ses = null;
setcookie("freichat_user", null, time()+3600, "/"); // *do not change -&gt; freichat code
}
}
if(!function_exists("freichatx_get_hash")){
function freichatx_get_hash($ses){
if(is_file("/websitename/httpd.www/freichat/hardcode.php")){
require "/websitename/httpd.www/freichat/hardcode.php";
$temp_id = $ses . $uid;
return md5($temp_id);
}
else
{
echo "&lt;script&gt;alert('module freichatx says: hardcode.php file not
found!');&lt;/script&gt;";
}
return 0;
}
}
?&gt;
&lt;script type="text/javascript" language="javascipt" src=".../freichat/client/main.php?id=&lt;?php echo $ses;?&gt;&xhash=&lt;?php echo freichatx_get_hash($ses); ?&gt;"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href=".../freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css"&gt;
&lt;!--===========================FreiChatX=======END=========================--&gt;