我已经建立了自己的小型社交网站。最近我添加了一个freichat聊天脚本。现在,当用户登录我的网站时,我感到很困惑,我看不到他/她的名字,而是将他/她命名为" Guest102"等等等等。
我没理解这一点。请帮忙我想显示他们的名字而不是客人等等......请帮助。
我的 loggedin.php 代码:
<!-- if you need user information, just put them into the $_SESSION variable and output them here -->
<!DOCTYPE html>
<html>
<head>
<!--===========================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("C:/Users/Raj/PhpstormProjects/socialnetworking1/chat system/hardcode.php")){
require "C:/Users/Raj/PhpstormProjects/socialnetworking1/chat system/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:63342/socialnetworking1/chat system/client/main.php?id=<?php echo $ses;?>&xhash=<?php echo freichatx_get_hash($ses); ?>"></script>
<link rel="stylesheet" href="http://localhost:63342/socialnetworking1/chat system/client/jquery/freichat_themes/freichatcss.php" type="text/css">
<!--===========================FreiChatX=======END=========================-->
<title>Maiit kota-rajasthan</title>
</head>
<style>
body{
background-color: #D0D0D0;
}
#menu_header{
position: fixed;
top: 0%;
left: 0%;
right: 0%;
height: 5%;
background-color: black;
}
#right_box{
position: fixed;
width: 20%;
right: 0%;
top: 6%;
height: 93%;
background-color: white;
font-family: "Segoe UI Light";
-webkit-box-shadow: 0px 1px 30px 0px rgba(50, 50, 50, 0.33);
-moz-box-shadow: 0px 1px 30px 0px rgba(50, 50, 50, 0.33);
box-shadow: 0px 1px 30px 0px rgba(50, 50, 50, 0.33);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
</style>
<body>
<div id="menu_header">
</div>
<div id="right_box">
<p style="text-align: center;">Today's Top faces</p><hr>
<a href="index.php?logout">Logout</a>
</div>
</body>
</html>
Hey, <?php echo $_SESSION['name'] ?>. You are logged in.
Try to close this browser tab and open it again. Still logged in! ;)
<!-- because people were asking: "index.php?logout" is just my simplified form of "index.php?logout=true" -->
<a href="index.php?logout">Logout</a>
答案 0 :(得分:0)
Freichat在其php脚本中使用随机函数生成访客名称。
从用户接收用户名和密码,并在会话中存储用户名, $ _SESSION [&#34;名称&#34;] = $用户ID;
打开服务器目录中的freichat.php,然后添加此代码。
$ custom_gst_name = $ _SESSION [&#39; name&#39;]; //来自会话的用户名,评论以前的作业
将显示用户输入的登录ID而不是来宾。
答案 1 :(得分:0)
转到freichat / hadcore.php 编辑以下内容以适合您的数据库以及表和表列, / *自定义驱动程序* /
$用户表=&#39;用户&#39 ;; //指定存储用户信息的表的名称。
$ row_username =&#39;名称&#39 ;; //指定存储用户姓名/显示名称的字段的名称。
$ row_userid =&#39; ID&#39 ;; //指定存储用户ID的字段的名称(通常是id或userid)
请记住在安装时使用自定义配置