August 10th, 2014, 08:03 AM
Take user supplied URLs and safely store them in my database
As the title suggest I'm trying to create a system that takes user supplied urls and stores them inside my database. Usually I try asking questions on stack overflow but have found them not all this helpfull when it comes to finding this particular soloution, with remarks such as "You are mixing up two different issues here: Security and validation for plausibility" which neither helps to solve my issues or explains where I may be going wrong.
How I see my system working
I have a form with 6 fields in which a user enters the required links, for their social network profile pages, this data then needs to be sanitized so that I can store it safely within my database. At the same time as sanitizing it I want to check against a certain pattern to ensure that the links provided are a) for the correct site B)/>/>/> in the correct format that I am looking for c) to help add another layer or security to my system.
Once the links have been sanitized and validated I can store them inside my database and then use them links on their profile page of my website.
What I have so far
So far I have a system that seems to half work, but I can not for the life of me work out where my issues lie. My system can take the six different URLs supplied and append them into one long key=value style string, but it seems that this string doesn't parse to my php code.
I'm trying to adapt AJAX code from Adam Khoury's Web Intersect 2.0 video series, but being new to AJAX I'm not 100% sure on what I'm doing and I think this may be where my issues lie.
I have uploaded two files to Paste Bin. Test2.php is my main html, ajax page, link_checker.php is the included file that helps with the validation.
Could someone, anyone please help me to get this system running and teach/show me where I've made my errors. I believe my errors lie within the AJAX side of things which is why I've posted in this section of the forums.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!