- Код: выделить все
$fp=fopen("path/to/file","w");
fclose($fp);
права:
- Код: выделить все
chmod("path/to/file",0644);
$fp=fopen("path/to/file","w");
fclose($fp);
chmod("path/to/file",0644);
function AddNews(){
if(IsSet($mess)){
$list=File('news.txt');
$file=fopen('news.txt','w');
$date=date("d.m.y");
$st="$date | $mess \n ";
fputs($file,$st);
for($i=0;$i<MaxNews;$i++) fputs($file,"$list[$i] \n");
fclose($file);
echo "News added";
}else{ ?>
<form method="get" action="dinamic.php">
<center>
<textarea name="mess" cols="50" rows="10"></textarea><br><br>
<input type="submit" name="submit" value="add" >
<input type="hidden" name="action" value="addnews">
<input type="hidden" name="pass" value="password" >
</center>
</form> <?
}
}
function AddNews($mess){
if(IsSet($mess)){
$list=File('news.txt');
$file=fopen('news.txt','w');
$date=date("d.m.y");
$st="$date | $mess \n ";
fputs($file,$st);
for($i=0;$i<MaxNews;$i++) fputs($file,"$list[$i] \n");
fclose($file);
echo "News added";
}else{ ?>
<form method="get" action="dinamic.php">
<center>
<textarea name="mess" cols="50" rows="10"></textarea><br><br>
<input type="submit" name="submit" value="add" >
<input type="hidden" name="action" value="addnews">
<input type="hidden" name="pass" value="password" >
</center>
</form> <?
}
}
//вызывать функцию
AddNews($mess);//тут $mess - текст твоей новости.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 29