Słuchajcie mam taki oto problem.
1. Na serwerze jest index.html, składający się z 3 pól tekstowych. W środku index.html jest funkcyjka sprawdzająca czy delikwent wypełnił wszystkie pola.
2. Na serwerze jest również index.php, do którego użytkownik ma zostać przekierowany po wypełnieniu wszystkich pól z (1)
3. Niestety, jak wpisze sie domena.pl/index.php to wszystko widac
PYTANIE: jaki kod umiescic w index.php, ktory by sprawdzal zmienne z html i w zaleznosci od ich obecnosci pokazywal zawartosc index.php lub odsylal z powrotem do formularza logujacego? Pozniej chce to rozbudowac o MySQL ale teraz chodzi mi tylko o to, zeby nie mozna bylo zobaczyc index.php bez uprzedniego wypelnienia index.html
Oto kod formularza html. Bardzo prosze o kod do index.php, jakikolwiek, ktory spelnialby w/w opisana funkcjonalnosc.
Kod
<html>
<head>
</head>
<body>
<script type="text/javascript">
// <![CDATA[
function sprawdz(formularz)
{
for (i = 0; i < formularz.length; i++)
{
var pole = formularz.elements[i];
if (!pole.disabled && !pole.readonly && (pole.type == "text" || pole.type == "password" || pole.type == "textarea") && pole.value == "")
{
alert("Prosze wypelnic wszystkie pola!");
return false;
}
}
return true;
}
// ]]>
</script>
<form action="index.php" method="post" onsubmit="if (sprawdz(this)) return true; return false">
<div>
Imie: <input type="text" name="username" /><br />
Nazwisko: <input Nazwisko type="text" name="username2" /><br />
Haslo:<input Haslo type="password" name="userpassword" /><br />
<input type="submit" value="OK" />
</div>
</form>
</body>
</html>
<head>
</head>
<body>
<script type="text/javascript">
// <![CDATA[
function sprawdz(formularz)
{
for (i = 0; i < formularz.length; i++)
{
var pole = formularz.elements[i];
if (!pole.disabled && !pole.readonly && (pole.type == "text" || pole.type == "password" || pole.type == "textarea") && pole.value == "")
{
alert("Prosze wypelnic wszystkie pola!");
return false;
}
}
return true;
}
// ]]>
</script>
<form action="index.php" method="post" onsubmit="if (sprawdz(this)) return true; return false">
<div>
Imie: <input type="text" name="username" /><br />
Nazwisko: <input Nazwisko type="text" name="username2" /><br />
Haslo:<input Haslo type="password" name="userpassword" /><br />
<input type="submit" value="OK" />
</div>
</form>
</body>
</html>