problem with simple login script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tommy1987
Forum Commoner
Posts: 92
Joined: Tue Feb 21, 2006 8:35 pm

problem with simple login script

Post by tommy1987 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

<?php
include("include-mysql.php");

if(!isset($_SESSION['myusername'])) {
?>
<form action="check_login.php" 
      method="post">
	<table align="center" bgcolor="#CCCCCC">
		<tr>
			<td align="right">Username: </td>
			<td><input type="text" name="myusername" id="myusername"></td>
		</tr>
		<tr>
			<td width="92" align="right">Password: </td>
			<td width="189"><input type="password" name="mypassword" id="mypassword"></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><input type="submit" value="Log in" /></td>
		</tr>
	</table>
</form>


<?php
   //exit;        
} else {
  echo 'You are already logged in.';
}
?>
I have the above code, and whenever I try to submit the form, it displays this in the address bar:

http://www.subaddress.myaddress.co.uk/i ... ssientered.

This puzzles me because 1. I am not sending the form to index.php, and 2. I am using POST, therefore the data should not be able to be observed in the address bar.

Hope somebody can help,, its driving me mad!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Do you have a live page we can look at?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

My guess would be you have not closed another form on the page (</form>). Although it's hard to say, your example seems fine.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply