Lost Password?

  #1 (permalink)  
Old 03-03-2007, 05:40 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default Create files with php

Creating files with php is very simple. So.. let's start.

PHP Code:
<?php

// This function shows your form
function form(){

echo 
"<form action='?act=create' method='post'>"
    
."Filename: <input type='text' name='filename' size='30'><br>"
    
."<textarea cols='50' rows='10' name='content'></textarea><br>"
    
."<input type='submit' value='Create'>"
    
."</form>";

}

// This function will create your file
function create(){

// Gather info into variables from our form
$filename $_REQUEST['filename'];
$content $_REQUEST['content'];

// Now let's create our file
$open fopen($filename"a"); // Now this file is ready for overwriting
fwrite($open$content); // This will write your text what was in textarea into your file
fclose($open); // Closes your file
echo "File is created <a href='$filename'>Preview</a>";

}

switch(
$act){

default;
form();
break;

case 
"create";
create();
break;

}

?>
I hope it helped..

Regards Jaan
__________________


Cheap & Professional Web Design | Need help? Send a PM

Last edited by Jaan; 03-02-2008 at 05:18 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-01-2008, 04:05 PM
Whitey's Avatar   
Whitey Whitey is offline
Programmer
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 189
Rep Power: 5
Whitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default

Doesn't work..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 06:21 PM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default

yes it works
i always check my tutorials before posting them here..
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 08:01 PM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,752
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

Quote:
Originally Posted by Whitey View Post
Doesn't work..
You're right, the code appends the file to a directory calls "files." If that folder doesn't exist, it wont work. If it does exist the file will be created, but the link won't work because it is isn't linked to the files directory.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-02-2008, 05:12 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default

well.. this is VERY wierd.. because when I create my tutorials or just scritps then i always check do they work or not.. but i'll check it..and fix something
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 03-02-2008, 05:18 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default

Anyway.. now it works 100% and before it worked also..
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-03-2008, 09:12 AM
lucky-girl's Avatar   
lucky-girl lucky-girl is offline
Newbie
 
Join Date: Dec 2007
Age: 23
Posts: 27
Rep Power: 3
lucky-girl is on a distinguished road
Default

nice and easy
question
action='?act=create'
what is (?act) means?
sorry, i know its stupid question
thanks (flower)
__________________
begginer programmer needs the help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-03-2008, 10:28 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default

hmm..
it's like.. main command and and create is a subcommand..
you can change this act to what ever your like..
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-08-2008, 08:09 AM
mittalmak mittalmak is offline
Newbie
 
Join Date: Aug 2007
Posts: 11
Rep Power: 0
mittalmak is on a distinguished road
Default Re: Create files with php

tha code dose not work's
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-08-2008, 10:56 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Moderator">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 815
Last Blog:
Wadio Media Layout Com...
Rep Power: 14
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default Re: Create files with php

yes it works..
well for me...
__________________


Cheap & Professional Web Design | Need help? Send a PM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 4 end of life announcement Jordan Programming News 4 08-30-2007 09:55 AM
Where to Put PHP Code clookid PHP Tutorials 1 01-11-2007 08:44 PM


All times are GMT -5. The time now is 01:32 PM.

Contest Stats

=At ........
neerlin ........
satrian ........
jackluxford ........
Xav ........
MeTh0Dz|Reb0rn ........
gamiR ........
chili5 ........
liljp617 ........
Fred@eisfi ........

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads