Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: PHP Help  (Read 1618 times)

0 Members and 1 Guest are viewing this topic.
PHP Help
« on: June 01, 2008, 11:27:51 pm »
  • :'O
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 929
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?
Logged
Re: PHP Help
« Reply #1 on: June 01, 2008, 11:34:56 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Code: [Select]
<form action="loggedin.php">

to

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

Any better?
Logged
Re: PHP Help
« Reply #2 on: June 01, 2008, 11:36:41 pm »
  • :'O
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 929
nope =/
Logged
Re: PHP Help
« Reply #3 on: June 01, 2008, 11:51:01 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Quote
<input type="text" value="Password" id="password" name="password" />

Try that as well as the above suggestion.
« Last Edit: June 02, 2008, 12:00:43 am by Infini »
Logged
Re: PHP Help
« Reply #4 on: June 01, 2008, 11:58:50 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
change this line to
Code: [Select]
<input type="text" value="Password" name="password" id="password" /><br />
Logged
Re: PHP Help
« Reply #5 on: June 01, 2008, 11:59:06 pm »
  • Super Hero Time!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 4859
qipte THE DAMN THING.
Logged
!@#$% I lost my entire post, god dammit.
Re: PHP Help
« Reply #6 on: June 02, 2008, 12:01:10 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
qipte THE DAMN THING.
Sorry, my bad :D. My mind generally has no involvement when typing.
Logged
Re: PHP Help
« Reply #7 on: June 02, 2008, 12:03:26 am »
  • :'O
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 929
Nice, it worked! Thanks guys  8)
Logged
Re: PHP Help
« Reply #8 on: June 09, 2008, 06:05:32 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1645
<?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!".
Logged
  • Virtual Security
Re: PHP Help
« Reply #9 on: June 09, 2008, 06:09:59 am »
  • :'O
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 929
<?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
Logged
Pages: [1]   Go Up

 


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



Page created in 0.046 seconds with 43 queries.

anything