I have config.php and function.php, I save it in the header.php file.
require 'func/config.php';
require 'func/function.web.php';
require 'func/action.web.php';
require 'func/Facebook/autoload.php';
require 'func/Google/vendor/autoload.php';
config.php :
$query_config = $server_conn->query("select * from site_config") or die ("Config Site : ".$server_conn->error);
$row_config = $query_config->fetch_assoc();
$about_config = $row_config['about_config'];
$kkp_config = $row_config['kkp_config'];
$hjkb_config = $row_config['hjkb_config'];
$pk_config = $row_config['pk_config'];
$fanspage_config = $row_config['fanspage_config'];
$twitter_config = $row_config['twitter_config'];
$youtube_config = $row_config['youtube_config'];
$address_config = $row_config['address_config'];
$phone_config = $row_config['phone_config'];
$email_config = $row_config['email_config'];
$appidfb_config = $row_config['appidfb_config'];
$appsecfb_config = $row_config['appsecfb_config'];
$callbackfb_config = $row_config['callbackfb_config'];
$appidgp_config = $row_config['appidgp_config'];
$appsecgp_config = $row_config['appsecgp_config'];
$callbackgp_config = $row_config['callbackgp_config'];
function.php : Pure Function
function InputForm($data, $server_conn){
$data = trim($data);
$data = strip_tags($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data = mysqli_real_escape_string($server_conn, $data);
return $data;
}
Function For including HTML WITH PHP
function breakingnews($server_conn){
$x = 0;
$result = SiteQuery($server_conn, "SELECT id_news,title_news
FROM data_news
WHERE breaking_news = '1'
ORDER BY time_news desc
LIMIT 10");
while ($row = $result->fetch_assoc()){
$x++;
if ($x === 1){
echo '<div class="carousel-item active">
<a href="'.RealURL().'infonews/'.$row['id_news'].'/'.text_dash($row['title_news']).'">
'.$row['title_news'].'
</a>
</div>';
} else {
echo '<div class="carousel-item">
<a href="'.RealURL().'infonews/'.$row['id_news'].'/'.text_dash($row['title_news']).'">
'.$row['title_news'].'
</a>
</div>';
}
}
}
action.php
if (isset($_POST['submit-deletecat'])){
if (isset($_SESSION['id_users'])){
$id_category = InputForm($_POST['submit-deletecat'], $server_conn);
$result = SiteQueryBind($server_conn, "DELETE FROM site_category WHERE id_category = ?", "i",
$id_category);
$message = $result;
} else {
$message = 'Please login first.';
}
echo "<script type='text/javascript'>alert('$message');</script>";
}
and require 'func/Facebook/autoload.php'; require 'func/Google/vendor/autoload.php'; this SDK from facebook and Google
Note : all the code above is an example that I took from each file, to clarify its usefulness.