2019-06-18 03:18
浏览 32


I've written scripts to capture the IP address of a user with the time as well as to capture the username with the time but I've tried combining these and I'm having some errors with the $text

It's almost there, just not sure why this is wrong.

$user = $_POST["PHP_AUTH_USER"];
$timestamp =date('d/m/Y H:i');
$text = "{$user} Logged in as: {$_SERVER['PHP_AUTH_USER']} at: {$timestamp} With IP: {$_SERVER['REMOTE_ADDR']
$file = fopen("./users.txt","a+ 
fwrite($file, $text);

Any help so that this saves and the page actually loads would be great. Thanks in advance.

图片转代码服务由CSDN问答提供 功能建议

我编写了脚本来捕获用户的IP地址,并使用时间捕获用户名 时间,但我已经尝试结合这些,我有一些错误的 $ text


 $ user = $ _POST [“PHP_AUTH_USER”]; 
 $ timestamp = date('d / m / YH:i'); \  n $ text =“{$ user}登录为:{$ _SERVER ['PHP_AUTH_USER']} at:{$ timestamp}使用IP:{$ _SERVER ['REMOTE_ADDR'] 
 $ file =  fopen(“./ users.txt”,“a + 
 nfwrite($ file,$ text); 
 nclclose($ file); 
   \  n 

任何帮助,以便保存并实际加载页面会很棒。 提前致谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushangxianq07480 2019-06-18 03:20

    This is a syntax error. The symbol ]} is at the end. It should be:

    $text = "{$user} Logged in as: {$_SERVER['PHP_AUTH_USER']} at: {$timestamp} With IP: {$_SERVER['REMOTE_ADDR']}
    点赞 打赏 评论

相关推荐 更多相似问题