Click here to Skip to main content
15,891,567 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Need to capture raw HTML and write to file any page displayed on browser Pin
Antone Eason22-Jul-09 23:10
professionalAntone Eason22-Jul-09 23:10 
Questionpersonal profile pages for every user Pin
dialogue6-Jul-09 8:00
dialogue6-Jul-09 8:00 
AnswerRe: personal profile pages for every user Pin
EliottA6-Jul-09 8:45
EliottA6-Jul-09 8:45 
AnswerRe: personal profile pages for every user Pin
Marc Firth9-Jul-09 2:47
Marc Firth9-Jul-09 2:47 
Questionbasic php help Pin
raycode20074-Jul-09 6:00
raycode20074-Jul-09 6:00 
AnswerRe: basic php help Pin
fly9044-Jul-09 12:51
fly9044-Jul-09 12:51 
AnswerRe: basic php help Pin
Marc Firth9-Jul-09 2:49
Marc Firth9-Jul-09 2:49 
GeneralArray loop / string comparison help Pin
Bryant May4-Jul-09 2:26
Bryant May4-Jul-09 2:26 
Hi everyone,

I'm relatively new to PHP and am experiencing a problem trying to loop through multiple arrays whilst comparing strings during each iteration of the loop.

What I have is two arrays; one with a list of illegal file names and one with a list of filenames pulled from a scandir function. Although it doesnt work this is what im trying to do:

$illegalArray = array(".php", ".html", ".sql");
$filesArray = array("general", "connect.php, "_sql", "test.sql");

foreach ($filesArray AS $f) // Loop through the file names array
{
foreach (illegalFiles AS $i) // Loop through the illegal file names array
{
if (strstr($f, $i) // Check to see if the the string held in $f contains any of the text held in $i
print "illegal file";
else
print "valid file";
}
}

Hopefully that kind of makes sense. Basically I want to loop through the files array, check to see if the file name contains the string held in the illegal array. If it does then do something, if it doesnt, do something else.

I can get it working to the point where it outputs a list of the files that it shouldnt include (the illegal files) but I cant get it to output a list of files that it should include (from the $filesArray these would be the "general" and "_sql" file names).

If anyone can shed any light on what I am doing wrong here I would be eternally grateful.

Thanks for reading (sorry about the length)

Bryant
GeneralRe: Array loop / string comparison help Pin
fly9044-Jul-09 2:57
fly9044-Jul-09 2:57 
GeneralRe: Array loop / string comparison help Pin
Bryant May4-Jul-09 3:03
Bryant May4-Jul-09 3:03 
Questionproblem in inserting the data in database Pin
pallavi shrivastava4-Jul-09 2:03
pallavi shrivastava4-Jul-09 2:03 
AnswerRe: problem in inserting the data in database Pin
fly9044-Jul-09 2:22
fly9044-Jul-09 2:22 
Questionphp project? Pin
Ali_1003-Jul-09 20:58
Ali_1003-Jul-09 20:58 
AnswerRe: php project? Pin
fly9043-Jul-09 21:54
fly9043-Jul-09 21:54 
Questionjoomla,pearl, etc? Pin
Ali_1003-Jul-09 20:50
Ali_1003-Jul-09 20:50 
AnswerRe: joomla,pearl, etc? Pin
fly9043-Jul-09 21:53
fly9043-Jul-09 21:53 
QuestionCovert singleton class for php 4.4.4 to php 5.2 [modified] Pin
malrajphp1-Jul-09 22:11
malrajphp1-Jul-09 22:11 
AnswerRe: Covert singleton class for php 4.4.4 to php 5.2 Pin
Marc Firth2-Jul-09 4:17
Marc Firth2-Jul-09 4:17 
QuestionNew to PHP Pin
NimishaLad30-Jun-09 8:44
NimishaLad30-Jun-09 8:44 
AnswerRe: New to PHP Pin
EliottA30-Jun-09 9:20
EliottA30-Jun-09 9:20 
AnswerRe: New to PHP [modified] Pin
Marc Firth30-Jun-09 23:40
Marc Firth30-Jun-09 23:40 
AnswerRe: New to PHP Pin
malrajphp2-Jul-09 4:02
malrajphp2-Jul-09 4:02 
AnswerRe: New to PHP Pin
SandipG 3-Jul-09 2:39
SandipG 3-Jul-09 2:39 
QuestionPHP help - unsure how to approach the unique needs for a random order script for a project Pin
Chris Averill30-Jun-09 3:22
Chris Averill30-Jun-09 3:22 
AnswerRe: PHP help - unsure how to approach the unique needs for a random order script for a project Pin
Luc Pattyn30-Jun-09 4:12
sitebuilderLuc Pattyn30-Jun-09 4:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.