473,545 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 frmSiteLoginFor m.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="queryfr omform.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 frmSiteLoginFor m.html
///////////////////////////////////////////////////////
beginning of queryfromform.p hp
<?php
//queryfromform.p hp
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($qu ery, $db);
if(!$result) die ("query failed");
while($row = mysql_fetch_row ($result)) {
echo $row[2];
}
// close connnection
mysql_close($db );
?>
end of queryfromform.p hp
Jul 17 '05 #1
7 1741

dogu wrote (in part):

[snip]
beginning of frmSiteLoginFor m.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="queryfr omform.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 frmSiteLoginFor m.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="queryfr omform.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="queryfr omform.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($qu ery, $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 frmSiteLoginFor m.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="queryfr omform.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="queryfr omform.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.or g/>
//$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.variab les.predefined. php>
<http://www.php.net/manual/en/security.global s.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.databa se.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="queryfr omform.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.or g/>
//$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.variab les.predefined. php>
<http://www.php.net/manual/en/security.global s.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.databa se.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
3385
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 language="JavaScript"> function doWord(file) { if (navigator.userAgent.indexOf("MSIE")!=-1)
11
1840
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 peculiar. The 'offensive' code is included below. The weird thing lies in the alert box preceded by // **. * function textboxReplaceSelect *
2
1605
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. There is a test page at www.praxis-wiesbaden.de/test/test2.html In both conditions Konqueror is not showing the onmouseover event, isn't it?
5
1478
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 HEREHEREHEREHERE writes fine in internet explorer, but does not appear at all in Netscape 7.1. I think it might have something to do with layers......
109
5751
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 question that identifies the warning signs to look out for, the things that most easily and clearly identify the author of code as something less...
4
1957
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 me to help him out. My idea is this: Use the CNN Top Stories RSS feed to harvest keywords, then use a random keyword from this harvest to search...
3
2245
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 try to view my pages in Safari (Apple's web browser) on my Mac, there are various formatting problems. I've investigated what's happening and it...
14
3607
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 readibility on browsers w/o css-support. For important notes, warnings etc I use the <pre> tag, which shows in a neat bordered box when viewed...
5
1562
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 page
0
7484
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7415
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7928
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5997
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.