webForumDet fria alternativet

Php problem

2 svar · 268 visningar · startad av icarus

icarusMedlem sedan sep. 200327 inlägg
#1

Hej jag undrar varför denna kod funkar på min polare web php4 server och inte min web php5 server.

nån som vet va felet kan vara ?

<html>
<style>pre,body,input { font-family: Tahoma; font-size: 12px; } </style>
<title>File Search</title>
<body>

<form method="post" action="search.php">
Release name:

<input type="text" name="search" size="30"> <input type="submit" name="submit"><br> <br>
</form>
<pre>
<?php
$file = "mp3.txt";
$search = addslashes(trim($search));
$searcha = explode(" ", $search);

if ($search)
{
// Loads file to array
$fd=fopen("$file","r");
$i = 0;
while ($line=fgets($fd,1000))
{
$search_array[$i] = $line;
$i++;
}
fclose ($fd);

reset($search_array);
while (list($key, $val) = each($search_array))
{ $i = 0;
$notcorrect = FALSE;
reset ($searcha);
while (list($key1,$val1) = each($searcha))
{
// echo $searcha[$i];
if (!stristr($val, $searcha[$i]))
$notcorrect = TRUE;
$i++;
}
// echo $notcorrect;
if (!$notcorrect)
echo($val);
}
}
?>
</pre>
</body>
</html>

MatteMedlem sedan aug. 20002 975 inlägg
#2

Det kan vara att du har register_globals satt till Off (default).

Då får du använda $_POST['search'] istället för $search (vilket du bör göra i vilket fall).

icarusMedlem sedan sep. 200327 inlägg
#3

tack så hemskt mkt Matte!!!

138 ms totalt · 3 externa anrop · v20260731065814-full.3ab8d573
135 ms — hämta forumlista (db)
0 ms — hämta statistik (cache)
134 ms — hämta tråd, inlägg och bilagor (db)