IlaminiAyebatonyeDagogo Posted December 19, 2013 Share Posted December 19, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/ Share on other sites More sharing options...
paddy_fields Posted December 19, 2013 Share Posted December 19, 2013 You need to start the session at the beginning of the code. session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462729 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted December 19, 2013 Author Share Posted December 19, 2013 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=========================--> Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462732 Share on other sites More sharing options...
Ch0cu3r Posted December 19, 2013 Share Posted December 19, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462733 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted December 19, 2013 Author Share Posted December 19, 2013 so i av to create a session with the id ryt Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462735 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted December 19, 2013 Author Share Posted December 19, 2013 (edited) 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 December 19, 2013 by IlaminiAyebatonyeDagogo Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462736 Share on other sites More sharing options...
Ch0cu3r Posted December 19, 2013 Share Posted December 19, 2013 When the user logs in does your website login code set the users id to the $_SESSION['id'] variable? Also as paddyfields said you must call session_start() in order for the $_SESSION data to persist. Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1462744 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted December 29, 2013 Author Share Posted December 29, 2013 yes 2 all i pass the user sesion with the var session id and i declare a session start Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463213 Share on other sites More sharing options...
davidannis Posted December 29, 2013 Share Posted December 29, 2013 i declare a session start Not in the code you posted. <?php $ses = null; You need to to have the session_start() at the top of every page that uses the $_SESSION data. Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463215 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted January 2, 2014 Author Share Posted January 2, 2014 it is working except for the user using chrome browser. Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463588 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted January 2, 2014 Author Share Posted January 2, 2014 thanks all it z working perfectly well Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463589 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted January 2, 2014 Author Share Posted January 2, 2014 thanks all it z working perfectly well cn u teach hw to remove the powered by codologic Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463590 Share on other sites More sharing options...
IlaminiAyebatonyeDagogo Posted January 2, 2014 Author Share Posted January 2, 2014 av any 1 eva remove powered by codologic in freichat plz show me how did it Quote Link to comment https://forums.phpfreaks.com/topic/284847-not-get-session-in-my-chat-apps/#findComment-1463595 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.