Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 7th, 2004, 07:05 AM
Registered User
Join Date: Jul 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP File System

Chapter 10:

function save_file() {
   global $filename, $filebody, $dir, $PHP_SELF;

   if (file_exists("$dir/$filename")) {
      echo "<SCRIPT>result =
         confirm(\"Overwrite '$dir/$filename'?\");
         if (!result) history.go(-1);</SCRIPT>";

   if ($file = fopen("$dir/$filename", "w")) {
      fputs($file, $filebody);
   else {
      error_message("Can't save file $dir/$filename.");
   echo "<SCRIPT>self.location.href='$PHP_SELF?dir=$di r& filename=$filename';</SCRIPT>";

When the Cancel button of the JavaScript Confirm() method is pressed, it will falls back to the previous page but it still overwrite the existing file. Why is that???

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
writing into a file in linux file system anboss XSLT 6 June 19th, 2008 01:56 PM
File system gandhi BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 2 March 22nd, 2006 05:23 PM
Combination of ASP and PHP login system Dimitris Classic ASP Professional 0 June 29th, 2005 05:17 AM
File System Object kumar_rajeshk Pro VB 6 7 April 28th, 2004 01:35 AM
how to create/use php template file/system junemo Beginning PHP 1 April 23rd, 2004 03:47 PM

All times are GMT -4. The time now is 05:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.