str_replace help


Posted on 16th Feb 2014 07:03 pm by admin

I am thinking str_replace is my only option to filter outputs from my database to convert them to safe url variables.

I am working with a database with over 4million records, and apparently when the database was created no one though about database safety, or site safety or I don't think much in general.

So that said in the database I have characters like & ' " etc.. stuff that most people will sanitize in one way shape form or another and store as such. I guess with this post I am trying to find out what are the most important characters such as above mentioned that I should attempt to filter out, or filter differently. I am also using some of these variables within URL's so its important that I can pass them through URL variables.

The urls are being phased in 2 ways one, your standard long url (ie: index.php?a=var&b=var&c=var) and then a more SEO friendly version /a/var/b/var/ in either event I cant have ' " & other in the URLs they just dont work. For other reasons I cant have them just output in the code. So what ever characters i need to filter out and what I should filter them out as that as, as in what would you suggest to phase them as? Anything that could break code, or not work in a URL I need to know.

Also if anyone knows a better way to do it than str_replace("&", "What to replace"); ill take advice there too :-)

141 Like 22 Dislike
Previous php-forum Next php-forum
Other php-forum

Scrolling news bar and MySQL
I am not sure if this is the correct forum to post this on. If not, I apologize. I am still pretty

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

Links not updating
I'm trying to fuel a simple navigation system for a news section. It works fine when it comes to ret

how can we add data from dynamic fields to mysql db in php
i have a script which i found on the internet. i modify that script according to my needs. what is i

check if value exists
I have googled this for a while and I am getting lots of different results. Is there a standard meth

remove a ; from emails in textarea
Code: <?php

session_start();

$database_host = "localhost&qu

help with variable
I've got a problem, i want to echo some images depending on the $id, however for me to get that id i

Strange HTML Tag?
I recently noticed some odd HTML appear in some of the websites I host. Not all of them are run on a

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

file downloaded can't be read !!
<?php
$fileName = 'mypic.jpg';
$mimeType = 'image/jpeg';
header('content-dispositio

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash