Como posso apagar a linha de um arquivo .txt especificado em um input com PHP
Queria coloca no painel admin
Meu codigo do Painel Admin
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="imagem/png" href="img/icon.png" />
<script language=javascript>
senha = 'plsfodas';
senhadig = prompt("Digite a senha","")
if (senha != senhadig){
alert('Acesso negado!');
top.location.href='index.php';
}
</script>
<title>Painel De Controle</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script>
$(function() {
var wbbOpt = {
buttons: "bold,italic,underline,|,img,link,|,code,quote"
}
$("#link").wysibb(wbbOpt);
})
</script>
</head>
<body>
<div class="container">
<div class="row">
<header class="col-sm-12">
<h1>Painel de Controle</h1>
<p><a href="plugins.php" class="btn btn-info"><i class="fa fa-arrow-left"></i> Plugins</a></p><br/>
</header>
<div id="content-form" class="col-sm-12">
<?php
if(isset($_POST['plugin']) && isset($_POST['valor']) && isset($_POST['link']) && isset($_POST['version'])) {
$plugin = $_POST['plugin'];
$valor = $_POST['valor'];
$link = $_POST['link'];
$version = $_POST['version'];
$news = unserialize(file_get_contents('news.txt'));
$news[] = array('plugin' => $plugin, 'version' => $version, 'valor' => $valor, 'link' => $link);
file_put_contents('news.txt', serialize($news));
echo '<div class="alert alert-dismissible alert-success"><h4><i class="fa fa-check"></i> Concluido</h4><p>Informações adicionadas';
echo '<br/>';
echo '<a href="plugins.php" class="alert-link">Visualizar</a></p></div>';
}
else {
?>
<form action="" class="form-horizontal" method="post">
<div class="form-group">
<label class="col-sm-2 control-label" for="plugin">Nome do Plugin</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="plugin" id="plugin" placeholder="Plugin" autofocus required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="version">Versão</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="version" id="version" placeholder="Version" autofocus required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="valor">Valor</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="valor" id="valor" placeholder="valor" autofocus required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="link">Link</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="link" id="link" placeholder="Link" autofocus required>
</div>
</div>
<button class="btn btn-primary pull-right" type="submit"><i class="fa fa-plus"></i>Adicionar</button>
</form>
<?php
}
?>
</div>
<footer class="col-sm-12">
<p><i class="fa fa-copyright"></i> Desenvolvido por Wicaro <a</p>
</footer>
</div>
</div>
</body>
</html>
Conteudo da .txt fica assim
a:2:{i:0;a:4:{s:6:"plugin";s:6:"tester";s:7:"version";s:5:"teste";s:5:"valor";s:5:"teste";s:4:"link";s:5:"teste";}i:1;a:4:{s:6:"plugin";s:7:"tester2";s:7:"version";s:6:"teste2";s:5:"valor";s:6:"teste2";s:4:"link";s:6:"teste2";}}
(Tem 2 conteudo adicionado ai)