Advertisement
Guest User

Ejemplo ancho alto con php

a guest
Apr 21st, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(isset($_POST['width'])){
  4.    $_SESSION['screen_size'] = array();
  5.    $_SESSION['screen_size']['width'] = intval($_POST['width']);
  6.    $_SESSION['screen_size']['height'] = intval($_POST['height']);
  7. }
  8.  
  9.  
  10. if(!isset($_SESSION['screen_size'])){
  11. ?>
  12. <!DOCTYPE html>
  13.  
  14. <html lang="es">
  15. <head>
  16.     <meta charset="utf-8">
  17. <script>
  18. function getSize(){
  19. document.getElementById('inp_width').value=screen.width;
  20. document.getElementById('inp_height').value=screen.height;
  21. document.getElementById('form_size').submit();
  22. }
  23. </script>
  24. </head>
  25. <body onload='getSize()'>
  26. <form method='post' id='form_size'>
  27. <input type='hidden' name='width' id='inp_width'/>
  28. <input type='hidden' name='height' id='inp_height'/>
  29. </form>
  30. </body>
  31. </html>
  32.  
  33.  
  34. <?php
  35. }else{
  36.     var_dump($_SESSION['screen_size']);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement