Jump to content

Adding More files to a folder Using this script


slapme

Recommended Posts

 

 

Below is a script that automatically adds a index.html file to a newly created folder.  What I would like to do is also add an inde.php file and others.  So what/where would I add to the script to have this happen? forgive the noob

Thanks

Slappy

 

 

		}
}
/**
 * Create default index.html file
 *
 * @param string path
 */
function putIndexHTML ($path) {
	if !is_file ($path . '/index.html')) {
		$handle=fopen ($path . '/index.html',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
	}
}

Link to comment
Share on other sites

Kinda defeats the purpose of a dynamic website but hey.....

 

<?php

function putIndexHTML ($path) {
	if !is_file ($path . '/index.html')) {
		$handle=fopen ($path . '/index.html',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
                                                $handle=fopen ($path . '/index.php',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
	}
}
?>

Link to comment
Share on other sites

Im sorry I did not make myself clear in my first post.  I meant to say that I wanted to COPY some index.php and other files to the same place the index.html file is going.  The the advice Thorpe gave did work, but all it created was a blank php file, sorry for the confusion

Slappy

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.