view->set_tpl("index/index"); // 中间的模板 $config = InitPHP::getConfig(); $title = $config['sitename']; $this->view->assign("title", $title); $this->view->display(); } function ping() { $domain = $this->controller->get_gp("node"); $domain=$this->controller->get_gp('node'); $result=file_get_contents("http://www.phplife.net/ping.php?node=".$domain); echo $result; } public function cron() { $user = InitPHP::getService("user"); if ($user->resetTran()) { echo "OK"; } } public function ssh() { global $argv; $server = $this->getServer(); $data = $server->getAll(); $cmd = $argv[3]; $ip = $argv[4]; foreach ($data as $k => $v) { if ($ip && $v['server'] != $ip) { continue; } echo $v['server'] . "\tresponse:\n"; $ssh = $this->getssh(); $status = $ssh->login($v['server'], $v['port'], 'root', $v['passwd']); if (!$status) { echo $v['server'] . ' connect fail!'; continue; } $str = $ssh->exec($cmd); echo $str . "\r\n\r\n\r\n"; $ssh->close(); } } /** * * @return sshInit */ private function getssh() { return InitPHP::getLibrarys("ssh"); } /** * * @return sshDao */ private function getServer() { return InitPHP::getDao("ssh"); } public function test() { $userService = InitPHP::getService("user"); $data = $userService->getUsers(); $sh = ""; if ($data) { foreach ($data as $k => $v) { $sh .= $v['port'] . "#" . $v['passwd'] . "#" . $v['transfer_enable'] . "@"; } } file_put_contents("1.txt", $sh); echo $sh; // dump($data); } private function getGb($data) { } public function testMail() { // InitPHP::url("index"); // $email = $this->getEmail(); $subject = '测试邮件'; $message = '这是一封测试邮件!'; $user='webmaster@tailsocks.com'; sendmail('chen6485882@gmail.com', $subject, $message, $user); // $email->config($relay_host, $mailConfig['port'], $auth = true, $user, $pass); // var_dump($Config); // $email->sendmail("chendeben@qq.com", $mailConfig['from'], $subject = "测试邮件", "这是一封测试邮件哈", "HTML"); } /** * @return emailInit */ public function getEmail() { return InitPHP::getLibrarys("email"); } }