i have a problem including MySQL connection file into my 'functions.inc.php'. If i require inside my functions, it works, but functions doesn't work if i include into another page. Like this:
function AddToVoteLogs($server_ip){
include_once 'dbh.inc.php'; // WORK
CODE ...
}
include_once 'dbh.inc.php'; // dont work
function AddToVoteLogs($server_ip){
CODE ...
}
I try to do with _ DIR _ still dont work. Another problem. My functions work in functions.inc.php page but dont work in another pages.
function AddToVoteLogs($server_ip){
include_once 'dbh.inc.php'; // WORK
$Zip = getUserIP();
$sql = "SELECT last_vote FROM votes WHERE IP = '$Zip';";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
if (time() - 86400 >= $row['last_vote']) {
$hoursIn = 1;
}
else {
$hoursIn = 0;
}
}
date_default_timezone_set('Europe/Vilnius');
$dates = date("Y-m-d H:i:s");
$ipas = getUserIP();
$sqla = "INSERT INTO vote_log VALUES ('$dates', '$ipas', '$server_ip', $hoursIn);";
$result = mysqli_query($conn, $sqla);
}