FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Php Include bug in firefox
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Php Include bug in firefox [message #169569] Sat, 18 September 2010 02:05 Go to next message
GarryJones is currently offline  GarryJones
Messages: 21
Registered: September 2010
Karma: 0
Junior Member
Is there another way of including a secondary file to a first?

I have just started to use ajax, it loads in php pages that are
written on the server.

My ajax script is at the bottom of this for info only, there is not
problem with the ajax code, it works perfectly except for one little
problem caused by php.

One of the documents I am reading from the server calls another file
with php like this.

<? include ("ct04a.php") ?>

This works on msie. This does not work on firefox!! Yeah I know I can
tell my users to stop using firefox (and mac and iphone and linux and
crome and safari), but I WOULD like this to work in firefox.

Is the problem a bug in php or ajax or javascript?

Is there another php command that I can test to include a secondary
php file

<script language=JavaScript>
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("POST",url,true);
xmlhttp.send(null);
}
else
{
alert("Email if it is a big problem");
}
}

function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = "OK"
document.getElementById('T1').innerHTML=xmlhttp.responseText;
}
else
{
alert("Problem med datahämtning:" + xmlhttp.statusText);
}
}
}
</script>
Re: Php Include bug in firefox [message #169570 is a reply to message #169569] Sat, 18 September 2010 02:19 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 9/17/2010 10:05 PM, GarryJones wrote:
> Is there another way of including a secondary file to a first?
>
> I have just started to use ajax, it loads in php pages that are
> written on the server.
>
> My ajax script is at the bottom of this for info only, there is not
> problem with the ajax code, it works perfectly except for one little
> problem caused by php.
>
> One of the documents I am reading from the server calls another file
> with php like this.
>
> <? include ("ct04a.php") ?>
>
> This works on msie. This does not work on firefox!! Yeah I know I can
> tell my users to stop using firefox (and mac and iphone and linux and
> crome and safari), but I WOULD like this to work in firefox.
>
> Is the problem a bug in php or ajax or javascript?
>
> Is there another php command that I can test to include a secondary
> php file
>
> <script language=JavaScript>
> var xmlhttp;
> function loadXMLDoc(url)
> {
> xmlhttp=null;
> if (window.XMLHttpRequest)
> {// code for Firefox, Opera, IE7, etc.
> xmlhttp=new XMLHttpRequest();
> }
> else if (window.ActiveXObject)
> {// code for IE6, IE5
> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
> }
> if (xmlhttp!=null)
> {
> xmlhttp.onreadystatechange=state_Change;
> xmlhttp.open("POST",url,true);
> xmlhttp.send(null);
> }
> else
> {
> alert("Email if it is a big problem");
> }
> }
>
> function state_Change()
> {
> if (xmlhttp.readyState==4)
> {// 4 = "loaded"
> if (xmlhttp.status==200)
> {// 200 = "OK"
> document.getElementById('T1').innerHTML=xmlhttp.responseText;
> }
> else
> {
> alert("Problem med datahämtning:" + xmlhttp.statusText);
> }
> }
> }
> </script>

PHP runs on the server and has no idea (nor does it care) what the
browser id. I would say you have a problem in your javascript code -
which does run on the browser, and is affected by which browser you're
using.

Try comp.lang.javascript.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Php Include bug in firefox [message #169571 is a reply to message #169569] Sat, 18 September 2010 05:35 Go to previous messageGo to next message
Mike S is currently offline  Mike S
Messages: 8
Registered: September 2010
Karma: 0
Junior Member
On 9/17/2010 7:05 PM, GarryJones wrote:
> Is there another way of including a secondary file to a first?
>
> I have just started to use ajax, it loads in php pages that are
> written on the server.
>
> My ajax script is at the bottom of this for info only, there is not
> problem with the ajax code, it works perfectly except for one little
> problem caused by php.
>
> One of the documents I am reading from the server calls another file
> with php like this.
>
> <? include ("ct04a.php") ?>
>
> This works on msie. This does not work on firefox!! Yeah I know I can
> tell my users to stop using firefox (and mac and iphone and linux and
> crome and safari), but I WOULD like this to work in firefox.
>
> Is the problem a bug in php or ajax or javascript?
>
> Is there another php command that I can test to include a secondary
> php file
>
> <script language=JavaScript>
> var xmlhttp;
> function loadXMLDoc(url)
> {
> xmlhttp=null;
> if (window.XMLHttpRequest)
> {// code for Firefox, Opera, IE7, etc.
> xmlhttp=new XMLHttpRequest();
> }
> else if (window.ActiveXObject)
> {// code for IE6, IE5
> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
> }
> if (xmlhttp!=null)
> {
> xmlhttp.onreadystatechange=state_Change;
> xmlhttp.open("POST",url,true);
> xmlhttp.send(null);
> }
> else
> {
> alert("Email if it is a big problem");
> }
> }
>
> function state_Change()
> {
> if (xmlhttp.readyState==4)
> {// 4 = "loaded"
> if (xmlhttp.status==200)
> {// 200 = "OK"
> document.getElementById('T1').innerHTML=xmlhttp.responseText;
> }
> else
> {
> alert("Problem med datahämtning:" + xmlhttp.statusText);
> }
> }
> }
> </script>

How can an include cause a problem with the javascript executing correctly?
Re: Php Include bug in firefox [message #169572 is a reply to message #169571] Sat, 18 September 2010 06:10 Go to previous messageGo to next message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma: 0
Member
In article <i71j33$hrb$1(at)news(dot)eternal-september(dot)org>,
Mike S <mscir(at)yahoo(dot)com> wrote:

> On 9/17/2010 7:05 PM, GarryJones wrote:
>> Is there another way of including a secondary file to a first?
>>
>> I have just started to use ajax, it loads in php pages that are
>> written on the server.
>>
>> My ajax script is at the bottom of this for info only, there is not
>> problem with the ajax code, it works perfectly except for one little
>> problem caused by php.
>>
>> One of the documents I am reading from the server calls another file
>> with php like this.
>>
>> <? include ("ct04a.php") ?>
>>
>> This works on msie. This does not work on firefox!! Yeah I know I can
>> tell my users to stop using firefox (and mac and iphone and linux and
>> crome and safari), but I WOULD like this to work in firefox.
>>
>> Is the problem a bug in php or ajax or javascript?
>>
>> Is there another php command that I can test to include a secondary
>> php file
>>
>> <script language=JavaScript>
>> var xmlhttp;
>> function loadXMLDoc(url)
>> {
>> xmlhttp=null;
>> if (window.XMLHttpRequest)
>> {// code for Firefox, Opera, IE7, etc.
>> xmlhttp=new XMLHttpRequest();
>> }
>> else if (window.ActiveXObject)
>> {// code for IE6, IE5
>> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
>> }
>> if (xmlhttp!=null)
>> {
>> xmlhttp.onreadystatechange=state_Change;
>> xmlhttp.open("POST",url,true);
>> xmlhttp.send(null);
>> }
>> else
>> {
>> alert("Email if it is a big problem");
>> }
>> }
>>
>> function state_Change()
>> {
>> if (xmlhttp.readyState==4)
>> {// 4 = "loaded"
>> if (xmlhttp.status==200)
>> {// 200 = "OK"
>> document.getElementById('T1').innerHTML=xmlhttp.responseText;
>> }
>> else
>> {
>> alert("Problem med datahämtning:" + xmlhttp.statusText);
>> }
>> }
>> }
>> </script>
>
> How can an include cause a problem with the javascript executing correctly?

The correct syntax is

<?php include ("ct04a.php"); ?>

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
Re: Php Include bug in firefox [message #169573 is a reply to message #169569] Sat, 18 September 2010 09:12 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 18/09/10 03:05, GarryJones wrote:
> Is there another way of including a secondary file to a first?
>
> I have just started to use ajax, it loads in php pages that are
> written on the server.
>
> My ajax script is at the bottom of this for info only, there is not
> problem with the ajax code, it works perfectly except for one little
> problem caused by php.
>
> One of the documents I am reading from the server calls another file
> with php like this.
>
> <? include ("ct04a.php") ?>
>
> This works on msie. This does not work on firefox!!

What makes you think that this is the problem with firefox?

Incidentally, although

<? php_statement(s) ?>

may work on some web servers (and at this point, it's being interpreted
by the web server, not the browser) the recommended use is:

<?php php_statement(s) ?>

> Is the problem a bug in php or ajax or javascript?

If the php include is not working for firefox, the issue is something
obscure in your webserver configuration, as it seems it is looking at
the user agent and conditionally processing the include statement for
some reason.

> Is there another php command that I can test to include a secondary
> php file

Nope, but to be honest, nothing you've posted so far convinces me that
the php include isn't working. It sounds more like your javascript isn't
working with firefox, and that would be an issue for a javascipt
newsgroup or forum, not a php one.

[deleted javascript code]

Do you have a url we could look at to see the problem? That often helps.

Rgds

Denis McMahon
Re: Php Include bug in firefox [message #169578 is a reply to message #169572] Sat, 18 September 2010 11:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 9/18/2010 2:10 AM, Michael Vilain wrote:
> In article<i71j33$hrb$1(at)news(dot)eternal-september(dot)org>,
> Mike S<mscir(at)yahoo(dot)com> wrote:
>
>> On 9/17/2010 7:05 PM, GarryJones wrote:
>>> Is there another way of including a secondary file to a first?
>>>
>>> I have just started to use ajax, it loads in php pages that are
>>> written on the server.
>>>
>>> My ajax script is at the bottom of this for info only, there is not
>>> problem with the ajax code, it works perfectly except for one little
>>> problem caused by php.
>>>
>>> One of the documents I am reading from the server calls another file
>>> with php like this.
>>>
>>> <? include ("ct04a.php") ?>
>>>
>>> This works on msie. This does not work on firefox!! Yeah I know I can
>>> tell my users to stop using firefox (and mac and iphone and linux and
>>> crome and safari), but I WOULD like this to work in firefox.
>>>
>>> Is the problem a bug in php or ajax or javascript?
>>>
>>> Is there another php command that I can test to include a secondary
>>> php file
>>>
>>> <script language=JavaScript>
>>> var xmlhttp;
>>> function loadXMLDoc(url)
>>> {
>>> xmlhttp=null;
>>> if (window.XMLHttpRequest)
>>> {// code for Firefox, Opera, IE7, etc.
>>> xmlhttp=new XMLHttpRequest();
>>> }
>>> else if (window.ActiveXObject)
>>> {// code for IE6, IE5
>>> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
>>> }
>>> if (xmlhttp!=null)
>>> {
>>> xmlhttp.onreadystatechange=state_Change;
>>> xmlhttp.open("POST",url,true);
>>> xmlhttp.send(null);
>>> }
>>> else
>>> {
>>> alert("Email if it is a big problem");
>>> }
>>> }
>>>
>>> function state_Change()
>>> {
>>> if (xmlhttp.readyState==4)
>>> {// 4 = "loaded"
>>> if (xmlhttp.status==200)
>>> {// 200 = "OK"
>>> document.getElementById('T1').innerHTML=xmlhttp.responseText;
>>> }
>>> else
>>> {
>>> alert("Problem med datahämtning:" + xmlhttp.statusText);
>>> }
>>> }
>>> }
>>> </script>
>>
>> How can an include cause a problem with the javascript executing correctly?
>
> The correct syntax is
>
> <?php include ("ct04a.php"); ?>
>

If his host has short tags enabled (not recommended, but a lot do), his
code is perfectly valid. If they didn't, his code wouldn't work no
matter what the browser is.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Php Include bug in firefox [message #169583 is a reply to message #169569] Sat, 18 September 2010 12:25 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 9/17/2010 10:05 PM, GarryJones wrote:
> Is there another way of including a secondary file to a first?
>
> I have just started to use ajax, it loads in php pages that are
> written on the server.
>
> My ajax script is at the bottom of this for info only, there is not
> problem with the ajax code, it works perfectly except for one little
> problem caused by php.
>
> One of the documents I am reading from the server calls another file
> with php like this.
>
> <? include ("ct04a.php") ?>
>
> This works on msie. This does not work on firefox!! Yeah I know I can
> tell my users to stop using firefox (and mac and iphone and linux and
> crome and safari), but I WOULD like this to work in firefox.
>
> Is the problem a bug in php or ajax or javascript?
>
> Is there another php command that I can test to include a secondary
> php file

I don't have any better answers for you than have already been posted,
but here are a few items:

1 - Never use short tags. If you want a php area, use <?php ?>.
2 - Another one that does the job of "include" is "require".
3 - Always use "include_one" or "require_once" unless you specifically
want to include the same code in multiple places. If your include has a
function in it, then your script will throw an error if you don't have
the "_once" at the end (multiply defined).


>
> <script language=JavaScript>
> var xmlhttp;
> function loadXMLDoc(url)
> {
> xmlhttp=null;
> if (window.XMLHttpRequest)
> {// code for Firefox, Opera, IE7, etc.
> xmlhttp=new XMLHttpRequest();
> }
> else if (window.ActiveXObject)
> {// code for IE6, IE5
> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
> }
> if (xmlhttp!=null)
> {
> xmlhttp.onreadystatechange=state_Change;
> xmlhttp.open("POST",url,true);
> xmlhttp.send(null);
> }
> else
> {
> alert("Email if it is a big problem");
> }
> }
>
> function state_Change()
> {
> if (xmlhttp.readyState==4)
> {// 4 = "loaded"
> if (xmlhttp.status==200)
> {// 200 = "OK"
> document.getElementById('T1').innerHTML=xmlhttp.responseText;
> }
> else
> {
> alert("Problem med datahämtning:" + xmlhttp.statusText);
> }
> }
> }
> </script>


--
Shelly
Re: Php Include bug in firefox [message #169591 is a reply to message #169569] Sat, 18 September 2010 16:21 Go to previous message
spambait is currently offline  spambait
Messages: 35
Registered: September 2010
Karma: 0
Member
In article <5798dd2d-90b5-46f9-8dc8-16ab2bc19805(at)j5g2000vbg(dot)googlegroups(dot)com>, GarryJones <morack(at)algonet(dot)se> wrote:
[...]
> This works on msie. This does not work on firefox!!

Therefore it is not a PHP problem. PHP runs on the server, not on the client,
and is not affected by the browser running on the client.

You may have a problem with your PHP *script* generating invalid HTML (try
validating at validator.w3.org), or with your Javascript -- but this is
definitely not a PHP problem.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: @sessionstart()
Next Topic: Advanced SQL injection complete tool pack(tutorials,scanners,admin finder,shells,md5)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 11:05:13 GMT 2024

Total time taken to generate the page: 0.02454 seconds