- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想在我的网站上安装一个我在某处找到的 php whois 域可用性检查脚本。
它有一个 whois_class.php
文件,它允许我在“win”和“linux”模式之间切换。
当我打开“win”模式时,它在我的本地主机上工作正常,因为我使用的是 Windows 操作系统。
但是当我将它上传到服务器时它停止工作,因为我的服务器是 Linux 服务器。
所以我必须将它切换到“linux”模式并重新上传whois_class.php
。预计这可以正常工作,但对于 linux 模式,脚本的开发人员使用了 exec()
函数,我的主机出于安全目的禁用了该函数。
因此,我猜唯一的选择是将我的服务器平台从 Linux 更改为 Windows。但是,那将是一团糟。
我一直在寻找一种方法,如何使用此脚本在我的 Linux 服务器上顺利运行,就像它在 Windows 操作系统的本地主机上运行一样。对脚本进行任何更改或修改以使其运行将不胜感激。
whois_class.php
:
<?php
class Whois_domain {
var $possible_tlds;
var $whois_server;
var $free_string;
var $whois_param;
var $domain;
var $tld;
var $compl_domain;
var $full_info;
var $msg;
var $info;
var $os_system = "win"; // switch between "linux" and "win"
function Whois_domain() {
$this->info = "";
$this->msg = "";
}
function process() {
if ($this->create_domain()) {
if ($this->full_info == "yes") {
$this->get_domain_info();
} else {
if ($this->check_only() == 1) {
$this->msg = "<p style='font-size: 16px'>The domain name: <font color='#000'>".$this->compl_domain."</font> is <font color='#2ec62e'>available</font>.</p>";
return true;
} elseif ($this->check_only() == 0) {
$this->msg = "<p style='font-size: 16px'>The domain name: <font color='#000'>".$this->compl_domain."</font> is <font color='red'>registered</font>.</p>";
return false;
} else {
$this->msg = "<p style='font-size: 16px'>There was something wrong, try it again.</p>";
}
}
} else {
$this->msg = "<p style='font-size: 16px'>Only letters, numbers and hyphens (-) are valid!</p>";
}
}
function check_entry() {
if (preg_match("/^([a-z0-9]+(\-?[a-z0-9]*)){2,63}$/i", $this->domain)) {
return true;
} else {
return false;
}
}
function create_tld_select() {
$menu = "<select id=\"tld\" name=\"tld\" style=\"margin-left:0; width: 100px; margin-top: 20px; border-radius: 5px\">\n";
foreach ($this->possible_tlds as $val) {
$menu .= " <option value=\"".$val."\"";
$menu .= (isset($_POST['tld']) && $_POST['tld'] == $val) ? " selected=\"selected\">" : ">";
$menu .= $val."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function create_domain() {
if ($this->check_entry()) {
$this->domain = strtolower($this->domain);
$this->compl_domain = $this->domain.".".$this->tld;
return true;
} else {
return false;
}
}
function check_only() {
$data = $this->get_whois_data();
if (is_array($data)) {
$found = 0;
foreach ($data as $val) {
if (preg_match('/'.$this->free_string.'/', $val)) {
$found = 1;
}
}
return $found;
} else {
$this->msg = "<p style='font-size: 16px'>Error, please try it again.</p>";
}
}
function get_domain_info() {
if ($this->create_domain()) {
$data = ($this->tld == "nl") ? $this->get_whois_data(true) : $this->get_whois_data();
//print_r($data);
if (is_array($data)) {
foreach ($data as $val) {
if (eregi($this->free_string, $val)) {
$this->msg = "<p style='font-size: 16px'>The domain name: <font color='#000'>".$this->compl_domain."</font> is <font color='#2ec62e'>available</font>.</p>";
$this->info = "";
break;
}
$this->info .= $val;
}
} else {
$this->msg = "<p style='font-size: 16px'>Error, please try it again.</p>";
}
} else {
$this->msg = "<p style='font-size: 16px'>Only letters, numbers and hyphens (-) are valid!</p>";
}
}
function get_whois_data($empty_param = false) {
// the parameter is new since version 1.20 and is used for .nl (dutch) domains only
if ($empty_param) {
$this->whois_param = "";
}
if ($this->tld == "de") $this->os_system = "win"; // this tld must be queried with fsock otherwise it will not work
if ($this->os_system == "win") {
$connection = @fsockopen($this->whois_server, 43);
if (!$connection) {
unset($connection);
$this->msg = "<p style='font-size: 16px'>Can't connect to the server!</p>";
return;
} else {
sleep(2);
fputs($connection, $this->whois_param.$this->compl_domain."\r\n");
while (!feof($connection)) {
$buffer[] = fgets($connection, 4096);
}
fclose($connection);
}
} else {
$string = "whois -h ".$this->whois_server." \"".$this->whois_param.$this->compl_domain."\"";
$string = str_replace (";", "", $string).";";
exec($string, $buffer);
}
if (isset($buffer)) {
//print_r($buffer);
return $buffer;
} else {
$this->msg = "<p style='font-size: 16px'>Can't retrieve data from the server!</p>";
}
}
}
?>
问题就在这里
if ($this->os_system == "win") {
$connection = @fsockopen($this->whois_server, 43);
if (!$connection) {
unset($connection);
$this->msg = "<p style='font-size: 16px'>Can't connect to the server!</p>";
return;
} else {
sleep(2);
fputs($connection, $this->whois_param.$this->compl_domain."\r\n");
while (!feof($connection)) {
$buffer[] = fgets($connection, 4096);
}
fclose($connection);
}
} else {
$string = "whois -h ".$this->whois_server." \"".$this->whois_param.$this->compl_domain."\"";
$string = str_replace (";", "", $string).";";
exec($string, $buffer);
}
我的主机禁用了功能
system,exec,shell_exec,passthru,popen,proc_open,pcntl_exec,highlight_file,show_source,symlink,link,posix_getpwuid,posix_getpwnam,posix_getgrgid,posix_getgrnam,posix_kill,posix_mkfifo,posix_getrlimit
最佳答案
有plenty of functions related to program execution .但是,您应该检查您的设置中禁用了哪些其他功能:
var_dump(ini_get("disable_functions"));
关于PHP 域可用性脚本 exec() 函数替代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45759290/
是否可以使用 JHipster 5(带有 Spring Boot 2)?我注意到在发行说明中提到了 JHipster 5 的工作,但看不到任何关于如何安装/运行 5 的“预览”版本的信息。 最佳答案
使用多个显示器时,有没有办法拆分 Xcode 界面? 我有 2 台显示器,但仍然没有找到一种简单的方法在超过 1 台显示器上使用它(左侧的 Storyboard,右侧的代码) - 就像在 Androi
我正在尝试处理 uwp 应用程序中的 xml,我添加了引用和用法: using System.Xml; using System.Xml.XPath; 但是 private XmlDocument d
JSunit 真的是 Junit 到 Javascript 的直接端口吗?所以我听说过,但我想知道为什么我的公司没有使用它。我的公司有很多聪明人,所以如果我们不使用它,我想知道 Jsunit 作为 j
当使用原始 TCP 套接字时,需要进行消息帧化,如 here 所述,带有长度前缀或分隔符。 我今天遇到了“SOCK_SEQPACKET”套接字选项,它显然可以几乎透明地进行消息框架。 目前“SOCK_
我在一个小型开发小组工作。我们正在构建和改进我们的产品。 半年前我们无法考虑更高的特性,比如可用性,因为我们的产品有很多问题。许多错误、高技术债务、低性能和其他问题使我们无法专注于可用性。 随着时间的
是否可以通过编程方式控制@RestController来启用或禁用它?我不想只在每个 @RequestMapping 方法中编写代码来执行某种 if (!enabled) { return 404Ex
azure 的 blob 在被新版本覆盖时是否可供下载? 根据我使用 Cloud Storage Studio 的测试,下载被阻止,直到覆盖完成,但是我的测试来自同一台计算机,因此我无法确定这是正确的
我一直认为(但出于某种原因从未实践过)动态生成且仅包含一个项目的下拉菜单应该自动选择该项目。这与我观察到的典型方法相反,即在顶部创建一个空白条目,您仍然必须与菜单交互以进行单个可用选择。 例如,当我登
我正在为我的兄弟编写一个基于 Web 的小实用程序,他需要合并 CSV 文件中的列。我知道这样的事情肯定存在于某个地方,但这很大程度上是因为这是一个有趣的小练习。 无论如何,我正在尝试找出最好/最简洁
如您所知,pinterest api 现在似乎已关闭。( api.pinterest.com )在此站点中:http://tijn.bo.lt/pinterest-api ,它表示只读访问仍然有效。到
我想为公寓可用性应用程序制作日历 View 。我的想法是从 MySQL 数据库获取日期范围(不可用日期)并将其显示在日历 View 中。我的日历 View 应该有 3 种不同的样式: 可用日期 不可用
我究竟应该如何配置我的广播接收器以使我的应用程序响应 wifi 可用性的变化。不过,当应用程序未运行时,我并不真正关心对此使用react。 我在这里试图完成的是,当应用程序运行时,我需要使本地数据库与
在我的网络应用程序中,我有 parent 和保姆。 保姆将声明工作时间(时间间隔),该工作时间将存储在工作时间表中。 家长也会每隔一段时间表达自己的需求(暂时不需要存储)。 所以我设计了这样的可用性表
概览 我希望在 CloudKit 无法访问时收到通知。 CloudKit 可能无法访问的可能场景: CloudKit 服务器不可访问 互联网连接不可用。 迄今为止所做的尝试: 观察 CKAccount
好的,我有我为核心数据创建的类 LoginPass.h 然后我有头等舱 FirstClass.h 然后我需要在 SecondClass 中使用这些类,我在其中使用 @class 声明它们。头文件 Se
例如 linux kernel-2.6.32-279 没有在/usr/include/asm-generic/socket.h 中定义 SO_REUSEPORT 但 kernel-2.6.32-431
我正在尝试安装的工具说: MySQL server data directory needs to reside on an LVM volume 如何检查我的数据目录是否在 LVM 上? 最佳答案
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: Programmatically find device support GPS or not? 如何检查设
我听说汽车行业有一种叫做 MISRA C 的东西。 其他高可靠性/可用性/安全性行业的相关标准是什么,例如 空间 飞机 银行/金融 汽车 医疗 国防/军事 ??? -亚当 最佳答案 查看戈达德太空飞行
我是一名优秀的程序员,十分优秀!