EpicGlobalWeb
New member
- Joined
- Jan 24, 2016
- Messages
- 467
- Points
- 0
When your code isn't working right but there's no error and you spend so much time looking for a major code malfunction and then all of a sudden realize 40 billion years later that it's just a missing ";" or " ' "?
I just did. I feel stupid how often this happens to me LOL!
Here was the real in-depth problem though:
Background: I'm building a custom CMS. Part of its function is to create new files (site pages) based on form input, and display a "thumbnail" of some of the content on another "gateway" page.
During testing, I entered the page content I wanted. It turns out that PHP doesn't like single quotes very well. So in a nutshell it was really a sanitize problem. A noobie mistake, I know.
Anyway the form is handled by two prime functions:
1. Insert form data (in this case a blog post) into a database.
2. Write a new page (fwrite a string of text).
So the issue was basically that I had to use addslashes when putting it into the database, then stripslashes when writing it on the file.
This took me a f***ing hour to find LOL!
I just did. I feel stupid how often this happens to me LOL!
Here was the real in-depth problem though:
Background: I'm building a custom CMS. Part of its function is to create new files (site pages) based on form input, and display a "thumbnail" of some of the content on another "gateway" page.
During testing, I entered the page content I wanted. It turns out that PHP doesn't like single quotes very well. So in a nutshell it was really a sanitize problem. A noobie mistake, I know.
Anyway the form is handled by two prime functions:
1. Insert form data (in this case a blog post) into a database.
2. Write a new page (fwrite a string of text).
So the issue was basically that I had to use addslashes when putting it into the database, then stripslashes when writing it on the file.
This took me a f***ing hour to find LOL!