What i am trying to do is create a website which is available to all users on my LAN. I want them to enter a code which will redirect them to the folder from which they can download files from. I don't want to create a MySQL database to store the access code because I don't know much about it and I only started learning php yesterday. I understand that the way i am planning on using is vulnerable to user-injected scripts. i just want to deter certain people from accessing certain files.
Here's what i have come up with
Code: Select all
//The file name is login.php
<html>
<body>
<?php
$real_id = "access code" ;
$ui_login_id ;
//i need the user to input the code here and the value of ui_login_id should change to whatever the user inputted
if (ui_login_id == real_id)
{
include ("login_success.php");
}
else include ("login_fail") ;
?>
</body>
</html>
Code: Select all
//the file name is login_success.php
<body>
<html>
<?php
echo "You will now be redirected to my Sharing Folder in 3 seconds";
echo <br>;
echo "If you are not redirected in 3 seconds please ";
echo '<a href="http://192.168.1.105/Sharing Files">, click here</a>';
header('Refresh: 3; URL=http://192.168.1.105/Sharing Files/');
?>
</body>
</html>
Code: Select all
//the filename is login_fail.php
<body>
<html>
<?php
echo "You have entered the wrong login password";
include ("login.php"); // this creates a loop
?>
</body>
</html>