A
Anonymous
Guest
Edit: Skip down to the bottom to read the new problem; this one has been fixed.
I'm trying to create a preliminary login that requires anyone attempting to access the next page to put in a password. Initally I just had 'var pass = blah;' in my HTML, but I remembered that if someone just viewed the page source, they could see that password and access the page.
As far as I could tell, the simplest way for me to do this without anyone being able to see the password in the source is to have my password stored in an external php file as a variable.
I googled far and wide, but nothing quite like what I was trying to do (without using a my_sql or a whole lot of code) came up.
Is what I'm asking even possible? Surely it is, just maybe not exactly the way I was hoping to do it.
In order to more clearly explain how I want this to work:
User visits /upload.html and receives a text box that prompts for the password.
The password is entered, if incorrect, the text on the page says that it's incorrect, and has a refresh button to try again. If the password is correct, it moves on to the next php file with a passed variable that's hidden from the URL.
I have already gotten the prompt, refresh button, and the like programmed as a base, but I have no idea how to grab a value from an external php, save it as a variable in the primary php, then pass it on to another php without "?myvar=value" in the URL.
Here is what I have so far (unfortunately still with the password in the HTML and passing the vairable in the URL of the next php, which is what I don't want):
Any help or redirecting would be greatly appreciated.
I'm trying to create a preliminary login that requires anyone attempting to access the next page to put in a password. Initally I just had 'var pass = blah;' in my HTML, but I remembered that if someone just viewed the page source, they could see that password and access the page.
As far as I could tell, the simplest way for me to do this without anyone being able to see the password in the source is to have my password stored in an external php file as a variable.
I googled far and wide, but nothing quite like what I was trying to do (without using a my_sql or a whole lot of code) came up.
Is what I'm asking even possible? Surely it is, just maybe not exactly the way I was hoping to do it.
In order to more clearly explain how I want this to work:
User visits /upload.html and receives a text box that prompts for the password.
The password is entered, if incorrect, the text on the page says that it's incorrect, and has a refresh button to try again. If the password is correct, it moves on to the next php file with a passed variable that's hidden from the URL.
I have already gotten the prompt, refresh button, and the like programmed as a base, but I have no idea how to grab a value from an external php, save it as a variable in the primary php, then pass it on to another php without "?myvar=value" in the URL.
Here is what I have so far (unfortunately still with the password in the HTML and passing the vairable in the URL of the next php, which is what I don't want):
Code:
<p id="WaitText">Waiting...</p>
<form><input type=button value="Try Again" name="refreshbtn" onClick="window.location.reload()"></form>
<script>
var s1 = document.getElementsByName("refreshbtn").item(0);
s1.style.visibility="hidden";
</script>
<HEAD>
<script type="text/javascript">
function showrefresh()
{
var s1 = document.getElementsByName("refreshbtn").item(0);
s1.style.visibility="visible";
}
var pass = "blah";
password=prompt("Please enter your password:","");
if (password==pass) {
window.location= "upload_file.php?pass=blah"; // file to open if password is correct
} else {
WaitText.innerHTML="Wrong password!";
showrefresh();
}
</script>
Any help or redirecting would be greatly appreciated.