corillo181 Posted December 6, 2006 Share Posted December 6, 2006 is there a way to do a code that would make a directory with a name given?..and a way to make a page with a name given also? Quote Link to comment Share on other sites More sharing options...
drifter Posted December 6, 2006 Share Posted December 6, 2006 mkdir($name,0777)fopen() will create one if the dir has permissions and the file does not exist.go to php.net Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 6, 2006 Author Share Posted December 6, 2006 ok i reading it, and when i make a directory if i want to make a page to write to it i need to put the w, but if i got a bunch of code that i want to dump in to the page that is been made how do i send it to the page? Quote Link to comment Share on other sites More sharing options...
drifter Posted December 6, 2006 Share Posted December 6, 2006 fwrite() Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 8, 2006 Author Share Posted December 8, 2006 i could create the new directory, but when i try to create a new page it makes it a directory any ways . this is what i tried.[code=php:0]<?php$do=rmdir("sing/index.php",0777);if($do){echo "done";}?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted December 8, 2006 Share Posted December 8, 2006 [url=http://php.net/rmdir]rmdir[/url]() (which you have used) removes a directory. [url=http://php.net/rmdir]mkdir[/url]() makes a directory NOT a file. [url=http://php.net/fopen]fopen[/url]() and [url=http://php.net/fwrite]fwrite[/url]() will create a file and write to it. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 i trie dthis and it didn't work[code]<?php$do=fopen("sing/index.php",'x');$filepath= 'sing/index.php';$write='this is all shit man';if($do){fwrite($filepath, $write);}?>[/code] Quote Link to comment Share on other sites More sharing options...
bljepp69 Posted December 9, 2006 Share Posted December 9, 2006 Needs to be:[code]<?php$do=fopen("sing/index.php",'x');$filepath= 'sing/index.php';//don't need this$write='this is all shit man';if($do){fwrite($do, $write);}fclose($do);?>[/code] Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 it still doesn't write nothing to the directory ..[code]<?php$do=fopen("sing/index.php",'r');$write='this is all it man';if($do){fwrite($do, $write);}fclose($do);?>[/code] Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 oh ok i had to use fopen'w' not 'r', but what if i want to throw a whole page full of code do i have to attach it to a variable too ? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 10, 2006 Author Share Posted December 10, 2006 can't dumb one page into another? Quote Link to comment Share on other sites More sharing options...
trq Posted December 10, 2006 Share Posted December 10, 2006 [quote]but what if i want to throw a whole page full of code do i have to attach it to a variable too[/quote]Yes. You'll need to put it into a variable.[quote]can't dumb one page into another?[/quote]You can copy a file. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted December 10, 2006 Author Share Posted December 10, 2006 would something like this work[code]<?php$do=fopen("sing/index.php",'w');$write=fopen("htmlforms/join_form.html",'r');if($do){fwrite($do, $write);}fclose($do);?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.