JQuery/PHP 聊天客户端帮助
我在 CSS-Tricks 上发现了这个很酷的聊天教程。 (http://css-tricks.com/chat2/)
我正在尝试使用它。每次我运行它时,当它在聊天室询问时,我都会输入我的名字。它只是显示了这段代码:
Great! You found a username not in use"; $data['inuse'] = "notinuse"; } else { $data['result'] = "
That username is already in use. (Usernames take 2 minutes without use to expire)
"; $data['inuse'] = "inuse"; } echo json_encode($data); } } else { $username = cleanInput($_POST['userid']); if (checkVar($username)) { $getUsers = "SELECT * FROM chat_users WHERE username = '$username'"; if (!hasData($getUsers)) { $now = time(); $postUsers = "INSERT INTO `chat_users` ( `id` , `username` , `status` , `time_mod` ) VALUES ( NULL , '$username', '1', '$now' )"; mysql_query($postUsers); $_SESSION['userid'] = $username; header('Location: ./chatrooms.php'); } else { header('Location: ./?error=1'); } } } ?>
我想知道问题可能是什么。随机的,但这可能对其他人有帮助:c)
请记住,我爱你们!
I found this cool Chat tutorial on CSS-Tricks.
(http://css-tricks.com/chat2/)
I am trying to use it however. Everytime I run it, and I enter my name when it asks in the chat room. It just shows this code:
Great! You found a username not in use"; $data['inuse'] = "notinuse"; } else { $data['result'] = "
That username is already in use. (Usernames take 2 minutes without use to expire)
"; $data['inuse'] = "inuse"; } echo json_encode($data); } } else { $username = cleanInput($_POST['userid']); if (checkVar($username)) { $getUsers = "SELECT * FROM chat_users WHERE username = '$username'"; if (!hasData($getUsers)) { $now = time(); $postUsers = "INSERT INTO `chat_users` ( `id` , `username` , `status` , `time_mod` ) VALUES ( NULL , '$username', '1', '$now' )"; mysql_query($postUsers); $_SESSION['userid'] = $username; header('Location: ./chatrooms.php'); } else { header('Location: ./?error=1'); } } } ?>
I wonder what the issue could be. Random, but this may help someone else :c)
And remember, I love you guys!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,您能够看到 PHP 代码,表明 PHP 并未处理该特定文件,只是以纯 HTML 形式发送该文件。可能是您的服务器配置错误,您无法运行 PHP 脚本,或者该文件的扩展名与 PHP 无关。
其他原因可能是脚本的文件权限错误,一般这些权限必须设置为0755。
The fact that you are able to see the PHP code indicates this particular file is not being processed by PHP, just sending the file as plain HTML. It may be that your server is misconfigured and you cannot run PHP scripts, or the file has an extension not associated with PHP.
Other reason may be that the file permissions of the script are wrong, generally these permissions must be set to 0755.