• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC js to get screen and pass to PHP

Webo

Otland 4ever
Joined
Oct 20, 2013
Messages
621
Solutions
10
Reaction score
229
Location
Warsaw
How to use js to get the width and height of the screen and pass to PHP?


PHP:
<?php
if (isset($_GET['width']) && isset($_GET['height'])) {
    echo "width".$_GET['width']." ";
    echo "height ".$_GET['height'];
} else {
    echo '<scpt type="text/javascript">';
    echo 'location.href="';
    echo $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
    echo '&width=" + screen.width + "&height=" + screen.height'."\n";
    echo "</scpt>\n";
    die();
}
?>
 
I dont get what you are trying to do. That example might work. Whats wrong?
PHP:
function checkPhoto(target) {
    if(target.files[0].type.indexOf("image") == -1) {
        document.getElementById("photoLabel").innerHTML = "File not supported";
        return false;
    }
    if(target.files[0].size > 102400) {
        document.getElementById("photoLabel").innerHTML = "Image too big (max 100kb)";
        return false;
    }
    document.getElementById("photoLabel").innerHTML = "";
    return true;
}
 
Javascript:
JavaScript:
var w = window.innerWidth;
var h = window.innerHeight;

Pass from Java to PHP by doing POST/GET request
 
Back
Top