---
title: "Php problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/98143-php-problem"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "icarus"
published: "2004-02-24T23:04:46.000Z"
updated: "2004-02-25T00:35:31.000Z"
replies: 2
views: 270
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/98143-php-problem"
---

# Php problem

## #1 — icarus, 2004-02-24T23:04Z

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\>

Permalänk: https://www.webforum.nu/p/98143

## #2 — Matte, 2004-02-24T23:13Z

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).

Permalänk: https://www.webforum.nu/p/1285687

## #3 — icarus, 2004-02-25T00:35Z

tack så hemskt mkt Matte!!!

Permalänk: https://www.webforum.nu/p/1285703

---

Tråden på webben: https://www.webforum.nu/amne/php/98143-php-problem
