Jump to content

1RV34

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

1 Neutral

About 1RV34

  • Rank
    Newbie
  • Birthday 04/03/1993
  1. Combined the shutdown function & timestamp method a bit and came up with this: <?php $run = basename($_SERVER['PHP_SELF'], '.php') . '.run'; if (!file_exists($run) { touch($run); register_shutdown_function('shutdown', $run); $microtime = microtime(); file_put_contents($run, $microtime); } else { echo "Already running!"; exit; } // ... (some code) sleep($waitForFirstStartup);// dynamic calculated value while (file_exists($run) && file_get_contents($run) == $microtime) { // ... (rest of code) sleep($waitBetweenStuffToDo);// dynamic calculated value
  2. Ok threw out the complete css animation.. used javascript instead: function animation(elem) { var fullHeight = document.getElementById(elem).offsetHeight; document.getElementById(elem).style.height = 0; document.getElementById(elem).style.opacity = 0; var step = fullHeight / 80; var count = 0; var theInterval = setInterval(function () { count += step; document.getElementById(elem).style.height = count; if (count == fullHeight) { theInterval = clearInterval(theInterval); count = 0; var theInterval2 = setInterval(function () { count++; document.getElementById(elem).
  3. What do you mean?There is a long script on the position of // ... (rest of code) and I only want one instance of that script running at a time.It is a script that can run from 4 seconds to 15 minutes and I want to make sure it can't be run twice at the same time.
  4. I have seen a lot of ways to determen if a PHP script is already running but I wonder which solution is the best.Currently I'm using this: <?php $run = basename($_SERVER['PHP_SELF'], '.php') . '.run'; if (!file_exists($run) { touch($run); } else { echo "Already running!"; exit; } // ... (rest of code)?> But I already have seen a lot examples using pid's & sid's and everything. I'm sure my solution is not the best at all and so I'm asking you all to discuss your solutions with me.
  5. First i have 2 files, index.html and check.php, the index's source is:index.html <html><head> <title>potatoes</title> <style type="text/css">@-webkit-keyframes potatointro {0% { opacity: 0; }100% { opacity: 1; }}.potato {-webkit-animation: potatointro 1s;}</style> <script type="text/javascript">function loadXMLDoc() {var xmlhttp;if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest();}else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlhttp.onreadystatechange=function()
  6. I tried using intval() but it didn't help a thing at al. I already had tried bcsub() but it didn't work so now I tried gmp_sub() and that even returned that the function doesn't exist!Well I tried bcsub() again but this time I made the values strings & this time it did work! SolutionParse the values as strings and use bcsub().<?php $var = '76561197999467389';// will be dynamic $sum = bcsub($var, '76561197960265728');// will always be subtracted by the same value echo $sum;// returns 39201661?> Thanks you both for your help!
  7. i might could change the order of the conversion so i can subtract by less but the first is returned by another server & not determined by me so i cant do anything about thati will try it with intval() tomorrow, now im on my phone & cant access a computer
  8. yea they need to be so big & actually I don't think so either because I need it for an algorythm to convert a certain type of 64bit id to another type of id (but that one is a string & also I had no problems with the rest of the conversion, just this part)
  9. ProblemIt should return 39201661 but instead it returns 39201664. <?php $var = 76561197999467389;// will be dynamic $sum = $var - 76561197960265728;// will always be subtracted by the same value echo $sum;// returns 39201664?> What I've triedI've looked around & saw a function called bcsub() & tried to use that one but it returned 0.While looking around for an answer I also found out it might be caused by the storage of the numbers before subtraction. What I would like to knowIf it really is a storage problem, is there a workaround to get the right value anyway?If it isn't wh
×
×
  • Create New...