A few suggestions....
1) Use PDO for your database communications. If you don't switch to PDO I would STRONGLY suggest properly sanitizing and escaping the info you put into the database. Depending on the values sent in you could have some issues.
2) Don't extract $_POST into the script. Doing this is considered a bad idea. Someone could post a variable you aren't expecting and mess up your script.
Now, what does the source of the printed MOTD look like? Not just how it's displayed on the screen.
$_Post is the way i know how to do things,
Please forgive my ignorance but what is PDO, I'm used to doing things a certain way, thats how I've always done them, I might have to find a good book on PDO
if your used to irc, there is a MOTD when you first enter the network on your status bar,
this is an example of one and how it looks formated a small part of it.
essage of the Day, irc.IRC.net
-
- 23/1/2009 18:24
- is the last built date of this server.
-
- IRC.irc.NET - IRC IRC Network
- ======================================
-
- Location: New York, NY
-
- ======================================================
- Owner:
- kind
-
- Admin:
- ReZNiC
- BlueFire
-
- Co-Admin(s):
- DragonFlu
-
- Newnet Core Administrator(s):
- ReZNiC
- Kevin
this is how mine is coming
Welcome To Irc.irc.com - - Thanks For Using My Server To Connect With Your Friends. Please Behave And Have A - Great Time. - let us all pray that tyler returns quick - Suggested Channels: - ************************************ - #Services - Services and General Help Channel. - #Help - IRC's Help Channel - #Idle-Chat - General Idle Chat. - #Beginners - IRC Beginner Help Channel. - #vhost - For Help With HostServ. - #IRC - Server Channel. - ************************************ - ***** Admins ***** - - DavMathew - Trackker122 - krashking - - ***** Opers
its taking out all the spaces on me :/
PDO is a php abstraction layer for dealing with db's. It's just really nice and help prevent people hacking your db. But you can sanitize all your insert variables to prevent someone from deleting your entire db.
Try using nl2br before inserting into your db. That way you convert the line breaks into html br's.
You could also use explode to split the string on "-" or use str_replace to swap the "-" with "br>-".
I have an admin page,
I use a page to copy and paist an IRCd MOTD into a dbase
and its formatting (lines and spaces all go in fine and it looks right)
now I go to the actual site, where i made simple code to have it to display the MOTD
But it's lost the formatting
I'll show you a simple version of what ive done for the admin pages
motd.php
motdp.php
between those 2 pages,
in motd.php in the admin page any ways, the formating is right, the lines are one after the other and it looks right
now here is the regular motd.php
And on this page the MOTD comes out all jumbeled together with no formatting, I can't figure out what i've missed.