If a user enters the website a interval (js) is running and calling PHP file every second (for updating text and images).
But if someone uploads an image, he/she gets redirected to the url with .php. I've entered a "header" at the bottom, to redirect the user back to page after uploading.
On desktop everything is working perfect. On Android the PHP code isn't working if the user returns.
gallery.php:
<?php
header( "Access-Control-Allow-Origin: *" );
$count = 0;
$oldcount = 0;
if ( $handle = opendir( "../../archive/images/" ) ){
while ( ( $file = readdir( $handle ) ) !== false ){
if ( !in_array( $file, array( ".", ".." ) ) && !is_dir( "../../archive/images/" . $file ) )
$count++;
}
}
if ( $count == $oldcount ){
exit;
}
else{
$oldcount = $count;
$count = 0;
$files = glob( "../../archive/images/" . "*.*" );
foreach( $files as $image ){
if ( $image ){
echo '<img src="' . $image . '" /></img>';
}
}
}
?>
Tested it on multiple Androids. Every time the same. Seems like it has a problem to call this code after uploading something.
setInterval(
function(){
$( "#gallery" ).load( "system/communicate/gallery.php" );
$( "#chat" ).load( "system/communicate/output.php" );
}, 1000 );
Any ideas why? Is this a known bug?
If you want to try, please do. Here is my url: www.m7-studios.de user/email: test, pw: test