如何从另一个网站(我控制的)获取代码?
我想在我的网站中输入一行 php 并让它回显要在我的网站上输入的代码。本质上,我控制着客户网站的一部分,如果我可以更改它而不要求他们上传它,那么对所有参与者来说会更方便。这肯定是一个长期解决的问题,但我找不到解决方案。另外,我不确定如果我的代码是服务器端这是否可行。想法、帮助、建议?
I want to enter a line of php into my site and have it echo out code that is to be entered on my site. Essentially I am controlling a part of a clients' site and it is more convenient for all involved if I can change it without requiring them to upload it. This must be a long solved issue, but I cannot find a solution. Also, I am not sure if this is possible if my code is server side. Thoughts, help, suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我的想法和建议...不要这样做!以下是几个原因:
原因。
跑得更慢,因为它必须拉动
通过网络编写代码,以便
工作。
服务器宕机了?它会降低你的
客户端服务器可能打开它
直至攻击。
这个想法的一切都很糟糕。因为你可以做某事和因为你应该做某事之间有一条界限。这绝对是不应该的。
My thoughts and suggestions... don't do it! Here are a few reasons why:
reason.
run slower because it has to pull
code across the net in order to
work.
server goes down? It takes down your
clients server possibly opening it
up to attacks.
Everything about the idea is bad. There is a line between doing something because you can and doing something because you should. This is definitively as SHOULDN'T.
您应该找出一种不同的方法来解决这个问题。从我的想法来看,您可能可以编写一个实用程序,允许您使用用户名和密码替换特定文件。
使用其他站点的代码,即使您控制它,也是非常危险的。潜在的攻击者所要做的就是通过多种方式之一欺骗地址,他们实际上可以在服务器上执行脚本有权执行的任何操作。为了完整起见,您正在寻找“eval”,但您想要使用不同的方法。
You should figure out a different approach to fixing this problem. From the top of my head, you could probably write a utility that allows, with a username and password, you to replace specific files.
Using code from another site, even if you control it, is incredibly dangerous. All a would-be attacker has to do is spoof the address through one of many means, and they could literally do anything on the server that the script has privileges to do. For completeness, you are looking for "eval", but you want to use a different approach.
你知道,PHP 内置了 FTP 支持。也许您可以编写一个远程部署应用程序。
Y'know, PHP has FTP support built-in. Maybe you could write a remote deployment app.
这就是创建 ssh 的目的:
无论实现如何,我都不会在 PHP 中执行类似的操作,因为这是一个巨大的安全漏洞。
This is what ssh was created for:
I wouldn't do anything like this in PHP no matter the implementation because it is a huge security vulnerability.
当你说你有 PHP 回显代码到你这边时,我认为它是 php 回显 javascript。这意味着您还可以将 js 打印到不同的文件并链接到它。
例如,服务器上的 php 可能如下所示:
在客户端页面上,您说
这样,客户端始终会获取您服务器上的代码。
When you say you have PHP echoing out code onto your side, I assume it's php echoing out javascript. This means that you can also print out the js to a different file and link to it.
for example, the php on your server could look like this:
on the client's page, you say
This way, the client always gets the code you have on your server.