What is with this?
<?php
include("head.php");
$title = $_GET['title'];
$topicid = $_GET['topicid'];
$file = "forum/".$topicid.".txt";
$towriter = file_get_contents($file);
$fh = ($file, 'w') or die("ERROR OCCURED");
$towrite = "LOCKED<br />".$towriter."";
fwrite($fh, $towrite);
fclose($fh);
echo '<meta HTTP-EQUIV="REFRESH" content="0; url=viewtopic.php?message=Topic+Locked&topicid='.$topicid.'&title='.$title.'">';
include("foot.php")
?>
I get this error:
Parse error: syntax error, unexpected ',' in /host/z/c/o/zcollvee/lockthread.php on line 7
Whats with that?
It can be found here:
http://coolcenter.latestdot.net/viewtopic.php?message=Your+topic+has+been+saved!&topicid=8fe52f7cc255635cf45304f7b22ee254&title=TEST#reply
Its for mods and admins to lock the thread with the word "locked" at the top of the file. Then on the viewtopic page it checks if the topic is locked by :
$topicid = $_GET['topicid'];
$file = "forum/".$topicid.".txt";
$fh = fopen($file, 'r');
$check = fread($fh, 6);
fclose($fh);
if(empty($id)){
echo 'Log in to reply';
}else{
if( $check == "LOCKED"){
echo 'This Topic has been locked';
}else{
echo'<center><a name="reply"><form method="post" action="forumreply.php?topicid='.$topicid.'&title='.$title.'">
<textarea name="reply" rows="10" cols="40" wrap="soft"></textarea><br /><input type="submit" value="Save reply"></form><br />
Remember, dont be rude!</center>';
}
if( $type == 'mod'){
echo '<img src="lock.png"><a href="lockthread.php?topicid='.$topicid.'&title='.$title.'">Lock this thread</a>';
}
if( $type == 'admin'){
echo '<img src="lock.png"><a href="lockthread.php?topicid='.$topicid.'&title='.$title.'">Lock this thread</a>';
}
}
It reads the first 6 letters of the file (LOCKED) and checks if its locked.
help please!
I am pretty sure that 'fopen($file, 'w')' is right and there is nothing wrong with the ','