Hello.
I started testing ExeOutput for PHP and I have some doubts that I detail below.
My project is more complex but as an example I show two scripts called Client1.html and Server1.php
The screen of Client1.html has two fields and a button as shown:
And this is the code:
Client1 form { width:400px; height:auto; margin:20px; resize: none; background-color:gray; padding:20px; } input {text-align:right; }</head>
<body onLoad="init();">
<form name="f">
Client Time: <input type="text" name="ctime" size="30"/>
<br/><br/>
Server Time: <textarea id="stime" name="stim" rows="2" cols="30" style="overflow:auto;resize:none"></textarea>
<br/><br/>
<input type="button" value="Start" onClick="serveron();">
</p>
</form>
</body>
And Server1.php code is this:
<?php set_time_limit (0); error_reporting(E_ALL); $comand = $_POST['comand']; $crlf = chr(13).chr(10); //CRLF $t3 = 0; $t2 = 0; $t1 = time(); $ho = date ("h:i:s",time ()); if (!isset($comand)){ $t2 = $t1 + 10; //if not comand, set time to 10 Sec } else { $t3 = intval(trim($comand)); // $t2 = $t1 + $t3; // } //--- Starting $_post temporized loop while ($t2 > $t1){ $t1 = time(); $ho = date ("h:i:s",time ()); $dt = $t2 - $t1; $b = fopen("sermsg.txt", "w"); //report Server1 status fwrite($b, "S1-Time: ".$ho.$crlf."TimeOut: ".$dt.$crlf); fclose($b); usleep(1000000); //sleep 1 Sec. } $b = fopen("sermsg.txt", "w"); //Server1 out msg fwrite($b, "S1 Out: ".$ho.$crlf."TimeOut: ".$dt.$crlf); fclose($b); ?>Client Time field on Client1.html shows the local time clock using the functions:
setInterval(showwatch,1000);
and:
function showwatch()
{
var t = new Date();
var m = "";
var s = "";
if (t.getMinutes() < 10) {
m = "0"; }
if (t.getSeconds() < 10) {
s = "0"; }
document.f.ctime.value = "["+tflag+"] "+t.getHours()+":"+m+t.getMinutes()+":"+s+t.getSeconds();
…
and Time Server field displays the server time clock Server1.PHP using jQuery function:
$('#stime').load('sermsg.txt');
In sermsg.txt text file, the Server1.php records a string informing his local time and timeout (remaining execution time in seconds) with the code:
fwrite($b, "S1-Time: ".$ho.$crlf."TimeOut: ".$dt.$crlf);
The starting instant and execution time on Server 1.php are passed when the Start button is pressed, through the code:
comand = "60" // 1 min. execution time
urlser = "http://localhost/server1.php"; //
sendComand(comand, urlser); // AJAX Object called
and invoking the Ajax object, is passed the time seconds parameter to Server1.php, charging it as a variable loop execution.
During the time the Server1.php are running the loop, shown in the Time Server field, his local time clock and decreasing his counter Time Out
When the loop ends, S1 Out and TimeOut: 0 are shown in Time Server field.
This example with these two scripts works perfectly on localhost environment (folder C: \ wamp \ www).
The localhost folder is showen:
But about EXEOUTPUT for PHP, It does not work if both scripts are compiled together with ExeOutput creating a single Client1.exe with Server1.php embedded, and I understand that is because both scripts run simultaneously while Server1 is in execution time.
As a possible solution, would try to compile both scripts separated, ¿or may be another suggestion?
So ¿what would be the changes in the code of both scripts Client1 and Server1 that allow them to run as Client1.exe as Server1.exe in the same way that scripts work on localhost environment?
Thanks in advance