No. He means he needs all of it.Do you mean you need some of the script code?No.Also, could the file to write to being a .txt be a problem?
No. He means he needs all of it.Do you mean you need some of the script code?No.Also, could the file to write to being a .txt be a problem?
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Ok, here is the full code:
PHP Code:<?php
$filename = "sitename.txt"; // file to write to
$error = "An error occured while changing the site name!";
$success = "Site name changed, redirecting...";
// Change Name
$name = stripslashes($_POST['name']);
// Change URL
if ($sitelink = stripslashes($_POST['sitelink'])) {
$add = "
<!-- Site Name -->
<a href=".$sitelink.">".$name."</a>
";
$sitename = @file_get_contents($filename).$add;
$file = @fopen($filename, "w+");
@fwrite($file, $sitename);
@fclose($file);
$message = $success;
}
else {
$message = $error;
}
echo "
<html>
<head>
<title>Change Site Name</title>
<meta http-equiv=\"refresh\" content=\"2;url=changetitles.php\">
".$message."
</head>
<body>
</body>
</html>";
?>
This line is causing it to append the contents instead of overwriting it. If you want the file overwritten replace the above code with this.PHP Code:$sitename = @file_get_contents($filename).$add;
If you want it to append removePHP Code:$sitename = $add;
and replacePHP Code:$sitename = @file_get_contents($filename).$add;
withPHP Code:$file = fopen($filename, "w");
PHP Code:$file = fopen($filename,'a');
Thanks a ton, i got it all working now![]()
Bookmarks