Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a log of redirected connection on a page
    text
    copied!<p>I have a system which go get a file on my server. To be able to easily change the file the system will get, I made a simple redirect on a php page.</p> <p>But now I want to keep tracks of which and when system connect. Each system now send their ID on GET when connecting to my page, but I m struggling to even write the file.</p> <p>The link called is <a href="http://mysite.com/smtg/get.php?i=XX:XX:XX:XX:XX:XX" rel="nofollow">http://mysite.com/smtg/get.php?i=XX:XX:XX:XX:XX:XX</a></p> <p>Which contain:</p> <pre class="lang-php prettyprint-override"><code>&lt;? $fp = fopen('http://mysite.com/smtg/log.txt','a+'); fseek($fp,SEEK_END); $w=$_GET['i']."\r\n"; fputs($fp,$w); fclose($fp); header('Location: http://mysite.com/smtg/file.txt', true, 302); exit(); ?&gt; </code></pre> <p>I ve even tried creating a empty file and putting it on the server, permission are 664, but it don t get updated.</p> <p>The redirect work from browser and system thought.</p> <p>EDIT:</p> <p>When removing the redirect, I get:</p> <pre><code>test Warning: fopen(/smtg/log.txt): failed to open stream: No such file or directory in /var/www/mysite.com/smtg/get.php on line 5 Warning: fseek() expects parameter 1 to be resource, boolean given in /var/www/mysite.com/smtg/get.php on line 6 Warning: fputs() expects parameter 1 to be resource, boolean given in /var/www/mysite.com/smtg/get.php on line 8 Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/mysite.com/smtg/get.php on line 9 </code></pre> <p>It seems it don t find the log file, but isn t it supposed to be created if missing?</p> <p>The file is on the server, empty but here (<a href="http://mysite.com/smtg/log.txt" rel="nofollow">http://mysite.com/smtg/log.txt</a>).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload