PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 29th, 2000, 11:39 AM
alexgreg's Avatar
alexgreg alexgreg is offline
Full Access
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jun 2000
Location: London, UK
Posts: 2,019 alexgreg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 sec
Reputation Power: 15
I am using this script to edit an HTML file on a web server:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

<html>
<head>
<title>Editing <? print "$file"; ?></title>
</head>

<body>

<form method=POST action="save_file.php3">

<b><u><? print "$file"; ?></u></b><br><br>

<textarea name="data" rows=10 cols=70>
<?
if (file_exists("$file"))
{readfile("$file");}
?>
</textarea><br><br>

<input type="hidden" name="file" value="<? print "$file"; ?>">

<input type="submit" name="submit" value="Save Changes">

</form>

</body></html>

-----save_file.php3-----

<?

$f = fopen("$file", "w");

fputs($f, $data);

fclose($f);

print "File $file has been amended!";

?>

[/code]

But the problem I am having is that when there are single quotes in the file, they get "escaped" by a backslash. My guess is that I need to enable Magic Quotes at runtime, but how do I do that on my win32 machine in the PHP script? If it's not magic quotes that I need to change then can someone tell me what it is that I need to change. Thanks.

------------------
------------------------
Alex
(http://www.alex-greg.co.uk)

Reply With Quote
  #2  
Old June 29th, 2000, 03:27 PM
Anti Anti is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 32 Anti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
You need to disable magic quotes gpc from your php.ini file, or failing that just use $file=stripslashes($file).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Magic Quotes

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap