I'm doing a mini system to create a folder with files inside, but the html works perfectly. but when you put the php code, everything stops working. I can not find any information that can help me.
If anyone knows please help me :(
Or if I'm doing it wrong the code please tell me: (
Code:
?php
$fp = fopen("users/${dirname}/validar.php", "w") or die("Error al intentar abrir el archivo!");
fwrite($fp, "<?php
$miuser = 'ChristianHz';
$mipass = 'seraz90';
if(isset($_POST['login'])) {
$usuario = $_POST['usuario'];
$pass = $_POST['password'];
if ($usuario == $miuser and $pass == $mipass ) {
if (isset($_POST['remember'])) {
setcookie('usuario', $usuario, time()+60*60*7);
setcookie('passowrd', $pass, time()+60*60*7);
}
session_start();
$_SESSION['usuario'] = $usuario;
header('location:panel');
} else {
echo '<p>usuario o clave son incorrectos</p>';
}
} else {
header('location: login');
}
?>");
fclose($fp);
?>