GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Jul-2003, 10:06
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point

Hide password


How to hide the password that display in the address bar? Every time I login, it will show the username and password, it's OK to show the username but not password. The problem is 'http://localhost/verify1.php?username=manager&password=manager'. Thank you.




<?php setcookie("username"); ?>
<?
setcookie("username", $username);
if ($username ==NULL && $password ==NULL)
{
echo"<br><br><br><font size = 4 color = #003366><center>Please Try Again!!!<br><br><br>";
echo"NO Username & Password<br><br><br>";
echo "Click <a href=\"login1.php\">here</a> to try again !!<br>";
}
else
{
$Connect = mysql_connect("localhost","root","");
mysql_select_db("mw");
$check == 0;
$result=mysql_query("select * from account1");
$number_of_rows = mysql_num_rows($result);
$i=0;
$check=0;
while ($number_of_rows != 0)
{
$row = mysql_fetch_row($result);
$number_of_rows--;
if ($username==$row[0] && $password==$row[1])
{
echo"<br><br><br><font size = 4 color = #003366><center>Congratulations !!<br><br>";
echo "Hello!! <b>$username</b><br><br>";
echo"You had access HELP INSTITUTE website<br><br><br>";
echo "Click <a href=\"welcome1.php\">here</a> to CONTINUE !!<br>";
$check=1;
break;
}
}
if ($check == 0)
{
echo"<br><br><br><font size = 4 color = #003366><center>Please Try Again!!!<br><br><br>";
echo"Wrong Username OR Password<br><br><br>";
echo "Click <a href=\"login1.php\">here</a> to try again !!<br>";
}
}
?>
  #2  
Old 07-Jul-2003, 10:15
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
The problem is with the form that you send the username & password from.

It's sending the info using the GET method, which sticks the names & values of the form components onto the end of the query string.

If you change the FORM tag, so that it has method="post" in it, then the form's info will be send using POST, where the info is hidden from view - it doesn't show up in the query string.

Coding Tips:
To see if a variable has been set, don't see if it's NULL, use the isset() function. So
PHP Code:

if (!isset($username) || !isset($password)){
//username or password is not set.
} 



Garth Farley
  #3  
Old 08-Jul-2003, 08:51
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
Hmm, I'm NOT going to re-write that code, that will be the best for all, btw

if you are running PHP 4.1.0 or higher you should use

PHP Code:

<?phpif(!isset($_POST['username']) OR !isset($_POST['password'])){// no username or password}?>

__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
 
 

Recent GIDBlogToyota - 2008 August Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP sessions problem andy MySQL / PHP Forum 19 18-Jan-2007 11:34
Creating a search engine friendly forum BobbyDouglas Search Engine Optimization Forum 14 20-Nov-2003 16:31
Password Script Help BobbyDouglas MySQL / PHP Forum 26 12-Aug-2003 18:26
webpage password robynhood Web Design Forum 3 11-May-2003 21:23
Password Protect using Frontpage 2000 Lynx Web Design Forum 3 04-Jul-2002 19:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:06.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.