...

View Full Version : Important Please Help!



the-dream
03-14-2007, 11:10 PM
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

$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


<!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

<!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!

CFMaBiSmAd
03-14-2007, 11:24 PM
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.

the-dream
03-14-2007, 11:25 PM
Sorry!?!:(

the-dream
03-15-2007, 01:09 PM
AnYtHiNg!

Please!

mlseim
03-15-2007, 02:25 PM
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";

Inigoesdr
03-15-2007, 05:43 PM
Why are you concatenating blank strings?

''.$dir

the-dream
03-15-2007, 06:21 PM
it was cuz of dat ' / ' soz.

Thanks for all your help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum