NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Stripslashes

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 02-23-2006, 02:18 PM THREAD STARTER               #1 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Stripslashes


Hey, been using addslashes and stripslashes all this time but I've been told this is wrong. Can anyone give me the low-down on magicquotes? Thanks
Encenta.com is offline  
Old 02-23-2006, 02:23 PM   #2 (permalink)
Senior Member
 
{insert name here}'s Avatar
Join Date: Dec 2004
Posts: 1,304
{insert name here} is a glorious beacon of light{insert name here} is a glorious beacon of light{insert name here} is a glorious beacon of light{insert name here} is a glorious beacon of light{insert name here} is a glorious beacon of light
 


Breast Cancer
If you want to understand it better, you should readthis
__________________
You got no time for the messenger,
got no regard for the thing that you don't understand,
you got no fear of the underdog,
that's why you will not survive!
{insert name here} is offline  
Old 02-23-2006, 03:17 PM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Simply put magic quotes are the bane of PHP. To make things worse magic quotes settings can vary from one server to another. Please note that since PHP 4.0x magic quotes are disabled by default.
Of course people on a shared server do not have access to the PHP config file so it's best practice to design portable code so you don't depend on server-specific settings.
????: NamePros.com http://www.namepros.com/programming/170544-stripslashes.html

I use this piece of code in a config file (as an include at the beginning of my scripts) so as to avoid finding unwanted \ in my form requests
PHP Code:
if (get_magic_quotes_gpc()) {
????: NamePros.com http://www.namepros.com/showthread.php?t=170544
    function 
stripslashes_deep($value) {
        
$char_array = array();
        
$value is_array($value) ? array_map('stripslashes_deep'$value) : strtr(stripslashes($value), $char_array);
        return 
$value;
    }
    
$_POST array_map('stripslashes_deep'$_POST);
    
$_GET array_map('stripslashes_deep'$_GET);
    
$_COOKIE array_map('stripslashes_deep'$_COOKIE);

__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is online now  
Old 02-23-2006, 03:38 PM THREAD STARTER               #4 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Thanks for the help guys..and girls
Encenta.com is offline  
Old 02-24-2006, 01:56 AM   #5 (permalink)
NamePros Member
Join Date: Feb 2006
Posts: 36
egkuan is an unknown quantity at this point
 



well I always use this function at the beginning of scripts:

PHP Code:
function unmagic_quotes()
{
    for(
$i 0$i func_num_args(); $i++)
????: NamePros.com http://www.namepros.com/showthread.php?t=170544
    {
        
$temp func_get_arg($i);
        if(
is_array($temp))
        {
            foreach(
$temp as $key => $val)
            {
                if(
is_array($GLOBALS[$key]))
                {
????: NamePros.com http://www.namepros.com/showthread.php?t=170544
                    
_unmagic_quotes($GLOBALS[$key]);
                }
            }
        }
        else
        {
            
stripslashes($GLOBALS[$key]);
        }
    }
}
if(
get_magic_quotes_gpc())
{
    
unmagic_quotes($_GET $_POST$_REQUEST$_COOKIE);
}
if(
get_magic_quotes_runtime())
{
    
set_magic_quotes_runtime(0);

And it works
egkuan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i have multiple stripslashes in mail script? sedokill Programming 3 09-24-2005 04:26 PM
Wierd stripslashes() error. mholt Programming 0 09-05-2005 12:04 PM

 
All times are GMT -7. The time now is 02:10 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger