Jump to content

MacDknife

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by MacDknife

  1. Here you can see the finished result: https://www.skglimma.se/ Admittedly not as integrated and nice as before, but it works. Now I know I can make it work and I should do in other contexts. ๐Ÿ˜‹ /MacD
  2. Thank you for your input, kicken, but it still is not helping me get anywhere! I did not show a progress bar as you surmised in you reply, only a revolving loading gif, which you would have seen if you had tried the script i posted.Try it and see! Look, I am neither only a back end developer or only a front end developer, but both, which one has to be to be a website developer. That is what made me fall in love with PHP. Yes, it is a back end language, but it played nicely with most front end languages. (That is what also has made it so popular!) PHP allowed one to be creative on the front end, while at the same time taking care of back end services in a secure and yet easy manner. If it is now going to be stricter in it's script interpretation, as well as giving itself higher priority (for security or for whatever reason) and this whole collaboration with front end languages falls apart, then it will no longer be a viable programming language for me. I do not want to get so deep into a programming language where I am handling memory buffers just to get an output to the screen. We should be SO far past that in 2020, otherwise we might as well return to Basic or machine language. I have taken a video of the website startup on my laptop, where the "loading gif" script still functions, as well as a photo of the WAMP admin window, showing all the versions. I have done the same thing on the PC, where the "loading gif" script is not functioning as it should, in spite of using the exact same four files from the laptop that deal with this function. The laptop has an older WAMP version, with PHP 7.2. The PCs version is of course newer and more compatible with the live server with PHP 7.4., but as you can see in the photo, I have even tried with the earliest version 5.6. I have posted these fotos and videos on that website, as they are larger than allowed on this system. You may look at them at your own discretion. (I apologize before hand for the fan sound in the background): https://www.skglimma.se/Uploads/20201026_laptop.jpg https://www.skglimma.se/Uploads/20201026_laptop.mp4 https://www.skglimma.se/Uploads/20201026_PC.jpg https://www.skglimma.se/Uploads/20201026_PC.mp4 OBS! I believe I have solved this, with the help script ideas found on the net, my game programming son and a friend of his, as well as some testing and I have managed to get it to work, at least in a test environment. I figured if my scripts are initiated in PHP (who no longer plays nicely) on the server, then perhaps I should initiate the script with a front end language instead. Using the same test script as before with a couple of tweaks using an iframe and creating two separate pages I got this result: HTML initiater (Loading.html): <!DOCTYPE html> <html> <head> <TITLE></TITLE> <script> var ld=(document.all); var ns4=document.layers; var ns6=document.getElementById && !document.all; var ie4=document.all; if (ns4){ ld=document.loading; }else if (ns6){ ld=document.getElementById("loading").style; }else if (ie4){ ld=document.all.loading.style; } function init(){ if(ns4){ ld.visibility="hidden"; }else if (ns6 || ie4){ ld.display="none"; } } </script> </head> <body onLoad="init()"> <div align="center" id="loading"><img src="Loading_200x200.gif" width="150" height="150" border="0"></div> <iframe src="Stuff.php" id='iframe' style="width: 100%; height: 92vh; overflow:hidden;" frameborder="0" scrolling="no" allowtransparency="true"></iframe> </body> </html> The PHP "working" page (Stuff.php): <?php // PHP stuff $Time = ""; $Latest = ""; // echo "(1) Time = $Time<br>Latest = $Latest<br><br>"; echo "<script>alert('(1) Time = $Time\\n\\nLatest = $Latest');</script>"; if($Time != ""){$Latest = date('Y-m-d', $Time);}else{$Latest = date('Y-m-d');} // sleep(7); echo "<script>parent.document.getElementById(\"iframe\").style.display = \"none\";</script>"; echo "<script>parent.document.getElementById(\"loading\").style.display = \"none\";</script>"; // echo "(2) Time = $Time<br>Latest = $Latest<br><br>"; echo "<script>alert('(2) Time = $Time\\n\\nLatest = $Latest');</script>"; ?> The HTML page shows the gif and loads the PHP through an iframe. Being completely separate from the HTML page, PHP only starts now, doing the work and then removing the iframe and loading gif and carrying on to whatever. Sure, this now has to be implemented into the real script, but it is a 90% improvement to where I was before. Yes, I understand this is probably "a fundamentally flawed idea" and not sanctioned as "an officially supported feature" and I don't really like to use HTML as an initiating source because of security, but life it what life is. Sometimes you have to get down and dirty to make things function. Right now, having just moved all of my sites to a new web hotel AND from a http environment to a https environment and all that that entails. I don't have time for niceties and pure script, just hopefully something that will hopefully last a couple of versions into the future, until I can fix it or adapt it to whatever the environment is then. I know this issue is probably not completely solved as of this moment, but it is good enough for me right now. I consider the case closed. Thanks for all the input everyone and I wish you all "a good one"! ๐Ÿค—๐Ÿ˜Ž /MacD
  3. Thank you gw1500se and kicken for your replies. Both of you are still concentrating too much on the loading script, which actually functions quite well.Try this script below, because it pretty much explains the issue. (the loading gif is attached). Try first removing the script under PHP stuff and look at the result, then put it back. Test it again. Now remove the slashes before sleep() and test again. Even try just echoing the text, instead of using the javascript alert. <?php echo " <!DOCTYPE html> <html> <head> <TITLE></TITLE> <style> .hidden {display:none;} .visible {display:block;} </style> <script> var ld=(document.all); var ns4=document.layers; var ns6=document.getElementById && !document.all; var ie4=document.all; if (ns4){ ld=document.loading; }else if (ns6){ ld=document.getElementById(\"loading\").style; }else if (ie4){ ld=document.all.loading.style; } function init(){ if(ns4){ ld.visibility=\"hidden\"; }else if (ns6 || ie4){ ld.display=\"none\"; } } </script> </head> <body onLoad=\"init()\"> <div style=\"position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);\" id=\"loading\"><img src=\"Loading_200x200.gif\" width=\"150\" height=\"150\" border=\"0\"></div> </body> </html>"; // PHP stuff $Time = ""; $Latest = ""; // echo "(1) Time = $Time<br>Latest = $Latest<br><br>"; echo "<script>alert('(1) Time = $Time\\n\\nLatest = $Latest');</script>"; if($Time != ""){$Latest = date('Y-m-d', $Time);}else{$Latest = date('Y-m-d');} // sleep(7); echo "<script>document.getElementById(\"loading\").style.display = \"none\";</script>"; // echo "(2) Time = $Time<br>Latest = $Latest<br><br>"; echo "<script>alert('(2) Time = $Time\\n\\nLatest = $Latest');</script>"; ?> Please notice how the output differs all the time, but does not actually follow the scripts "timeline". (I am a self-taught programmer so I might not be using the correct terminology, but I am sure you are all intelligent enough to know what I am talking about). I expect a programming result to be pretty linear, following the script. Do you think that PHP does this when it does it's output to the screen? This was not the case with PHP earlier as it actually did try to do that. So, if I understand you correctly kicken, I must now first put all the information I want on a separate page that loads the gif and then executes the script. Well, this script was a first test for just that and see how that turned out! All you have to do is replace sleep() with some other PHP script on a separate page using REQUIRE() or some similar command. Sure, I can try ajax/fetch(), but will it make PHP behave differently? Has anyone actually tried doing this and getting a result that does not leave a blank screen until the PHP script is executed on the page? If the PHP "working" script only takes 1-2 seconds, it does not matter, but my "working" script actually takes about 15 seconds. I reads the complete file structure to find the latest altered files and saves the data in a database, which I then retrieve to automatically show when a website has been updated. It functioned perfectly until I moved the website to a secure https web hotel. that is when I started having issues with the blank page. The way I feel right now is just to scrap the whole effort. It is quicker to just change the ยค#"ยค% date manually, because I thought there would be a quick fix. So PLEASE try to understand what I'm getting at, so that I know if this is a solvable issue. Thanks again in advance, Mac
  4. I keep on telling you that and you keep on concentrating on this loading gif script. That is why I did not have it as text in the first place! AS this function executes on the client and not on the server, the script cannot be pure PHP, but can be embedded in PHP. THAT is the reason for the function being written in HTML and Javascript, but it is NOT the issue! (If I could have written this function in PHP I would have.) The issue is with PHP not releasing output to the screen when directed to do so. I am not the only one. Just do a search on this issue on the net and you will find many with the same issue, but as yet no viable solution for the latest PHP versions. In my case I want to show this loader gif, but it does not have to specifically be a loader gif. It can be anything that needs to be outputted to the screen during PHP script execution. One could previously e.g. use ob_flush()+flush() to do a direct output in PHP, if the function did not do so by itself (which it did in my case). This no longer occurs in PHP! But whether this is a specific PHP issue, or a cooperation issue between PHP and Apache (as I have written earlier), I don't know. THAT is why I asked if anyone knows of this issue or has had personal experience with it so that I may receive a solution, or at least an explanation to why this is. I know the later PHP versions handle scripts much more strictly, but they shouldn't be so strict as to stifle viable functions, because I really cannot understand the reason for not displaying information (performing a direct output), exactly when asked to do so in the script. It could be a security issue, sure, but then what is the reason for not displaying output instantly, but only when the script is completed? There might be completely different working solutions out there right now, adapted to the latest versions of PHP. The problem is that the net is SO cluttered with old solutions from 2 years back or more, so it is almost impossible to find a current one. That is the reason for my turning to PHP Freaks for help. Thanks again in advance, Mac
  5. Sorry. Here you go: <?php echo " <!DOCTYPE html> <html> <head> <TITLE></TITLE> <script> var ld=(document.all); var ns4=document.layers; var ns6=document.getElementById && !document.all; var ie4=document.all; if (ns4){ ld=document.loading; }else if (ns6){ ld=document.getElementById(\"loading\").style; }else if (ie4){ ld=document.all.loading.style; } function init(){ if(ns4){ ld.visibility=\"hidden\"; }else if (ns6 || ie4){ ld.display=\"none\"; } } </script> </head> <body style=\"background-color: rgb(0, 0, 0);\" onLoad=\"init()\"> <div align=\"center\" id=\"loading\"><img src=\"images/Animeringar/Loading_200x200.gif\" width=\"150\" height=\"150\" border=\"0\"></div> </body> </html> I do not think the problem is with the actual script, except perhaps not being adapted to the changes in the latest versions of PHP. Like I said before, it functions as a stand alone script. It does not when PHP has do execute other script first. That is why I am going to try with at HTML startup page, that executes this script first and then opens the next php page. It is just that I feel it might compromise my security if I do this. ๐Ÿค” Mac
  6. Hi! This code, which is basically HTML and Javascript, echoed in PHP (as you can see in the attached image), has functioned well for a long time. It still does, if put in a page by itself. The problem now is when it is integrated in other PHP scripts. It does not work this way on either the live server or on WAMP anymore. This script is normally setup to be execute about half way through the complete script of the page and has functioned well, showing approx. the top half of the page, as well as a loading gif. When the PHP workload is complete, the loading gif is removed and the rest of the page is displayed. Now with the later versions of PHP, all I see is a blank page until all the script is executed, which can take about 15 seconds or more. PHP does not release the information to Apache, or if it does, Apache does not do anything with it. I have tried different approaches, using ob_flush() and so on, but it just will not function. I would like to know if someone else has had this issue, or knows about it and if there is any current solution. I have not managed to find any working solution that will work with PHP 7.4 and in the future, on the net. I know one cannot predict all the changes that will occur with PHP in the future, but I would like the solution to function for at least 3-5 future versions. I am now going to try something completely different outside the box and create a start page instead. If it does work, it will just be a temporary solution though. Thanks for any assistance beforehand. Mac
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.