Jump to content

looking for a simple way to make a password on a web page

givingtnt

so. in awhile, I will be doing a giveaway, in a slightly non typical way. there will be challenges. and as I don'T have time to check my things every 5 minutes, and how its not going to be reliable if I do it that way.

I want an easy way.

im looking for a couple lines of code, that I can implement in my website to make specific pages secure, each page, with a different password.

each challenge will lead to the password needed to unlock the game code. but I want people to be able to enter their names (if the forum) on the thing, then the code, so that when the code is right, it logs the name of the person, then stops anybody else from entering the actual code in. so that only one person can win.


thank you !

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

Really nice idea m9!

xool, fun. nice idea......

can you help me ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

xool, fun. nice idea......

can you help me ?

There are some js snippets that you can look up, but they aren't secure. Use php, although it will take a while.

00110000 00110001 00110000 00110000 00110000 00110000 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110001 00110001 00110001 00110000 00110000 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110000 00110001 

Link to comment
Share on other sites

Link to post
Share on other sites

Nope :D!

 

xool, fun. nice idea......

can you help me ?

Not because I wouldnt liked to but I just dont have the skills for that:D

definetly subbed for whatever reason

The Y.E.T.I. is in progress?Whaaat? (modding aproach&build log)->http://linustechtips.com/main/topic/355618-project-yeti-first-build/

[READ THE COC BEFORE POSTING][Check twice cut once][NZXT rules:D][Dremel is Love Dremel is Life][COOKIES ARE GREAT][LOGIC]

 

Link to comment
Share on other sites

Link to post
Share on other sites

Nope :D!

 

Not because I wouldnt liked to but I just dont have the skills for that:D

definetly subbed for whatever reason

do you know anybody who couldhelp me ? I kinda need this fast.....

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

do you know anybody who couldhelp me ? I kinda need this fast.....

Nope im sorry

The Y.E.T.I. is in progress?Whaaat? (modding aproach&build log)->http://linustechtips.com/main/topic/355618-project-yeti-first-build/

[READ THE COC BEFORE POSTING][Check twice cut once][NZXT rules:D][Dremel is Love Dremel is Life][COOKIES ARE GREAT][LOGIC]

 

Link to comment
Share on other sites

Link to post
Share on other sites

Do you know any server side languages? Is your website already set up with one? How secure does this need to be?

Link to comment
Share on other sites

Link to post
Share on other sites

Do you know any server side languages? Is your website already set up with one? How secure does this need to be?

I haven't made the site yet, its going to be a simple html hand coded web page. I know a farely good part of html and a tiny bit of css. but thats it.

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

I haven't made the site yet, its going to be a simple html hand coded web page. I know a farely good part of html and a tiny bit of css. but thats it.

 

You'll need to know more than that for what you want to accomplish. You might be able to do something simple with JavaScript although I would use a server side language along with a database to do it.

Link to comment
Share on other sites

Link to post
Share on other sites

You'll need to know more than that for what you want to accomplish. You might be able to do something simple with JavaScript although I would use a server side language along with a database to do it.

hm. ok

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

I want an easy way.

im looking for a couple lines of code, that I can implement in my website to make specific pages secure, each page, with a different password.

 

secure, easy, couple lines of code, robust, and reliable do not belong in the same phrase or sentence.

Link to comment
Share on other sites

Link to post
Share on other sites

You're going to need to do some server side programming, probably in PHP, and realistically you're going to need a database. If that's ok, I can lead you through the steps required, but if you can't have a database then I'm afraid I don't know what else you can do.

It's going to be more than a couple of lines of code, but it shouldn't need to be much more than 50 lines.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

Just to run this past you because I'm not sure if i understand correctly. You want to have several pages on your website that have a game code on which are hidden behind a password. You want people to find the password and when they enter it with their name it gives them the code and stops any more entries?

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah... uhh.. Unsure of what exactly you want to secure here....

--Neil Hanlon

Operations Engineer

Link to comment
Share on other sites

Link to post
Share on other sites

Just to run this past you because I'm not sure if i understand correctly. You want to have several pages on your website that have a game code on which are hidden behind a password. You want people to find the password and when they enter it with their name it gives them the code and stops any more entries?

 

 

Yeah... uhh.. Unsure of what exactly you want to secure here....

@colonel_mortis

ok. let me explain, I want a single page, where you enter your forum username (or whatever the hell you want. but if you want the code. you need your username so I send it. ) then, a box under where you put in the password. if the password is wrong. nothing happens. maybe a box saying ''you failed'' or something.  if the password is good. it logs in the name put in the first box and the time.  thats all I want. then I could go in the files and find out who got it first.

of course, if I can manage to block the web page once the first person got it right. that would be a lot better. as I won't have to deal with multiple persons having the good answer.

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

@colonel_mortis

ok. let me explain, I want a single page, where you enter your forum username (or whatever the hell you want. but if you want the code. you need your username so I send it. ) then, a box under where you put in the password. if the password is wrong. nothing happens. maybe a box saying ''you failed'' or something.  if the password is good. it logs in the name put in the first box and the time.  thats all I want. then I could go in the files and find out who got it first.

of course, if I can manage to block the web page once the first person got it right. that would be a lot better. as I won't have to deal with multiple persons having the good answer.

Realistically, to do that you're going to need a database to store the codes and to store whether they have been activated, and who by.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

It may be crude and I haven't included anything to do with validating the inputs, removing non-standard characters or actually tested the code but you certainly don't need a database for something so simple. Just write to a text file.

<form id='xgame' method='post' action='xgame.php'>Username: <input type='text' name='username' />Passcode: <input type='password' name='passcode' /><input type='submit' value='submit' /></form>
<?phpif (!empty($_POST['submit'])) {    if (!file_exists('xgame.txt')) {        $expectedPass = 'mysecretpassword';        if ($expectedPass === $_POST['passcode']) {            file_put_contents('xgame.txt', 'Winner: ' . $_POST['username']);            echo "You Win!";        } else {            echo "Sorry wrong passcode";        }    } else {        echo "Sorry you are too late!";    }}
Link to comment
Share on other sites

Link to post
Share on other sites

 

It may be crude and I haven't included anything to do with validating the inputs, removing non-standard characters or actually tested the code but you certainly don't need a database for something so simple. Just write to a text file.

<form id='xgame' method='post' action='xgame.php'>Username: <input type='text' name='username' />Passcode: <input type='password' name='passcode' /><input type='submit' value='submit' /></form>
<?phpif (!empty($_POST['submit'])) {    if (!file_exists('xgame.txt')) {        $expectedPass = 'mysecretpassword';        if ($expectedPass === $_POST['passcode']) {            file_put_contents('xgame.txt', 'Winner: ' . $_POST['username']);            echo "You Win!";        } else {            echo "Sorry wrong passcode";        }    } else {        echo "Sorry you are too late!";    }}

omg thanks. but how would that go in my web page ? . what goes where ?

also. will somebody be able to see this by pressing. say f12 or looking at the source code ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

omg thanks. but how would that go in my web page ? . what goes where ?

also. will somebody be able to see this by pressing. say f12 or looking at the source code ?

 

The second code section is PHP so you will need web hosting with PHP (most do). The first part is a form that you want people to land on where they can enter their username and the passcode.

 

The form I made references a file called xgame.php which should contain the second block of code.

 

PHP code isn't visible in the browser because it is executed on the server side. They will only see the parts that are echo'd from the code.

Link to comment
Share on other sites

Link to post
Share on other sites

omg thanks. but how would that go in my web page ? . what goes where ?

also. will somebody be able to see this by pressing. say f12 or looking at the source code ?

That is PHP, which runs on the server. Assuming your server supports it (very likely), you just need to put that in a .php file. The people viewing the page can't see that code.

Edit: looks like I got ninja'd.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

That is PHP, which runs on the server. Assuming your server supports it (very likely), you just need to put that in a .php file. The people viewing the page can't see that code.

Edit: looks like I got ninja'd.

 

 

The second code section is PHP so you will need web hosting with PHP (most do). The first part is a form that you want people to land on where they can enter their username and the passcode.

 

The form I made references a file called xgame.php which should contain the second block of code.

 

PHP code isn't visible in the browser because it is executed on the server side. They will only see the parts that are echo'd from the code.

yeah hostinger supports php. so i ill use that ! thanks !

just a question, to reset the whole thing. do I just have to delete the created txt file ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

yeah hostinger supports php. so i ill use that ! thanks !

just a question, to reset the whole thing. do I just have to delete the created txt file ?

if you use the code posted above, yes.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah deleting the txt file will allow someone else to win so just delete it and change the password.

 

If you want more places to enter you can always make duplicates of the .php page, change the text file name and submit a form to your new .php page

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah deleting the txt file will allow someone else to win so just delete it and change the password.

 

If you want more places to enter you can always make duplicates of the .php page, change the text file name and submit a form to your new .php page

the php code. just goes in a file names xgame.php ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×