Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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);
      fclose($file);
   }
   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???





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





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