<?php
$anime = $_POST['anime'];
$noc = $_POST['noc'];
$lc = $_POST['lc'];
$fbplugin = $_POST['fbplugin'];
$leer = '$leer';
$maestro = '$maestro';
$nombreimg = $_FILES['imga']['name'];
$tipoimg = $_FILES['imga']['type'];
$sizeimg = $_FILES['imga']['size'];
$carpetaimg = $_SERVER['DOCUMENT_ROOT']."/AnimeCrunch/animes/video/$anime/img/";
if($anime != "" && $noc != "" && $lc != "" && $fbplugin != ""){
move_uploaded_file($_FILES['imga']['tmp_name'],$carpetaimg."ep".$noc.".jpg");
$fp = fopen("animes/video/$anime/ep$noc.php", 'c+');
fwrite($fp, "<html>
<head>
<link rel='stylesheet' type='text/css' href='../../css/index.css'>
<?php
include('../../imp/head.php');
?>
</head>
<body>
<?php
include('../../imp/menu.php');
?>
<center>
<iframe src='".$lc."' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope;' allowfullscreen></iframe>
</center>
<div class='content'>
<h3 class='titleep'>".$anime." Episodio ".$noc."</h3><?php
//$maestro = fopen('ep".$noc."s.txt','r+');//abrimos el archivo q cuenta los votos
if (file_exists('ep".$noc."s.txt'))//solo le agregue esta linea pare verificar si
$maestro = fopen('ep".$noc."s.txt','r+');//el archivo existe, y si esto no es asi
else $maestro = fopen('ep".$noc."s.txt','w+');// el archivo se crea.
$leer = fgets($maestro,20);//lo leemos
if ($leer == '')//Esto se lo agregue para que se comience en 0 el conteo cuando nu hay
$leer = '0';//valor
rewind($maestro);//ponemos el puntero al inicio del archivo
fputs($maestro,++$leer); //escribimos la linea leída mientras le aumentamos en uno
fclose($maestro);//cerramos el archivo
?>
<?php
echo ".'"<h4 class='."'vs'".' id='."'vs3'".'> Visto $leer veces</h4>"'.";//imprimimos en pantalla la linea
?>
<center>
<br>
<a href='index.php'>
<input type='button' value='Regresar' class='regresar'/>
</a>
</center>
</div>
<div class='fbpluginc'>
<?php
include('../../imp/fbplugin.php');
?>
<div class='fb-comments' data-href='".$fbplugin."' data-width='600' data-numposts='4'></div>
</div>
</body>
</html>");
fclose($fp);
echo ("<center><h3>El episodio fue publicado exitosamente</center><br><br>
<a href='entrar.php'>
<input type='button' value='Regresar'>
</a>");
}else{
header ("Location:entrar.php");
}
?>
these codes are not allowed and should be removed, where and for what do you use that?