php script does not work as autoadmin.global_config_url
hello, in mozilla.cfg i specify (local apache server is running): pref("autoadmin.global_config_url", "http://localhost/php/auto.php?u=1");
and auto.php looks something like this (just an example):
as a result i obtain the message added as image. mostly you find that people use a javascript file for "autoadmin.global_config_url", but i know of others who use a php-file. Does someone have an idea what i am doing wrong? some setting in config? thank you very much!
Ọ̀nà àbáyọ tí a yàn
Okay, you cannot add parameters to the URL directly; the URL is truncated at the question mark. Please see the following articles for a workaround:
- http://jpmens.net/2009/02/20/http-get-requests-in-mozillas-autoconfig-aka-loving-open-source/
- https://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/ (same method as above)
All Replies (11)
i add the script once more as an image.
the images are poor, i am sorry. don't know how to upload them with higher resolution.
First, is PHP running on localhost? What if you load that URL in a Firefox tab -- what does the response look like? If PHP is not running, you would expect right-click > View Page Info to show "text/plain" as the content type.
Second, if PHP is running, you might see the content type "text/html". To resolve that, specify a JavaScript content-type. For example:
<?php header('Content-Type: application/x-javascript; charset=utf-8'); $uid = $_GET["u"]; if ($uid == "1"){ echo 'pref("browser.startup.page", 1)'; } else { echo 'pref("browser.startup.page", 0)'; }; ?>
By the way, you need to use the HTML entity < in place of < to prevent the forum from eating your code.
i think i found out that the line $uid = $_GET["u"]; is the problem. If instead i say $uid = 1; it works. but how can this be? looks as if 'he' interprets some character as '<' .. how can i read the url-search part?
Ti ṣàtúnṣe
Hi carpinus, is Firefox not passing the query string on the URL? If you echo the entire query string, is it there?
hi, sorry but i do not know how to ... if i code in auto.php < ?php $que = $_SERVER["QUERY_STRING"]; echo $que; and in the location bar i enter localhost/php/auto.php?u=a .. then 'u=a' will appear. fine. but echo does not work the same when the containing script is called on firefox startup may be there is a way to echo to console or to some error log entering the sript on the urlbar with ff already running also $_GET() works fine.
just tried the following in auto.php:
<?php $fp = fopen("messages.txt","w"); $que = $_SERVER["QUERY_STRING"]; fwrite($fp, $que); $req = $_SERVER["REQUEST_URI"]; fwrite($fp, $req); fclose($fp);
and a file messages.txt appears, but it only contains the URI, without the search string
Ti ṣàtúnṣe
Ọ̀nà àbáyọ Tí a Yàn
Okay, you cannot add parameters to the URL directly; the URL is truncated at the question mark. Please see the following articles for a workaround:
yet .., $_GET() still doesnt work, strange
thank you for your information! should have come across that myself ..
would you like to have a look at my other question (1130736)? (from the fact that a refresh resolves the problem i conclude that places.sqlite is not damaged in my case)
Ti ṣàtúnṣe
I have unmarked the solution that makes it more likely jscher2000 will see your additional post. You may mark is as solved again if appropriate as soon as he posts back.
Your other posts are
- back/forward button does not work /questions/1130736
- where do i put mozilla.cfg/local-settings.js on my OS X 10.6.8 mac? /questions/1131989
I looked at the other thread and didn't really have any new ideas.