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 PHP troubles with '

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-05-2006, 11:32 PM THREAD STARTER               #1 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)

Question PHP troubles with '


I am having a problem with ' when it is submitted to PHP through a form, as it comes out as \' instead of '
I tired str_replace and stripcslashes commands and they don't seem to work, is there some way to fix this?
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 05-05-2006, 11:34 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
stripslashes
Eric is offline  
Old 05-06-2006, 04:58 AM   #3 (permalink)
NamePros Regular
 
Noobie's Avatar
Join Date: Feb 2006
Location: Montreal, Quebec, Canada
Posts: 324
Noobie is on a distinguished road
 



if stripslashes isn't working you may have saved or resaved the data with the \' .

If that's the case you'd need to manually edit it if its a small number of records because stripslashes won't help you.
__________________
Goldkey.com is a scam
What's your BMI? | Timestamp Generator
Noobie is offline  
Old 05-06-2006, 05:04 AM   #4 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
code pls. usually an esc. character will do like / before the '
__________________
Nabaza.com - Amaia
weblord is offline  
Old 05-06-2006, 07:23 AM   #5 (permalink)
NamePros Member
Join Date: Apr 2005
Posts: 117
mikesherov will become famous soon enoughmikesherov will become famous soon enough
 



' comes out like \' when submitted through a form if your server has magic_quotes_gpc turned on. For a solution that works on all servers:

if (get_magic_quotes_gpc()) {
$variable = stripslashes($variable);
}

This is of course assumes the programmer knows when to add slashes when needed.
For more information, please see the official PHP website:

http://us2.php.net/manual/en/functio...quotes-gpc.php
mikesherov is offline  
Old 05-06-2006, 02:47 PM THREAD STARTER               #6 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
Here is the code i'm using:
PHP Code:
<?php
if ($_GET[image] == "") {
    echo 
"Error: Invalid Entry, Please Choose a Template";
    } else {
if (
$_GET[string] == "") {
    echo 
"Error: Invalid Entry, Please Insert Some Text";
    } else {
    if (
$_GET[fontsize] != "") {
    
$fsize $_GET[fontsize];
    } elseif (
$_GET[fontsize] == "") {
    
$fsize 16;
    }
    if (
$_GET[fontsize2] != "") {
    
$fsize2 $_GET[fontsize2];
    } elseif (
$_GET[fontsize2] == "") {
    
$fsize2 16;
    }
    
$myImage ImageCreateFromPng("templates/".$_GET[image]);
    
    
$grey ImageColorAllocate($myImage128128128);
    
$white ImageColorAllocate($myImage255255255);
    
$navy ImageColorAllocate($myImage191986);
    
$bred ImageColorAllocate($myImage19900);
    
$dred ImageColorAllocate($myImage931111);
    
$black ImageColorAllocate($myImage000);
    
$string stripcslashes($_GET[string]);
    
$string2 stripcslashes($_GET[string2]);
    if (
$_GET[image] == "mu_bk2.png") {
    
ImageTtfText($myImage$_GET[fontsize], 018034$bred"fonts/".$_GET[font], "$string");
    
ImageTtfText($myImage$_GET[fontsize2], 022054$bred"fonts/".$_GET[font], "$string2");
    }
    elseif (
$_GET[image] == "mu_all.png") {
    
ImageTtfText($myImage$_GET[fontsize] , 010080$navy"fonts/".$_GET[font], "$string");
    
ImageTtfText($myImage$_GET[fontsize2], 0150110$black"fonts/".$_GET[font], "$string2");
    }
    elseif (
$_GET[image] == "mu_bk.png") {
????: NamePros.com http://www.namepros.com/programming/194410-php-troubles-with.html
    
ImageTtfText($myImage$_GET[fontsize] , 01480$white"fonts/".$_GET[font], "$string");
    
ImageTtfText($myImage$_GET[fontsize2], 050100$white"fonts/".$_GET[font], "$string2");
    }
    elseif (
$_GET[image] == "mu_dl.png") {
    
ImageTtfText($myImage$_GET[fontsize] , 04080$dred"fonts/".$_GET[font], "$string");
    
ImageTtfText($myImage$_GET[fontsize2], 060100$dred"fonts/".$_GET[font], "$string2");
    }
    elseif (
$_GET[image] == "mu_mg.png") {
    
ImageTtfText($myImage$_GET[fontsize] , 016040$white"fonts/".$_GET[font], "$string");
????: NamePros.com http://www.namepros.com/showthread.php?t=194410
    
ImageTtfText($myImage$_GET[fontsize2], 020060$white"fonts/".$_GET[font], "$string2");
    } else {
    
ImageTtfText($myImage$_GET[fontsize], 020080$white"fonts/".$_GET[font], "$string");
    
ImageTtfText($myImage$_GET[fontsize2], 0200100$white"fonts/".$_GET[font], "$string2");
    }
    
header ("Content-type: image/png");
    
ImagePNG($myImage);
    
ImageDestroy($myImage);
    }}
?>
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 05-06-2006, 02:54 PM   #7 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
PHP Code:
<?php
$image 
stripslashes($_GET[image]);
$string stripslashes($_GET[string]);
$string2 stripslashes($_GET[string2]);
$font stripslashes($_GET[font]);
$fontsize stripslashes($_GET[fontsize]);
$fontsize2 stripslashes($_GET[fontsize2]);

if (
$image == "") {
    echo 
"Error: Invalid Entry, Please Choose a Template";
} else {
    if (
$string == "") {
        echo 
"Error: Invalid Entry, Please Insert Some Text";
    } else {
        if (
$fontsize != "") {
            
$fsize $fontsize;
        } elseif (
$fontsize == "") {
            
$fsize 16;
        }
        if (
$fontsize2 != "") {
            
$fsize2 $fontsize2;
        } elseif (
$fontsize2 == "") {
            
$fsize2 16;
        }

        
$myImage ImageCreateFromPng("templates/".$image);
    
        
$grey ImageColorAllocate($myImage128128128);
        
$white ImageColorAllocate($myImage255255255);
        
$navy ImageColorAllocate($myImage191986);
        
$bred ImageColorAllocate($myImage19900);
        
$dred ImageColorAllocate($myImage931111);
        
$black ImageColorAllocate($myImage000);
        
$string stripcslashes($string);
        
$string2 stripcslashes($string2);
        if (
$image == "mu_bk2.png") {
            
ImageTtfText($myImage$fontsize018034$bred"fonts/".$font"$string");
            
ImageTtfText($myImage$fontsize2022054$bred"fonts/".$font"$string2");
        } elseif (
$image == "mu_all.png") {
            
ImageTtfText($myImage$fontsize 010080$navy"fonts/".$font"$string");
????: NamePros.com http://www.namepros.com/showthread.php?t=194410
            
ImageTtfText($myImage$fontsize20150110$black"fonts/".$font"$string2");
        } elseif (
$image == "mu_bk.png") {
            
ImageTtfText($myImage$fontsize 01480$white"fonts/".$font"$string");
            
ImageTtfText($myImage$fontsize2050100$white"fonts/".$font"$string2");
        } elseif (
$image == "mu_dl.png") {
            
ImageTtfText($myImage$fontsize 04080$dred"fonts/".$font"$string");
            
ImageTtfText($myImage$fontsize2060100$dred"fonts/".$font"$string2");
        } elseif (
$image == "mu_mg.png") {
            
ImageTtfText($myImage$fontsize 016040$white"fonts/".$font"$string");
            
ImageTtfText($myImage$fontsize2$font020060$white"fonts/".$font"$string2");
????: NamePros.com http://www.namepros.com/showthread.php?t=194410
        } else {
            
ImageTtfText($myImage$fontsize$fontsize2020080$white"fonts/".$font"$string");
            
ImageTtfText($myImage$fontsize20200100$white"fonts/".$font"$string2");
        }
        
header ("Content-type: image/png");
        
ImagePNG($myImage);
        
ImageDestroy($myImage);
    }
}
?>
Dan is offline  
Old 05-06-2006, 08:58 PM THREAD STARTER               #8 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
Fixed it, it actually wasn't in that file, sorry for all of the trouble.
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:00 AM.

Managed Web Hosting by Liquid Web
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