ZFGC

Resources => Coding => Topic started by: Oni_Link on June 01, 2008, 11:27:51 pm

Title: PHP Help
Post by: Oni_Link on June 01, 2008, 11:27:51 pm
I am trying to make a small login system here is my code:

Code: Text
  1. <form action="loggedin.php">
  2. <b>Password</b><br />
  3. <input type="text" value="Password" id="password" /><br />
  4. <input type="submit" value="Login" id="submit" />
  5. </form>
  6.  

Code: Text
  1. <?php
  2. $title = ":: Logged in";
  3. $passwd = $_POST[&#39;password&#39;];
  4. if ($passwd == "asdfgh")
  5. {
  6. echo &#39;Your in the admin panel!&#39;;
  7. }
  8. else
  9. {
  10. $title = "WRONG!";
  11. echo &#39;WRONG!!!&#39;;
  12. }
  13. ?>
  14.  

No matter what I put in though I always get the "Wrong Password" message. What did I do wrong?
Title: Re: PHP Help
Post by: Infinitus on June 01, 2008, 11:34:56 pm
Code: [Select]
<form action="loggedin.php">

to

Code: [Select]
<form action="loggedin.php" method="POST">

Any better?
Title: Re: PHP Help
Post by: Oni_Link on June 01, 2008, 11:36:41 pm
nope =/
Title: Re: PHP Help
Post by: Infinitus on June 01, 2008, 11:51:01 pm
Quote
<input type="text" value="Password" id="password" name="password" />

Try that as well as the above suggestion.
Title: Re: PHP Help
Post by: Windy on June 01, 2008, 11:58:50 pm
change this line to
Code: [Select]
<input type="text" value="Password" name="password" id="password" /><br />
Title: Re: PHP Help
Post by: Porkchop on June 01, 2008, 11:59:06 pm
qipte THE DAMN THING.
Title: Re: PHP Help
Post by: Infinitus on June 02, 2008, 12:01:10 am
qipte THE DAMN THING.
Sorry, my bad :D. My mind generally has no involvement when typing.
Title: Re: PHP Help
Post by: Oni_Link on June 02, 2008, 12:03:26 am
Nice, it worked! Thanks guys  8)
Title: Re: PHP Help
Post by: TheRealDragonboy on June 09, 2008, 06:05:32 am
<?php
$title = ":: Logged in";
$passwd = $_POST['password'];
if ($passwd == "asdfgh")
{
echo 'Your in the admin panel!';
}
else
{
$title = "WRONG!";
echo 'WRONG!!!';
}
?>

Question; why did you added $title at the second statement if you haven't added it on the first one? :O Like $title = "Welcome!".
Title: Re: PHP Help
Post by: Oni_Link on June 09, 2008, 06:09:59 am
<?php
$title = ":: Logged in";
$passwd = $_POST['password'];
if ($passwd == "asdfgh")
{
echo 'Your in the admin panel!';
}
else
{
$title = "WRONG!";
echo 'WRONG!!!';
}
?>

Question; why did you added $title at the second statement if you haven't added it on the first one? :O Like $title = "Welcome!".
I wasn't thinking, I fixed it later however

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved