oh_php_designer Posted February 16, 2015 Share Posted February 16, 2015 so when doing the following: $get_ignore_files = mysql_query("select file_name from ignore_files") or die(mysql_error()); $ignore_loopcounts=0; while ($row = mysql_fetch_array($get_ignore_files)) { $ignore_file = $row['file_name']; if($ignore_loopcounts ==0) { $_SESSION['ignore_file_string'].= "$"."file_to_scan == '".$ignore_file."'"; } else { $_SESSION['ignore_file_string'].= "||$"."file_to_scan == '".$ignore_file."'"; } $ignore_loopcounts=$ignore_loopcounts+1; } for $_session['ignore_files_string' I get the results: $file_to_scan == '/home/a2222/public_html/test2.txt' (file in my table) this is expected... when my if statement test it, it does not work if ( $file_to_scan == $_SESSION['log_file'] || $file_to_scan == $_SESSION['monitor'] || $file_to_scan == $_SESSION['monitor.ini'] || $file_to_scan == $_SESSION['monitor_detected_file'] || $file_to_scan == $_SESSION['root_path'].'/'.'class.phpmailer.php' || $file_to_scan == $_SESSION['root_path'].'/'.'class.smtp.php' does not work --> || $_SESSION['ignore_file_string'] but this does --> //|| $file_to_scan == '/home/a2222/public_html/test2.txt' ) if I echo out the session variable for ignore_file_string, it matches the line that works. what is going on ???? Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted February 16, 2015 Solution Share Posted February 16, 2015 if you are expecting php code that's been placed inside a variable to run, that's not how php works. perhaps the following example will give you an idea how you might accomplish this - $files[] = $_SESSION['log_file']; $files[] = $_SESSION['monitor']; $files[] = $_SESSION['monitor.ini']; $files[] = $_SESSION['monitor_detected_file']; $files[] = $_SESSION['root_path'].'/'.'class.phpmailer.php'; $files[] = $_SESSION['root_path'].'/'.'class.smtp.php'; // add any other entries you want to include in the test here... if ( in_array($file_to_scan,$files)) { // code to run if $file_to_scan matches any of the entries in the $files array } 1 Quote Link to comment Share on other sites More sharing options...
oh_php_designer Posted February 17, 2015 Author Share Posted February 17, 2015 mac_gyver thank you so much! I was thinking it would do that at runtime yes. Your idea was perfect and I appriciate your help ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.