2DWorlds Forums
PHP Filesystem - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Off Topic (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=5)
+--- Forum: Programming (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=30)
+--- Thread: PHP Filesystem (/showthread.php?tid=6872)



PHP Filesystem - Dignity - 07-13-2011

Code:
<html>
<head>
        <meta charset="utf-8" />
        <title>Wiki Page</title>
    </head>
    <body>
        <h1>
        <?php
        include("rnd.php");
$file = fopen($_GET["Name"];,"w");
fwrite($file,$_GET["body"];);
fclose($file);
include("footer.php");
?>
    </body>
</html>

For some reason, this isn't working.

Any ideas?


RE: PHP Filesystem - Qwertygiy - 07-13-2011

1: Do other PHP scripts work?

2: Does it show an error at all?


RE: PHP Filesystem - Dignity - 07-14-2011

The other PHP scripts do work.

2.M y thing doesn't report PHP errors.


RE: PHP Filesystem - Glome - 07-14-2011

(07-14-2011, 12:53 AM)roperson Wrote: The other PHP scripts do work.

2.M y thing doesn't report PHP errors.

Put this at the top Tongue


error_reporting(E_ALL);




RE: PHP Filesystem - Jacob__mybb_import1 - 07-14-2011

You don't need the semicolons after the $_GET variables. They should almost always only go at the end of lines.


RE: PHP Filesystem - Dignity - 07-14-2011

My bad.
Great,now I have another glitch that's been poping up a lot. All the text is HUGE.
No errors, but it won't create the files.

Wait... nvm


RE: PHP Filesystem - Chaos - 07-14-2011

You never closed your <h1> tag.





RE: PHP Filesystem - Dignity - 07-14-2011

Now, this won't work. No matter if I put HTML or not it simply doesn't work.

Code:
<?php
        include("rnd.php");
$file = fopen($_GET["Name"]. ".html","x");
fwrite($file,$_GET["body"]);
fclose($file);
include("footer.php");
?>

Thanks, Chaos.


RE: PHP Filesystem - Chaos - 07-14-2011

$file = fopen($_GET["Name"]. ".html","x"); that line may be wrong. If I remember correctly, you can't have 2 quotes, then more. It confuses php. Try this:
[lua]
$file = fopen($_GET["Name"]. /.html/,/x/);
[/lua]


RE: PHP Filesystem - Dignity - 07-14-2011

Nope, it shout out the 500.0 error. ;p