cPanel, WHM, Fantastico - Reseller Hosting, Reseller Accounts, Domain Resellers - ADSL, Broadband, Dialup, FRAICO, Unmetered - Servers, Dedicated, Counter Strike, Game Servers
HostingResellersDomainsvpsDedicated ServersSupport
 
 
Register
 
Get New Posts
 
Search
 
User CP
xilo forum    
image image
Go Back   XILO Community > Community > General Chat > PHP Magic quotes
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
travellinglad travellinglad is offline
Reseller
travellinglad is on a distinguished road
 
Posts: 81
Join Date: Dec 2005
Default PHP Magic quotes - 15/02/2007, 6:21 PM

What does anyone know about Magic quotes within PHP?

If I have data which includes a ' like Cote d'Azur it transforms it to Cote d\'Azur.

I've heard of different ways to solve this problem:

Adding additional code into the PHP script
or Altering the .htaccess file.

Any ideas which is the best route to take and is the code different for every scenario?
Reply With Quote
  (#2 (permalink)) Old
Kieran Kieran is offline
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 762
Join Date: Apr 2006
Location: Leeds, England
Default Re: PHP Magic quotes - 15/02/2007, 7:07 PM

There are functions within php to manipulate this kind of data.

You may like to look at
addslashes()
stripslashes()

Magic quotes are the spawn of satan in my humble opinion. That aside turning them on can cause problems for applications that are written for them to be off.
Reply With Quote
  (#3 (permalink)) Old
travellinglad travellinglad is offline
Reseller
travellinglad is on a distinguished road
 
Posts: 81
Join Date: Dec 2005
Thumbs up Re: PHP Magic quotes - 16/02/2007, 3:51 PM

Is this something I could myself or would I be best paying for someone to change the script.

There's two occassions when the \' appears, in the meta tag, i.e.

PHP Code:
<title><? echo $field;?> travel guide</title>
When the $field is Cote d'Azur I get the slash appear

Also when I enter the
PHP Code:
<? echo $field;?>
within the content it comes with a slash too.

Do I simply add stripslashes() to the script?

Thanks for the advice.
Reply With Quote
  (#4 (permalink)) Old
Kieran Kieran is offline
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 762
Join Date: Apr 2006
Location: Leeds, England
Default Re: PHP Magic quotes - 16/02/2007, 4:32 PM

By the sounds of thigns you'd want
Code:
stripslashes($field)
For every instance of the field variable exhibiting the problem. No need to spend money
Reply With Quote
  (#5 (permalink)) Old
travellinglad travellinglad is offline
Reseller
travellinglad is on a distinguished road
 
Posts: 81
Join Date: Dec 2005
Default Re: PHP Magic quotes - 16/02/2007, 6:09 PM

Wow that easy! Thanks Keiran, I owe you a pint!

So I have this snippet of code

PHP Code:
<title><? echo $field;?> travel guide</title>
Whereabouts do I put the stripslashes($field) within the code? I tried before the < title > and within it.

Thanks!!
Reply With Quote
  (#6 (permalink)) Old
travellinglad travellinglad is offline
Reseller
travellinglad is on a distinguished road
 
Posts: 81
Join Date: Dec 2005
Default Re: PHP Magic quotes - 16/02/2007, 6:21 PM

Ignore the post - just sorted it!!! Excellent, I've been wanting to get to the bottom of that problem for months!

Thanks Keiran!
Reply With Quote
  (#7 (permalink)) Old
Kieran Kieran is offline
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 762
Join Date: Apr 2006
Location: Leeds, England
Default Re: PHP Magic quotes - 16/02/2007, 7:02 PM

Not a problem, glad its fixed
Reply With Quote
  (#8 (permalink)) Old
travellinglad travellinglad is offline
Reseller
travellinglad is on a distinguished road
 
Posts: 81
Join Date: Dec 2005
Default Re: PHP Magic quotes - 20/02/2007, 1:36 PM

I just wanted to publically thank Kieran for all his help - it was solved, but caused over problems which Kieran kindly sorted for me.

Another reason why I am glad to be with Xilo (despite my moan earlier) is this excellent forum.
Reply With Quote
  (#9 (permalink)) Old
Kieran Kieran is offline
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 762
Join Date: Apr 2006
Location: Leeds, England
Default Re: PHP Magic quotes - 20/02/2007, 5:43 PM

Glad to have been of assistance to you. Feel free to ask if you have any other issues with scripts etc.
Reply With Quote
Reply


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Magic Quotes Miselph Support Queries 1 28/03/2008 2:41 PM


All times are GMT +1. The time now is 7:08 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.


split

XILO Communications Ltd.
Registered in England and Wales: 6451134
VAT Registered: GB 930 3394 39
Prices exclude VAT at 17.5%

We accept all major debit and credit cards via WorldPay and payments via PayPal
COPYRIGHT © 2002- XILO Communications Ltd.
ALL RIGHTS RESERVED