/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Hvad er der galt her??
Fra : Bertel Torp


Dato : 03-02-02 14:35

Browser siger:
Warning: Undefined variable: PHP_AUTH_USER in c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php on line 16

Warning: Undefined variable: l46 in c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php on line 9

Warning: Cannot add header information - headers already sent by
(output
started at c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php:16) in
c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php on line 9

Warning: Cannot add header information - headers already sent by
(output
started at c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php:16) in
c:\apache
webserver\apache\htdocs\nntpweb\nntpweb\settings.php on line 10
Forbidden.

I filen står:
<?php
require("./functions.php");



function authHeaders() {
global $l45;

header("WWW-Authenticate: Basic realm=\"$l46\"");
header("HTTP/1.0 401 Unauthorized");

echo $l45;
exit;
}

if ($PHP_AUTH_USER != $adminUser || crypt($PHP_AUTH_PW, "s") !=
$adminPassword) {
authHeaders();
}



pageHeader();
dbConnect();

if ($submitSettings) {
if (!$setUser || !$setNntpHost || !$setSqlHost ||
!$setSqlDatabase) {
error($l34);
}

$passwordContents = ($newPassword) ? crypt($setPassword, "s") :
$adminPassword;

$fileContents = "<?php\n";
$fileContents .= "\$language = \"$setLanguage\";\n";
$fileContents .= "\$adminUser = \"$setUser\";\n";
$fileContents .= "\$adminPassword = '$passwordContents';\n";
$fileContents .= "\$nntpHost = \"$setNntpHost\";\n";
$fileContents .= "\$nntpPort = \"$setNntpPort\";\n";
$fileContents .= "\$sqlHost = \"$setSqlHost\";\n";
$fileContents .= "\$sqlUser = \"$setSqlUser\";\n";
$fileContents .= "\$sqlPassword = \"$setSqlPassword\";\n";
$fileContents .= "\$sqlDatabase = \"$setSqlDatabase\";\n";
$fileContents .= "?>";

$writeFp = fopen("./settingsSaved.php", "w") or error($l35);
fwrite($writeFp, $fileContents);

echo "$l36<br/><br/>\n";
echo "<a href='javascript:history.back()'>$l3</a>\n";

pageFooter();
exit;
}



if ($addGroup) {
if (!ereg("^[a-zA-Z0-9.+-]+$", $addGroup)) error($l22);

$groupSql = noSpecialChars($addGroup);

# Testing if the group is already on the list of subscribed
# groups:
$query = mysql_query("select newsgroup from subscribed where
newsgroup =
'".addslashes($addGroup)."'") or error("$l6
<i>".mysql_error()."</i>");
if (mysql_num_rows($query) > 0) error($l20);



# Notice the varchar definition of the reference column: It's
# only 252 characters. That's because MySQL won't allow indexes
# on varchars with more than 252 characters.
mysql_query("create table $groupSql (
id int not null auto_increment,
messageId varchar(255),
reference varchar(252) not null,
date datetime,
sender varchar(255),
subject varchar(255),
primary key (
id
),
index (
reference
)
)") or error("$l6 <i>".mysql_error()."</i>");

mysql_query("insert into subscribed (
newsgroup
)
values (
'".addslashes($addGroup)."'
)") or error("$l6 <i>".mysql_error()."</i>");
}



if ($deleteGroup) {
for ($i = 0; $i < sizeof($deleteGroup); $i++) {
mysql_query("drop table
".addslashes(noSpecialChars($deleteGroup[$i]))."")
or error("$l6 <i>".mysql_error()."</i>");
mysql_query("delete from subscribed where newsgroup =
'".addslashes($deleteGroup[$i])."'") or error("$l6
<i>".mysql_error()."</i>");
}
}



echo "<hr noshade='noshade'>\n";
echo "<span class='bigger'>$l24</span><br/><br/>\n";

echo "<form action='$PHP_SELF' method='post'>\n";
echo "<table $tableAttributes>\n";

echo "<tr>\n";
echo "<td>$l33</td>\n";
echo "<td>\n";
echo "<select name='setLanguage'>\n";
$handle = opendir("./languageFiles");
while ($file = readdir($handle)) {
if (is_dir($file)) continue;

# Removing the file extension:
$thisLanguage = substr($file, 0, strrpos($file, "."));

printf("<option
value='$thisLanguage'%s>$thisLanguage</option>\n",
($language == $thisLanguage) ? " selected='selected'" : "");
}
echo "</select>\n";
echo "</td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l31</td>\n";
echo "<td><input type='text' name='setUser'
value='$adminUser'/></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l32</td>\n";
echo "<td>\n";
echo "<input type='radio' name='newPassword' value='0'
checked='checked'
onclick='this.form.setPassword.disabled = true'/> $l43<br/>\n";
echo "<input type='radio' name='newPassword' value='1'
onclick='this.form.setPassword.disabled = false;
this.form.setPassword.focus()'/> $l44<br/>\n";
echo "<input type='password' name='setPassword'
disabled='disabled'/>\n";
echo "</td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l29</td>\n";
echo "<td><input type='text' name='setNntpHost'
value='$nntpHost'/></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l30</td>\n";
printf("<td><input type='text' name='setNntpPort'
value='%s'/></td>\n",
($nntpPort) ? $nntpPort : 119);
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l25</td>\n";
printf("<td><input type='text' name='setSqlHost'
value='%s'/></td>\n",
($sqlHost) ? $sqlHost : "localhost");
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l26</td>\n";
echo "<td><input type='text' name='setSqlUser'
value='$sqlUser'/></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l27</td>\n";
echo "<td><input type='password' name='setSqlPassword'
value='$sqlPassword'/></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td>$l28</td>\n";
echo "<td><input type='text' name='setSqlDatabase'
value='$sqlDatabase'/></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td></td>\n";
echo "<td><input type='submit' name='submitSettings' value='$l19'
class='button'/></td>\n";
echo "</tr>\n";

echo "</table>\n";
echo "</form>\n";



echo "<hr noshade='noshade'>\n";
echo "<span class='bigger'>$l23</span><br/><br/>\n";

echo "<script type='text/javascript'>\n";
echo "function confirmDeleteGroup() {\n";
echo " return (confirm(\"$l21\")) ? true : false;\n";
echo "}\n";
echo "</script>\n";

echo "<form action='$PHP_SELF' method='post'>\n";
echo "$l17<br/>\n";
echo "<input type='text' name='addGroup'/><br/>\n";
echo "<input type='submit' value='$l19' class='button'/>\n";
echo "</form><br/><br/>\n";

echo "<form action='$PHP_SELF' id='formDeleteGroup' method='post'
onsubmit='return confirmDeleteGroup()'>\n";
echo "$l18<br/>\n";
echo "<select name='deleteGroup[]' size='5'
multiple='multiple'>\n";
showSubscribed();
echo "</select><br/>\n";
echo "<input type='submit' name='submitDeleteGroup' value='$l19'
class='button'/>\n";
echo "</form>\n";

pageFooter();
?>

Hvad er der galt??
Svar venligst per e-mail, men ellers her i i gruppen.
På forhånd tak
Mvh Bertel Torp
the@webhiker.dk
Ps. Beoplayer er et flop (www.beoplayer.com) men jeg bruger det
aligevel!


--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP ???
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! => http://www.html.dk/tutorials

 
 
Jonas Koch Bentzen (03-02-2002)
Kommentar
Fra : Jonas Koch Bentzen


Dato : 03-02-02 15:12

Bertel Torp skrev:

> Browser siger:
> Warning: Undefined variable: PHP_AUTH_USER

Jeg tror, problemet er, at PHP på din server er sat op til at udskrive
bemærkninger (notices), når en variabel ikke er sat. Det kan (vistnok)
slås fra sådan her (indsæt koden øverst i scriptet):

error_reporting(E_ALL ^ E_NOTICE);

> Svar venligst per e-mail, men ellers her i i gruppen.

Niks. Hvis du vil have support uden selv at hjælpe andre i gruppen eller
i det mindste selv tjekke svarene i gruppen, så kan vi godt aftale en
timepris...

--
Jonas Koch Bentzen

http://understroem.dk/

Christian Schmidt (03-02-2002)
Kommentar
Fra : Christian Schmidt


Dato : 03-02-02 15:19

Bertel Torp wrote:
>
> Browser siger:
> Warning: Undefined variable: PHP_AUTH_USER in c:\apache
> webserver\apache\htdocs\nntpweb\nntpweb\settings.php on line 16

Det betyder, at du forsøger at læse en variabel, du ikke har defineret
forinden. En variabel defineres, når den tildeles en værdi.

Normalt vil PHP ikke brokke sig, når du forsøger at tilgå en
ikke-defineret variabel. Men din installation er åbenbart sat op til at
være mere kritisk. Dette kan ændres fra såvel htaccess-filer, i php.ini
og inde i selve dit script.

http://dk.php.net/manual/en/html/features.error-handling.html


Jeg kan nu anbefale at slå alle advarsler til. Dels er det med det til
at fange trykfejl under programmeringen, men det kan også være med til
at afsløre evt. sikkerhedshuller i din kode.


Christian

Søg
Reklame
Statistik
Spørgsmål : 177560
Tips : 31968
Nyheder : 719565
Indlæg : 6408941
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste