PHP login shit!

PHP login shit!

General — Page [1]
DiXi
Vouched

2005 Nov 17 • 121
26 ₧
ok i have made a php login shit....
but i got a problem

i can only make 1 user...
login_ok.php
[code:1]<?php
include("config.php");
include("config2.php");
if($_POST[brukernavn] == ""){
echo""; // sjekker om brukernavnet er skrefet.
}
if($_POST[passord] == ""){
echo""; // sjekker om passord er skrevet.
}
if($_POST[brukernavn] == "$bruger"){ // sjekker om brukernavn passer.

if($_POST[passord] == "$pass"){ // sjekker om passord passer.

// hvis alt passer s
 
 
 
2006 Apr 17 at 20:08 UTC
Zarathustra
Monotheist

2005 May 1 • 315
167 ₧
Silly Swede
Thus spoke Zarathustra.
 
 
 
2006 Apr 18 at 00:47 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
Think of $bruger as a box that can only contain ONE thing...

When you say $bruger = "test" it puts the word test into the box called $bruger;

Later when you say $bruger = "test2" it puts the word test2 into $bruger and overwrites what was in it before.

You can't store more than one thing at a time in $bruger.

Try this instead:

login_ok.php
[code:1]<?php
include 'config.php';

if(in_array($_POST[brukernavn].':'.$_POST[passord],
$bruger_pass_array))
{
include 'secrets.inc';
}
else
{
echo 'FUCK OFF!';
}
?>[/code:1]

config.php
[code:1]<?php
$bruger_pass_array = array('test:test','test2:test2');
?>[/code:1]

Then put your secure HTML in secrets.inc.
 
 
 
2006 Apr 18 at 01:50 UTC
DiXi
Vouched

2005 Nov 17 • 121
26 ₧
dont i have to type the directory it should go to if its rigth user and pass??

jus tto tell
"brukernavn" mean username in norwegian
"bruger" is user in dannish or something :P
 
 
 
2006 Apr 18 at 14:16 UTC
DiXi
Vouched

2005 Nov 17 • 121
26 ₧
"superjer" said:
Think of $bruger as a box that can only contain ONE thing...

When you say $bruger = "test" it puts the word test into the box called $bruger;

Later when you say $bruger = "test2" it puts the word test2 into $bruger and overwrites what was in it before.

You can't store more than one thing at a time in $bruger.

Try this instead:

login_ok.php
[code:1]<?php
include 'config.php';

if(in_array($_POST[brukernavn].':'.$_POST[passord],
$bruger_pass_array))
{
include 'secrets.inc';
}
else
{
echo 'FUCK OFF!';
}
?>[/code:1]

config.php
[code:1]<?php
$bruger_pass_array = array('test:test','test2:test2');
?>[/code:1]

Then put your secure HTML in secrets.inc.



damn didnt work -.-
 
 
 
2006 May 2 at 20:22 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
Well what DID it do? Did you put your secret HTML code in secrets.inc?


The way I told you to do it, the secure stuff is in secrets.inc. You could redirect the user to a folder, but that isn't very secure because they could just find the folder and go there directly. With the secrets.inc file, the only way to get it is by logging in.


I can't help if you don't tell me what it did.
 
 
 
2006 May 2 at 20:48 UTC
Page [1]