Jump to content

Switched servers... now functionality lost. Same PHP version & MySQL version


Recommended Posts

I posted this on the MySQL forum, then started thinking maybe something's going wrong in the PHP... I'm stuck!!!

 

I switched servers recently and moved one database over. The MySQL versions & PHP are the same.

 

It runs a backend simple CMS.

 

Basically now, if I go in and edit a page using the WYSIWYG editor, it will not record anything that is cut and pasted from Notepad.

 

However, if I type it in manually, it will.

 

Any thoughts what could be different with the PHP or database to record text that is typed, but not text pasted from Notepad.

 

On the other server, it works fine.

Ok. Wait!

 

Did some more testing. It's not when I paste from Notepad actually.

 

It stalls out and doesn't post anything to the database when I have a word that has a " ' " in it. Is that something I need to with the PHP or the MySQL database?

You need to add mysql_real_escape_string to the string input going into the DB.

 

The reason it worked on your old server, was chances are it had "Magic Quotes" (see this function for more information/links to more information)  get_magic_quotes_gpc turned on. The new server does not, which is the better/preferred way for them to be turned off.

 

Fix the code and it will work.

 

EDIT:

Added the "string" portion to the above :P thanks PFM for reminding of that lol!

Edit: basically the same info as above ^^^

 

All data put into a query that contains special characters, like a ' or " needs to be escaped so that it does not break the query (or allow sql injection.)

 

Your code does not have any logic to do this and was probably relying on the magic_quotes_gpc setting to do this for you. magic_quotes_gpc is depreciated, turned off by default when using recommend php.ini settings and has been removed in php6.

 

You need to use the mysql_real_escape_string function on any string data that is put into a query.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.