我已经建立了自己的小型社交网站。最近,我添加了freichat聊天脚本。现在,当用户登录到我的网站时,我很困惑,我看不到他/她的名字,这让他/她的名字叫做“ Guest102”等等。
我不明白请帮忙,我想显示他们的名字不是客人等等...请帮忙。
我的loginin.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>
最佳答案
Freichat通过在其php脚本中使用随机函数来生成来宾名称。
从用户那里接收用户名和密码,并将用户名存储在会话中,
$ _SESSION [“ name”] = $ userid;
打开服务器目录中的freichat.php,并添加此代码。
$ custom_gst_name = $ _SESSION ['name']; //来自会话的用户名,注释先前的分配
将显示用户输入的登录ID,而不是访客。