Answer the question
In order to leave comments, you need to log in
Why doesn't it redirect to another page?
header("public_html/index.php"); does not throw on another file. The error pops up: Cannot modify header information - headers already sent by
Here is the code:
<!DOCTYPE html>
<html>
<head>
<title>Letters</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
if(isset($_POST["login"]) && isset($_POST["pass"])){
$fd = fopen("nick.txt", 'r');
while(!feof($fd))
{
$str = htmlentities(fgets($fd));
if($str == $_POST["login"]){
break;
}
}
fclose($fd);
$fd = fopen("passwords.txt", 'r');
while(!feof($fd))
{
$str = htmlentities(fgets($fd));
if($str == $_POST["pass"]){
header("public_html/index.php");
}
}
fclose($fd);
}
?>
<div id = "background">
<div id = "registration">
<form method="POST">
<p align="center" id = "text1">Login in.</p>
<p><input id = "input1" name="login" placeholder="Nickname"></p>
<p><input id = "input2" name="pass" type="password" placeholder="Password"></p>
<input id = "input3" type="submit" value="Login in." >
</form>
<p align = "center" id = "text2">No account? <a id = "a1" href="index.php">Register.</a><p>
</div>
</div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question