Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 799  / 3 Years ago, sat, august 21, 2021, 10:11:49

I am using Ubuntu Server 14.04 on my server. I have a PHP file that contains some script/code that I want to run when I turn my serveron.

I want to run this XXXXXX.php file on my server startup before login not after login.

I didnt have any desktop so tell me the process through terminal. My desired PHP file that I want to run is in /var/www/XXXXXX.php folder.



Now can I do it?



Edit: My XXXXXX.php contain the following codes...



<?php 
$externalIp = file_get_contents('http://phihag.de/ip/');
?>
<form action="Iframe.php" method="post" enctype="plain" id="theForm">
<input type="text" name="My_IP" value="<?php echo $externalIp;?>" />
<input type="submit" value="Send" />
</form>
<script type="text/javascript">
window.onload = function() {
var form = document.getElementById("theForm");
form.submit();
}
</script>

More From » boot

 Answers
3

You may have thought that the solution is just around the corner, but I think you need to go one step back.



What you need to do appears to be a kind of automatic registration. Smart idea, yet... your current approach will require a browser supporting JavaScript.



I think I would do that differently. At the end of the day, all you need to do is issue the POST command which the browser sends.



That's much easier than all the PHP and JavaScript.




[#23894] Sunday, August 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oraoming

Total Points: 354
Total Questions: 105
Total Answers: 124

Location: Iraq
Member since Sat, Apr 3, 2021
3 Years ago
oraoming questions
Fri, Aug 20, 21, 10:08, 3 Years ago
Mon, May 24, 21, 21:56, 3 Years ago
Mon, Dec 12, 22, 23:21, 1 Year ago
Mon, Sep 12, 22, 11:38, 2 Years ago
;