Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts

    Important Please Help!

    Ok i have 3 file i have index.php. What index.php does is it creates a directory based on a url variable. so if it was index.php?dir=thedream it would creat a dir called thedream. it also creates a file called index.html in there and copys over 2 files edit.php and update.php.

    Here is the code:

    index.php
    PHP Code:
    <?php

    $dir 
    $_GET['dir'];

    if(
    file_exists($dir)) {

        echo 
    "The Directory ".$dir." Already Exists!";
        
    }

    else {

        
    mkdir(''.$dir.''0777);

            if(
    file_exists($dir)) {
            
                echo 
    "The Directory ".$dir." Was Created Susessfully!";
                
                    
    $File "".$dir."/index.html";
                    
    $Handle fopen($File'w');
                    
    $html "No Profile Created Yet!";
                    
    fwrite($Handle$html);
                    
    fclose($Handle);
                    
                    
    chmod(''.$dir.'/index.html''0777');
                        
                        if(
    file_exists(''.$dir.'/index.html')) {
                        
                            echo 
    "<br />";
                            
                            echo 
    "Your Profile Page Was Created Sucsessfully!";
                        
                                
    copy('edit.php'''.$dir.'/edit.php');
                                
    copy('update.php'''.$dir.'/update.php');
                        
                        }
                        
                        else {
                            
                            echo 
    "<br />";
                            
                            echo 
    "Sorry, Your Profile Was Not Created Sucsessfully";
                            
                        }
                
            }

            else {
            
                echo 
    "Sorry, The Directory ".$dir." Was Not Created!";
                
            }
    }

    ?>
    ok so thats index.php

    edit.php
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Edit Profile</title>
    </head>

    <body>
    <b>Edit Profile:</b><br /><br />
    Content (HTML):<br />
    <form action="update.php" method="post">
    <textarea cols="50" rows="5"></textarea><br />
    <input type="submit" value="Save Profile!" /> <input type="reset" value="Reset Form!" />
    </form>

    <br /><br />
    <b>Currunt Profile:</b><br /><br />
    <?php readfile('index.html'); ?>

    </body>
    </html>
    and last

    update.php
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Saving...</title>
    </head>

    <body>
    <b>Saving:</b><br /><br />
    <?php

        $html 
    $_POST['profile'];
        
    $File "/index.html";
        
    $Handle fopen($File'w');
        
    fwrite($Handle$html);
        
    fclose($Handle);
        
        echo(
    'Saved!');
        
    ?>
    </body>
    </html>
    It creates the dir fine and copy's over the files fine but when you try to edit it you don't get any errors but it doesn't work! I can't figure out why!!! Please help.

    Any help would be greatly appreciated!

    Thank You!
    ~ Christian ( the-dream )

    Sorry For Not Naming This Post Right! It Will Not Happen Again!
    Last edited by the-dream; 03-14-2007 at 11:42 PM. Reason: NOTICE

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,049
    Thanks
    2
    Thanked 317 Times in 309 Posts
    You need to use titles that say something about your thread. This is from the Forum's Posting Guidelines -
    2) Type in a subject that summarizes your question- A great way to turn off other members wanting to help you is to type an incomplete or silly subject for your post.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Sorry!?!

  • #4
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    AnYtHiNg!

    Please!

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Are you sure about this path? $File = "/index.html";

    If index.html is in the same directory, the path would be: $File = "index.html";

    or, perhaps you meant to reference it like you previously did: $File = "".$dir."/index.html";

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Why are you concatenating blank strings?
    PHP Code:
    ''.$dir 

  • #7
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    it was cuz of dat ' / ' soz.

    Thanks for all your help!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •