tags:

views:

107

answers:

1

Hello my friends. 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!

+2  A: 

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.

Ast Derek