Help - Search - Members - Calendar
Full Version: Private Messageing System
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Brandon
Hi everyone

I have been trying to do a PMS and I have found a tutorial Here but when I go through it I get stuff like this all over the page
CODE
Inbox.php
"; } else { //Get your private message count //Find the percentage that your inbox is full $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$users'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; $percent = $pm_count/'50'; $percent = $percent * '100'; ?>


CODE
Sent.php
"; } else { //Get your private message count $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; $percent = $pm_count/'50'; $percent = $percent * '100'; ?>


CODE
Compose.php
$error
"; } //There are no errors so far which means the form is completely filled out else { //Are the trying to send a message to a real user or to something they just made up? $user_check = mysql_query("SELECT username FROM users WHERE username='$reciever'"); $user_check = mysql_num_rows($user_check); //The user is real and not made up if this is true if($user_check > '0') { //There might already be a sessioned time variable, if so we need to get it for the flood check $time = $_SESSION['time']; //If there is a time variable already, set it to the varialbe $old_time if($time > '0') { $old_time = $time; } //Here we get the minutes and seconds on the server time using the date function, and set that to the $time variable //Now we find the difference between this time ($time) and the time that the page was submitted ($old_time) $time = date('is'); $difference = $time - $old_time; $_SESSION['time'] = $time; //If the two times have a difference greater or equal to 15, which is 15 seconds, they can submit the message, this is for flood protection if($difference >= '15') { //Get their private message count $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$reciever'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; //You cant have more than 50 private messages, if they try sending a message to a user with a full inbox return an error message if(pm_count == '50') { $error = 'The user you are trying to send a message to has 50 private messages, sorry but we cant send your message untill that user deletes some of their messages.'; } else { //And not we stick the message in the database with all the correct information mysql_query("INSERT INTO messages (reciever, sender, subject, message) VALUES('$reciever', '$user', '$subject', '$message')") or die (mysql_error()); } //Let the user know everything went ok. echo "
You have successfully sent a private message!
"; } //Since they are trying to send messages faster than every 15 seconds, give them an error message else { $error = 'You must wait 15 seconds before sending another private message'; } } //If they mis spelled or, made up a username, then give an error message telling them its wrong. else { $error = 'That username does not exist, please try again. Remember to check your spelling, and don't make stuff up at random.'; } } } //Since we may have set the error variable to something while trying to send the messae, we need another error check if($error != '0') { echo "
$error


And it just doesn't want to work for me please could someone give me a hand with this ?
Sorry Just added some more

Thank You In Advanced
Crown
akzuma
is that stuff appearing in your browser? if so, it looks like you've misplaced some quotation marks. can you post you're actual code?
Banjo
QUOTE
is that stuff appearing in your browser? if so, it looks like you've misplaced some quotation marks. can you post you're actual code?


He said hes following a tutorial so you can see the code here http://www.egmods.com/Main/Tutorials/php/intermediate/pms/
instead of waiting for him to post it.

Also if that pm system is no good there is a different tutorial for one here

http://www.phpfreaks.com/tutorials/148/0.php

Tom
Seems your code isn't parsing as PHP. Where are you running this?
Brandon
QUOTE(Tom @ Jan 10 2008, 08:48 PM) *
Seems your code isn't parsing as PHP. Where are you running this?

on my localhost
Diogo
Its PHP but there are some "//" ignored lines and it seems to be compressed or dunno what, you should to separate the code or some PHP code lines wont run and will return errors.
GoldenLegacy
Did You Add

CODE
<php --Code Here-- ?>
IamShipon1988
That coding system you saw at that link isn't that great...many had reported before that it did not work well for them. I really don't have time to check your code but I would look for calling of phrases and files.

GoldenLegacy, you're missing a question mark in your code
CODE
<?php I WILL RULE THE WORLD ?>
uncled1023
i am using the same tutorial and it is finally working for me.
Adam
@ Crown:

Please tell me you included <?php and ?>

-___-
Brandon
QUOTE(Adam @ Mar 8 2008, 02:34 PM) *
@ Crown:

Please tell me you included <?php and ?>

-___-

Indeed i did

QUOTE(uncled1023 @ Mar 4 2008, 03:54 AM) *
i am using the same tutorial and it is finally working for me.

Oh ... How did you do it ?:S
uncled1023
ill be posting a tutorial on it with it integrating my users system tutorial... whenever i get the time though..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.