Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-19-2009, 04:16 PM
  #1
COnlineMarket
Novice (Level 1)
 
Join Date: Oct 2009
Posts: 4
iTrader: (0)
COnlineMarket is an unknown quantity at this point
php search

Hello, Obviously I'm new to this forum but I need some help.

This is what I'm trying to do:
Allow my PHP login script to accept URL value things.

Normally I have a log in page where someone adds their username and password it logs in 100% perfectly.

Now when i do www.mysite.com/login.php?fn=me&pass=something i just go to my login.php as if i didnt input any values. when it should have entered fn and pass

heres what i got

PHP Code:
<?php

$name 
$_POST["fn"];
$pass $_POST["pass"];


$con mysql_connect("","","");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db(""$con);
 
$result mysql_query("SELECT * FROM secret Where FirstName='$name'");

$succ=" There is no record of $name. ";
while(
$row mysql_fetch_array($result))
  {
if (
$row['Password']==$pass)
$succ="True";
    
else
$succ=" Incorrect password: $pass ";
}

if(
$succ=="True")
echo 
"Welcome  $name!";
else
echo 
"<form STYLE='DISPLAY:INLINE;'  name='login' action='login.php' method='post'>
User Name:<input  size='10' name='fn' type='text'  maxlength='10' />
Password:<input  size='10' name='pass' type='text' maxlength='10'/>
<a href='javascript:document.login.submit()'>Login</a><font color='#FF0000' size='-1'>$succ</font> | <a  href='register.html'>Register</a></form>"
;
?>
see?

Heres what i think it may be:

Possibly my begining
$name = $_POST["fn"];
$pass = $_POST["pass"];
Overrights the URL input ?

Please respond.
COnlineMarket is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-19-2009, 04:43 PM
  #2
genuineskate
Paladin (Level 15)
 
Join Date: May 2006
Location: USA
Posts: 430
iTrader: (0)
genuineskate is an unknown quantity at this point
Anything included in the page URL by the & sign is in the $_GET variable, not the $_POST

Changing that should solve your problem
__________________
Did i help you? Rep me!
genuineskate is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-19-2009, 04:47 PM
  #3
COnlineMarket
Novice (Level 1)
 
Join Date: Oct 2009
Posts: 4
iTrader: (0)
COnlineMarket is an unknown quantity at this point
hey thanks! now it works

i just did

PHP Code:
if ($_POST["fn"] == ""){
$name $_GET["fn"];
$pass $_GET["pass"];
}
if (
$_GET["fn"] == ""){
$name $_POST["fn"];
$pass $_POST["pass"];

COnlineMarket is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-19-2009, 05:00 PM
  #4
genuineskate
Paladin (Level 15)
 
Join Date: May 2006
Location: USA
Posts: 430
iTrader: (0)
genuineskate is an unknown quantity at this point
No problem
__________________
Did i help you? Rep me!
genuineskate is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 01:55 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.