FAQ Database Discussion Community

PHP: how to check if a given file has been included() inside a function

I have a PHP file that can be include'd() in various places inside another page. I want to know whether it has been included inside a function. How can I do this? Thanks.

include two PHP files in one html file is not working

I have two php files which are doing some database work so i want to show them on single page so i created an html file and include both of the php files, this methods work well every time i use but not working now, please help to solve. Both...

Include PHP File and execute it multiple times

Yeah I know this is probably not the best way to perform this. However I have a script which I would like to call multiple times with parameters and hand over two variables. The code I have so far looks like this: $testfeld = array('User1'=>'400028', 'User2'=>'400027' ); foreach($testfeld as $key=>$value)...

PHP include / undefined variable

I am aware there are more topics on this matter, I've read them, but I did not found the answer. I have an index.php, that contains a bunch of .php includes: header.php, navigation.php, box.php, footer.php, and inside the "pages" div, I have the one that needs to be different (based...

Global variable isn't accessible inside my Wordpress function. Why not?

I am working in wordpress, and have a function in functions.php. This is meant to set a number of variables based on the context the variable is used in. But there's a problem. I am using the function in an included template file, and the function is intended to work...

Is it required to include any files from gomoob:php-pushwooshto to run a PHP program to send push notifications to iPhone?

I want to send push notifications to iPhone devices by writing PHP code for it. gomoob:php-pushwoosh is a PHP Library that easily work with the pushwoosh REST Web Services. This is the URL for gomoob:php-pushwoosh As per the instructions I've installed gomoob:php-pushwoosh on my local machine using Composer at location...

Is it secure to use include() to connect to server and database?

Is it secure to use a PHP file with connection parameters, and include that file to the page? example: include("connect.php"); connect.php: $con=mysqli_connect('localhost','root','','database') or die(mysqli_connect_error($con)."- In line: ".__LINE__); mysqli_set_charset($con,'utf8'); ...

PHP Shuffle Include(ed) Files

I'm trying to use SHUFFLE function to show FILE1.php or FILE2.php at random. Here is my code: <?php $banner1 = include 'file1.php'; $banner2 = include 'file2.php'; $banners = array( $banner1, $banner2); shuffle($banners); print $banners[0] ?> The problem I have - if instead of doing include 'file1.php'; i just use text...