can u help me modify this??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

can u help me modify this??

Post by pleigh »

i want to modify this function but having hard time coding it...maybe some proffesionals can easily do this..someone advised me not to use magic quotes...

Code: Select all

function escape($data)
{
    global $connect;
    if (ini_get('magic_quotes_gpc'))
    {
        $data = stripslashes($data);
    }
    return mysql_real_escape_string(trim($data), $connect);
}//end of escape() function.
thanks in advance.. :)
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Post by aetoc »

What do you want to do?

Give me some help so I can celp you.
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

sorry...im not so specific...i dont want to use the magic quotes and instead, use an alternative...is there a way to do it??
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Post by aetoc »

Send me all the code of the page if you can.

If you have a problem sending it in the forum send it to my e-mail.
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Post by aetoc »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Code: Select all

<?php
function escape($data) // function named escape with starting value $data var
	{ 
		global $connect; // var named $connect set as global
		if (ini_get('magic_quotes_gpc'))  // Returns the value of the configuration option on success. Failure, such as querying for a non-existent value, will return an empty string.
			{ 
			$data = stripslashes($data); // Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\)
			} 
		return mysql_real_escape_string(trim($data), $connect); connect with ......
	}
?>
I uderstand what the script is about but if I don't see all the code I can't give you any more help. Simple as that.


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Post Reply