搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

php script does not work as autoadmin.global_config_url

more options

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!

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): <?php $uid = $_GET["u"]; if ($uid == "1") {echo 'pref("browser.startup.page", 1)'; } else {echo 'pref("browser.startup.page", 0)'; }; ?> 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!
附加的畫面擷圖

被選擇的解決方法

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:

從原來的回覆中察看解決方案 👍 0

所有回覆 (11)

more options

i add the script once more as an image.

more options

the images are poor, i am sorry. don't know how to upload them with higher resolution.

more options

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)'; }; ?>

more options

By the way, you need to use the HTML entity &lt; in place of < to prevent the forum from eating your code.

more options

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?

由 carpinus 於 修改

more options

Hi carpinus, is Firefox not passing the query string on the URL? If you echo the entire query string, is it there?

more options

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

由 carpinus 於 修改

more options

選擇的解決方法

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:

more options

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)

由 carpinus 於 修改

more options

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

more options

I looked at the other thread and didn't really have any new ideas.