JQuery/PHP 聊天客户端帮助

发布于 2024-09-13 10:20:38 字数 981 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半葬歌 2024-09-20 10:20:38

事实上,您能够看到 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文