473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

php code works with Konqueror but no other browser

I'm running Mandrake 10
PHP 4x
Apache 2x
The code below resides in /home/doug/public_html
Apache is configured to allow user home drives and I can successfully
load html.

If I'm running Konqueror and launch the code below, the 'submit' button
launches the php file and returns the expected data.

If I'm running any other browser (Firefox, Mozilla, IE), pressing the
'submit'button returns the html form.

I know this may not be a php problem specifically, but the members of
this forum have a wide base of understanding and I'm hoping someone can
at least point me in the right direction.

TIA

Doug

beginning of frmSiteLoginForm.html
<html>
<body>
Enter the name of a website below.<br>
Do not include the .com bit, just the main website name<br>
This will be modified to give you a drop down list you can select from
as soon as I figure that out<br>

<br>
<form)
<form action="queryfromform.php" method = "POST">
<input type="TEXT" name="site" value="enter site name here">
<br><br>
<input type="submit" value = "Run Query">
</form>
</body>
</html>
end of frmSiteLoginForm.html
///////////////////////////////////////////////////////
beginning of queryfromform.php
<?php
//queryfromform.php
import_request_variables("P","mypost_");

// site name from form
$site = $mypost_site;
echo "The requested site is '$site' and the password is: ";

// Define variables
$server = 'localhost';
$username = 'web';
$password = 'user';
$database = 'HomeData';
//$query = "Select site, username, password from sitelogins where site =
'$site'";
$query = "Select * from sitelogins where site = '$site'";
//echo $query;

// connect to mysql
$db = mysql_connect($server, $username, $password);
//$db = mysql_connect("localhost", "web", "user");

// connect to db
mysql_select_db($database, $db);

// run query and print results
$result = mysql_query($query, $db);
if(!$result) die ("query failed");
while($row = mysql_fetch_row($result)) {
echo $row[2];
}
// close connnection
mysql_close($db);
?>
end of queryfromform.php
Jul 17 '05 #1
7 1730

dogu wrote (in part):

[snip]
beginning of frmSiteLoginForm.html
<html>
<body>
Enter the name of a website below.<br>
Do not include the .com bit, just the main website name<br>
This will be modified to give you a drop down list you can select from as soon as I figure that out<br>

<br>
<form)
<form action="queryfromform.php" method = "POST">


[snip]

If this is your real code (cut & paste from you code), the that right
parend ")" is most likely your problem.

Ken

Jul 17 '05 #2
Ken

It was my code.
Fixing the right paren didn't change the outcome :-((
In fact, now the code doesn't work in Konqueror.

I'll keep trying.

Thanks for the pointer.

Doug

Ken Robinson wrote:
dogu wrote (in part):

[snip]

beginning of frmSiteLoginForm.html
<html>
<body>
Enter the name of a website below.<br>
Do not include the .com bit, just the main website name<br>
This will be modified to give you a drop down list you can select


from
as soon as I figure that out<br>

<br>
<form)
<form action="queryfromform.php" method = "POST">

[snip]

If this is your real code (cut & paste from you code), the that right
parend ")" is most likely your problem.

Ken

Jul 17 '05 #3
Ken,

OK, I don't understand what's happening or why, the following code does
this:

Displays the input form on the screen plus the PHP echo "The requested
site is '$site' and the password is: " bit.

I enter a site, hit the 'Get Password' submit button, and the same form
redisplays, with the result and the form field 'site' back to null.

I'm glad it's working, now I need to figure out how to make my original
code work.

Maybe time for a break...

Talk to you later.

Doug

<html>
<body>
Enter the name of a website below.<br>
Do not include the .com bit, just the main website name<br>
This will be modified to give you a drop down list you can select from
as soon as I figure that out<br>
</body>
<br>
<form>
<form action="queryfromform.php" method="POST">
<input type="TEXT" name="site" value="">
<br><br>
<input type="submit" value = "Get Password">
</form>

<?php

// Define variables
$server = 'localhost';
$username = 'web';
$password = 'user';
$database = 'HomeData';

//$query = "Select site, username, password from sitelogins where site =
'$site'";
$query = "Select * from sitelogins where site = '$site'";

// connect to mysql
$db = mysql_connect($server, $username, $password);
//$db = mysql_connect("localhost", "web", "user");

// connect to db
mysql_select_db($database, $db);

// run query and print results
echo "The requested site is '$site' and the password is: ";

$result = mysql_query($query, $db);
if(!$result) die ("query failed");
while($row = mysql_fetch_row($result)) {
echo $row[2];
}

// close connnection
mysql_close($db);
?>
</html>
Ken Robinson wrote:
dogu wrote (in part):

[snip]

beginning of frmSiteLoginForm.html
<html>
<body>
Enter the name of a website below.<br>
Do not include the .com bit, just the main website name<br>
This will be modified to give you a drop down list you can select


from
as soon as I figure that out<br>

<br>
<form)
<form action="queryfromform.php" method = "POST">

[snip]

If this is your real code (cut & paste from you code), the that right
parend ")" is most likely your problem.

Ken

Jul 17 '05 #4
.oO(dogu)
<form>
<form action="queryfromform.php" method="POST">
Why are there two <form> tags?

You should run the site through the W3 validator to avoid such errors.

<http://validator.w3.org/>
//$query = "Select site, username, password from sitelogins where site =
'$site'";
$query = "Select * from sitelogins where site = '$site'";
This will fail on recent PHP installations with default configuration.

<http://www.php.net/manual/en/language.variables.predefined.php>
<http://www.php.net/manual/en/security.globals.php>

Additionally it's not the best idea to use user-submitted data directly
in a query without validation/escaping. Don't rely on magic quotes.

<http://www.php.net/manual/en/security.database.sql-injection.php>
<http://www.php.net/manual/en/function.mysql-real-escape-string.php>
// run query and print results
echo "The requested site is '$site' and the password is: ";


Passwords stored in plain text are no passwords, they are a security
risk. You should use the MySQL function PASSWORD() to encrypt them.

Micha
Jul 17 '05 #5
dogu <df***********@netscape.net> wrote:
It was my code.
Fixing the right paren didn't change the outcome :-((
In fact, now the code doesn't work in Konqueror.


One of the main differences with konq. and rest is that konq takes the
action of the inner form when nesting forms and all others use the top
form. AFAIK w3c says nested forms aren't legal html 4.x.

BTW I saw somehting on Discovery yesterday where they said soja and thus
TOFU may be a cause of aggression in human behavior unless meals are
balances with lots of fish and vegies.

--

Daniel Tryba

Jul 17 '05 #6
Michael
BINGO!

Pulling the first <form> fixed the problem - many thanks.

Thanks also for the recommendation to use the validator site - this is
all new to me and I've just been banging into walls until stuff works.

The select works fine - not sure if it's because I did something right
or am just lucky! I'll figure out which and either be happy or fix the
problem.

You're dead right about the password issue. This is an 'inside the
firewall play around not for real use' site. We run a firewall and
don't allow any inbound http traffic. If/when I decide to open a hole
so I can get to the site from outside, I'll make several changes to the
system:
It will require a password to use the db.
The password data will be encrypted.
I may also further modify the passwords so they are not the real
passwords but some encoded version that serve as 'hints' to the real
passwords. I may be a noob at LAMP who can't write clean HTML, but I
know better than to be blasting plain text pws around cyberspace - and
thanks for the suggestion, always better to point these things out than
to leave them unsaid.

Again, MANY thanks for pushing me the right direction. Now onto more
fun stuff.

Doug
ps - sorry, what is oO?
Michael Fesser wrote:
.oO(dogu)

<form>
<form action="queryfromform.php" method="POST">

Why are there two <form> tags?

You should run the site through the W3 validator to avoid such errors.

<http://validator.w3.org/>
//$query = "Select site, username, password from sitelogins where site =
'$site'";
$query = "Select * from sitelogins where site = '$site'";

This will fail on recent PHP installations with default configuration.

<http://www.php.net/manual/en/language.variables.predefined.php>
<http://www.php.net/manual/en/security.globals.php>

Additionally it's not the best idea to use user-submitted data directly
in a query without validation/escaping. Don't rely on magic quotes.

<http://www.php.net/manual/en/security.database.sql-injection.php>
<http://www.php.net/manual/en/function.mysql-real-escape-string.php>
// run query and print results
echo "The requested site is '$site' and the password is: ";

Passwords stored in plain text are no passwords, they are a security
risk. You should use the MySQL function PASSWORD() to encrypt them.

Micha

Jul 17 '05 #7
Daniel,

And yet another light goes on... Kill the outside, redundant <form> tag
and everything works everywhere.

Many thanks.

Re Tofu - so if you give lots of soy/tofu to peri-menopausal females as
an estrogen enhancer/replacement, and they're cranky to start with, ....
OMG! WWIII is on the way...

Doug

Daniel Tryba wrote:
dogu <df***********@netscape.net> wrote:
It was my code.
Fixing the right paren didn't change the outcome :-((
In fact, now the code doesn't work in Konqueror.

One of the main differences with konq. and rest is that konq takes the
action of the inner form when nesting forms and all others use the top
form. AFAIK w3c says nested forms aren't legal html 4.x.

BTW I saw somehting on Discovery yesterday where they said soja and thus
TOFU may be a cause of aggression in human behavior unless meals are
balances with lots of fish and vegies.

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Greener | last post by:
Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? If this is the case, what's wrong with the following? <script...
11
by: F. Da Costa | last post by:
Hi, This is a strange issue I'v been staring at for half a day now. It concerns catching keys via the onkeydown handler. In IE5+ it works fine but in Moz 1.6 (& Firebird 0.7+) it behaves most...
2
by: Gustav Medler | last post by:
Gustav Medler <nospam.gm@nurfuerspam.de> wrote/schrieb: Is KDE/ Konqueror browser supporting ommouseover="window.status...."? It does not in my test systems with Knoppix 3.4/Debian or Suse 9.0. ...
5
by: D E | last post by:
Here is the problem. The following script/html code works in IE, not Netscape. The javascript portion produces the text to be dynamically written in the <A HREF="">HEREHEREHERE</A> portion... The...
109
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any...
4
by: DanielEKFA | last post by:
Hey hey :) Having a lot of problems with this. I'm helping my brother out with this art school web page. He has a big wish to have random images from the web shown in the background, and asked...
3
by: Chris Mahoney | last post by:
Hi I have two machines, one running Win 2000 and VS.NET 2002, and one running Mac OS 10.2. I can develop web apps on my Windows machine, and look at them in IE, and they look fine. But if I...
14
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good...
5
by: Phlip | last post by:
Engineers: Steps to reproduce the issue: - whip out your Konqueror 3.4.2 - (via Linux 2.6.12-12mdk-i586-up-1GB) - write HTML with an IFrame - src='javascript:void(alert("yo"))' - hit the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.