No. He means he needs all of it.Quote:
Do you mean you need some of the script code?
No.Quote:
Also, could the file to write to being a .txt be a problem?
Printable View
No. He means he needs all of it.Quote:
Do you mean you need some of the script code?
No.Quote:
Also, could the file to write to being a .txt be a problem?
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 :)