Combing include PHP files I have separate php files. I have a master file that I use by include these files like /include '1.php'; /include '2.php'; / include '3.php'; Now I want to combine this 3 file to one php file.How can I use them because in my master code there are 3 conditions,like condition 1 uses file 1.php condition 2 uses file 2.php and so on thanx Answer: Hi you can write your code this way <?php if(condition1) include('file1.php'); else if(condition2) include('file2.php');
undefined
Securing PHP files Hello and thanks to everyone for reading my question. I've been working on a PHP web program for a little while and was wondering what measures should I take to protect the source before putting it on a live server. The source isn't being distributed, it's being accessed through a website (users log into the website to use it). First I'd like to protect the source php files from being found and downloaded. I'm not using any framework, just php
undefined
rsync only *.php files How can I rsync mirror only *.php files? This gives me a bunch of empty dirs too and I don't want those. rsync -v -aze 'ssh ' \ --numeric-ids \ --delete \ --include '*/' \ --exclude '*' \ --include '*.php' \ user@site.com:/home/www/domain.com \ /Volumes/Servers/ Answer: The culprit here is the --include '*/' When including a wildcard followed by the trailing forward-slash you're telling rsync to transfer all files ending with a '/' (that is, all directories).Thus, rsync -v -aze
undefined
Downloading php files? Is it possible to download php files from the server where they are located? I am a beginner in web area, and I worry that hackers may have special tools to download, see my code and understand where I have programmed vulnerable codes to hack my site. Answer: If the server is properly configured and there are no security holes in the code then no, it's not possible. If you have something like echo file_get_contents($_GET['myFile']); then this could be used to get
undefined
Combining multiple php files The current code provided on previous question is working. I need help to modify it so I can tell it what php files to combine. The code below combines every .php file it finds in a directory. (ie: Need to combine only the following pages, page1.php, page2.php, page3.php, page4.php, page5.php, page6.php, page7.php, page8.php, page9.php, page10.php, page11.php, page12.php ) Thanks in advance. <?php foreach (glob("*.php") as $filename) { $code.=file_get_contents("./$filename"); } file_put_contents("./combined.php",$code); ?> Answer: If you know the file names and
undefined
Inserting Php Files I'm learning PHP and right now i'm learning how to add files. However, I'm having trouble importing for example, my header.php into my index.php file. My browser is stuck loading, and nothing is displayed. I have two php files; a footer.php and a header.php that i'm trying to include into a index.php Here's my code for Index.php <html> <head> <title><?php echo $page['title'];?></title> </head> <body> <div class="headerr"> <?php $page = array(); include 'footer.php'; ?> </div> <div> <h1> Hola </h1> <article> Nulla
undefined
Is there a static code analyzer [like Lint] for PHP files? Is there a static code analyzer for PHP files? The binary itself can check for syntax errors, but I'm looking for something that does more, like unused variable assignments, arrays that are assigned into without being initialized first, and possibly code style warnings. Open-source programs would be preferred, but we might convince the company to pay for something if it's highly recommended. Answer: Run php in lint-mode from the command line to