Be a Supporter!

Make a .php file using php

  • 506 Views
  • 4 Replies
New Topic Respond to this Topic
Mister-Mind
Mister-Mind
  • Member since: Jul. 1, 2006
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Make a .php file using php 2006-11-03 20:05:18 Reply

Is it possible to make a .php file inside a directory using php?
all posts are appreciated. I cant reply til tommrow so sorry.

All helps appreciated.

- novalyfe

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Make a .php file using php 2006-11-03 20:08:23 Reply

Yeah, it's really simple.

See here: http://us3.php.net/fopen

Just use that, and make the directory writable.


BBS Signature
Storm
Storm
  • Member since: May. 19, 2006
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Make a .php file using php 2006-11-05 13:08:56 Reply

Ya, I think it would be something like this:

$faction = fopen('test.php', x);
$write = 'bleep blap';
fwrite($faction, $write);
fclose($faction);

Should work, unless I've messed up. =P

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Make a .php file using php 2006-11-05 14:21:09 Reply

At 11/5/06 01:08 PM, Storm wrote: Ya, I think it would be something like this:

$faction = fopen('test.php', x);
$write = 'bleep blap';
fwrite($faction, $write);
fclose($faction);

Should work, unless I've messed up. =P

You did, it will return a fatal error.

Replace:
$faction = fopen('test.php', x);

with:
$faction = fopen('test.php', 'x');

And I think it will still return a permission denied error. You need to CHMO first (the directory).

henke37
henke37
  • Member since: Sep. 10, 2004
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Make a .php file using php 2006-11-06 03:39:50 Reply

I hope you are totaly sure you know what you are doing, making new php files is exactly like eval, but saved to a file.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.