public function __construct() { global $soap_url, $soap_head, $soap_param; // 连接到soap服务器 try { $this->client = new SoapClient($soap_url); // 发送验证信息 $headers = new SoapHeader($soap_head['0'], $soap_head['1'], $soap_param); $this->client->__setSoapHeaders(array($headers)); } catch (SoapFault $sf) { message_box('连接远程服务器失败,请与管理员联系', FRONT, go_to(array('/contact.php' => '联系我们'))); exit; } catch (Exception $e) { echo $e->getMessage(); } }
<?php /*------------------------------------------------------------------------------ BerryIO Initialise LCD Command ------------------------------------------------------------------------------*/ $title = 'LCD Control'; // Load the LCD functions require_once FUNCTIONS . 'lcd.php'; // Initialise the LCD if (lcd_initialise() === FALSE) { $content .= message('ERROR: Cannot initialise the LCD', 'lcd_status'); return FALSE; } if ($GLOBALS['EXEC_MODE'] == 'cli') { $content .= message('LCD Initialised'); } elseif ($GLOBALS['EXEC_MODE'] != 'api') { $content .= go_to('lcd_status'); }
if (!$bussCode || !$bussSort) { message_box('参数出错,请重试', XJT, go_to(array('/xjt/payonline.php' => '返回'))); exit; } else { $soap = new Soap_xjt(); //创建接口对象 $soapData = array(); $result = $soap->getAccBusInfo($userData['m_account'], $soapData); foreach ($soapData['data'] as $v) { if ($v['bussCode'] == $bussCode && $v['bussSort'] == $bussSort) { $bussInfo = $v; } } } if (!$bussInfo) { message_box('参数出错,请重试', XJT, go_to(array('/xjt/payonline.php' => '返回'))); } $smarty->assign('msg', $msg); $smarty->assign('bussInfo', $bussInfo); $smarty->assign('userData', $_SESSION['userData']); $smarty->display('xjt/dopayonline.tpl'); } else { $soap = new Soap_xjt(); //创建接口对象 $soapData = array(); $result = $soap->getAccBusInfo($userData['m_account'], $soapData); $smarty->assign('soapData', $soapData['data']); $smarty->assign('userData', $_SESSION['userData']); $smarty->assign('account', $userData['m_account']); $smarty->display('xjt/payonline.tpl'); }
------------------------------------------------------------------------------*/ $EXEC_MODE = 'html'; require_once '/etc/berryio/paths.php'; require_once BASE . '/includes/configs/paths.php'; /*------------------------------------------------------------------------------ Load the commonly used config, settings and functions ------------------------------------------------------------------------------*/ require_once CONFIGS . 'common.php'; require_once SETTINGS . 'common.php'; require_once FUNCTIONS . 'common.php'; require_once FUNCTIONS . 'html.php'; settings('menu', 2); /*------------------------------------------------------------------------------ Get the command and run it ------------------------------------------------------------------------------*/ $argv = explode('/', rtrim($_SERVER["SERVER_NAME"] . (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : ''), '/')); $args = $argv; $EXEC = array_shift($args) . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : ''); // Show welcome by default if (!isset($args[0]) || $args[0] == '') { go_to('welcome'); } // Presume its OK unless stated otherwise $GLOBALS['SUCCESS'] = TRUE; // Run command $page['content'] = call_user_func_array('command', $args); /*------------------------------------------------------------------------------ Output the page ------------------------------------------------------------------------------*/ $page['selected'] = $argv[1]; echo view('layout/common', $page);
function get_file_name(&$soap, $schoolData, $filename) { $cur_buss = request_var('buss', ''); $fromdate = request_var('from', ''); $todate = request_var('to', ''); $unite = request_var('unite', '2'); if ($unite == '1') { //统一费用 $money = request_var('unitemoney', ''); } else { $money = '-1'; } if (!checktime($fromdate) || !checktime($todate)) { message_box("请选择正格的时间!", XJT_ADMIN, go_to(array('/xjt_admin/replacement.php' => '返回'))); } $id = 0; $soap->getFileID($schoolData['SchNum'], $schoolData['SchAreaNum'], $cur_buss, gettimeStr($fromdate), gettimeStr($todate), $unite, $money, $id); $name_tmp = explode('.', $filename); $ext = array_pop($name_tmp); return iconv("UTF-8", "gb2312", implode('.', $name_tmp) . '_' . $id . '.' . $ext); }
function you_got_to_authenticate() { global $config; go_to($config['base'] . 'admin/login/'); }
<?php /*------------------------------------------------------------------------------ BerryIO SPI Set DAC Value Command ------------------------------------------------------------------------------*/ $title = 'SPI Control'; // Load the SPI functions require_once FUNCTIONS . 'spi.php'; // Check the args if (count($args) != 3) { $content .= usage('Please provide chip_select, channel and value information'); return FALSE; } // Set the SPI Value if (spi_set_dac_value($args[0], $args[1], $args[2]) === FALSE) { $content .= message('ERROR: Cannot set chip "' . $args[0] . '" channel "' . $args[1] . '" to values "' . $args[2] . '", are the chip, channel and value valid?', 'spi_status'); return FALSE; } if ($GLOBALS['EXEC_MODE'] == 'cli') { $content .= go_to('spi_status', $args[0], $args[1], $args[2]); } elseif ($GLOBALS['EXEC_MODE'] == 'html') { $content .= go_to('spi_status'); }
<?php /*------------------------------------------------------------------------------ BerryIO GPIO Set Mode Command ------------------------------------------------------------------------------*/ $title = 'GPIO Control'; // Load the GPIO functions require_once FUNCTIONS . 'gpio.php'; // Check the args if (count($args) != 2) { $content .= usage('Please provide pin and mode information'); return FALSE; } // Set the GPIO Mode if (gpio_set_mode($args[0], $args[1]) === FALSE) { $content .= message('ERROR: Cannot set GPIO pin "' . $args[0] . '" into mode "' . $args[1] . '"', 'gpio_status'); return FALSE; } if ($GLOBALS['EXEC_MODE'] != 'api') { $content .= go_to('gpio_status'); }
$newpwd2 = request_var('newpwd2', ''); $soapData = array(); //$result = $soap->admLogIn($userData['m_account'], $oldpwd); $result = true; if ($result) { if ($newpwd == $newpwd2) { $result = $soap->admModifyPwd($userData['m_account'], $oldpwd, $newpwd); if ($result) { if (isset($_SESSION['userData'])) { unset($_SESSION['userData']); } //删除session $db->delete(TABLE_CZECH_SESSION, 'session_id = "' . $_COOKIE['session_id'] . '"'); setcookie('m_account', '', time() - $system_data['cookie_time'], '/'); setcookie('session_id', '', time() - $system_data['cookie_time'], '/'); message_box('您的密码已经修改,请用新密码登录系统', XJT_ADMIN, go_to(array('/xjt_admin/login.php' => '重新登录'))); exit; } else { $msg = '修改密码出错,可能是因为网络原因,请重试!'; } } else { $msg = '您输入的两次新密码不一致!请重新输入'; } } else { $msg = '您输入的原密码不正确!请重新输入'; } } $smarty->assign('msg', $msg); $smarty->display('xjt_admin/modifyPassword.tpl'); } else { $smarty->assign('adminInfo', $_SESSION['userData']);
*/ include 'config.php'; function handle_error($status = '404 Not Found', $header, $text) { global $config; header('HTTP/1.0 ' . $status); header('Status: ' . $status); do_header(); echo '<h3>' . $header . '</h3>'; echo '<p class="warning">Sorry :-(</p>'; echo '<p>' . $text . '</p>'; echo '<p class="leave"><a href="' . $config['base'] . '">Go to ' . $config['shortener'] . '</a></p>'; do_footer(); die; } $short = get_params($_SERVER['PATH_INFO']); $short_url = clean($short[0]); if (empty($short_url)) { go_to('/'); } $query = mysql_query("SELECT long_url, status FROM urls WHERE short_url = CONVERT('{$short_url}' USING binary) LIMIT 1"); $result = mysql_fetch_row($query, MYSQL_ASSOC); if (empty($result)) { handle_error('404 Not Found', 'Not Found', 'We couldn\'t find that URL.'); } if ($result['status'] == 'suspended') { handle_error('403 Forbidden', 'Suspended URL', 'This URL has been suspended.'); } $long_url = $result['long_url']; go_to($long_url);
$result = $soap->login($userData['m_account'], $oldpwd, $soapData); if ($result) { if (!preg_match('/\\d{6}/', $newpwd) || !preg_match('/\\d{6}/', $newpwd2)) { $msg = '您正确输入的新密码(6位数字)!'; } else { if ($newpwd == $newpwd2) { $result = $soap->modifyPassword($userData['m_account'], $oldpwd, $newpwd); if ($result) { if (isset($_SESSION['userData'])) { unset($_SESSION['userData']); } //删除session $db->delete(TABLE_CZECH_SESSION, 'session_id = "' . $_COOKIE['session_id'] . '"'); setcookie('m_account', '', time() - $system_data['cookie_time'], '/'); setcookie('session_id', '', time() - $system_data['cookie_time'], '/'); message_box('您的密码已经修改,请用新密码登录系统', XJT, go_to(array('/xjt/login.php' => '重新登录'))); exit; } else { $msg = '修改密码出错,可能是因为网络原因,请重试!'; } } else { $msg = '您输入的两次新密码不一致!请重新输入'; } } } else { $msg = '您输入的原密码不正确!请重新输入'; } } $smarty->assign('msg', $msg); $smarty->display('xjt/modifyPassword.tpl'); } else {
<?php /*------------------------------------------------------------------------------ BerryIO Camera Show Command ------------------------------------------------------------------------------*/ $title = 'Camera Control'; // Load the Camera functions require_once FUNCTIONS . 'camera.php'; // Check the args if (count($args) != 2) { $content .= usage('Please provide both type (image or video) and the filename'); return FALSE; } // Check the args if (camera_delete($args[0], $args[1]) === FALSE) { // Find out the command line executable (if this is not running on the command line we are going to need to guess) $berryio = $GLOBALS['EXEC_MODE'] != 'cli' ? 'berryio' : $GLOBALS['EXEC']; $content .= message('ERROR: Could not delete the file.' . PHP_EOL . 'If it definitely exists try sudo ' . $berryio . ' ' . $args[0] . ' ' . $args[1], 'camera_status'); return FALSE; } if ($GLOBALS['EXEC_MODE'] != 'api') { $content .= go_to('camera_status'); }
} if ($doMod == 'index.php') { $doMod = 'index'; } if ($doMod == 'product') { if ($Str = strstr($_SERVER['PHP_SELF'], 'product_sort')) { $doMod = 'product_sort'; } } $smarty->assign('leftCss', $doMod); //获取URL地址 $url_ext = ''; if (is_array($_GET) && sizeof($_GET) > 0) { foreach ($_GET as $k => $v) { $url_ext .= '&' . $k . '=' . $v; } } if (!empty($url_ext)) { $url_ext = '?' . substr($url_ext, 1); } $url_current = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $url_ext; if (strstr($_SERVER['PHP_SELF'], 'global.php')) { message_box('访问受限', FRONT, go_to(array('/' => '返回首页'))); exit; } if (strstr($_SERVER['PHP_SELF'], '/system/')) { if (!isset($_COOKIE['session_id']) || !isset($_COOKIE['m_account']) || !$userData || $userData['m_group'] != MEMBER_TYPE_ADMIN) { message_box('访问受限', FRONT, go_to(array('/' => '返回首页'))); exit; } }
exit; } $C2bossRecid = request_var('C2bossRecid', ''); $bussInfo = array(); $soap = new Soap_xjt(); //创建接口对象 $soapData = array(); $result = $soap->getAccPendBook($userData['m_account'], $soapData); foreach ($soapData['data'] as $v) { if ($v['id'] == $C2bossRecid) { $bussInfo = $v; } } $bussInfo['money'] = abs($bussInfo['money']); if (!$bussInfo) { message_box('参数出错,请重试', XJT, go_to(array('/xjt/affirm.php' => '返回'))); exit; } $smarty->assign('bussInfo', $bussInfo); $smarty->assign('userData', $_SESSION['userData']); $smarty->display('xjt/doaffirm.tpl'); } else { $soap = new Soap_xjt(); //创建接口对象 $soapData = array(); $result = $soap->getAccPendBook($userData['m_account'], $soapData); $smarty->assign('soapData', $soapData['data']); $smarty->assign('userData', $_SESSION['userData']); $smarty->assign('account', $userData['m_account']); $smarty->display('xjt/affirm.tpl'); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ include 'config.php'; global $config, $session; $short = get_params($_SERVER['PATH_INFO']); switch ($short[0]) { case 'login': if (empty_users()) { go_to($config['base'] . 'admin/register/'); } if ($session->id) { go_to($config['base'] . 'admin/'); } do_header('login - ' . $config['shortener']); echo '<h3>log into ' . $config['shortener'] . '</h3>'; echo '<dl>'; echo '<dt>User name:</dt><dd><input type="text" id="nick" name="nick"/></dd>'; echo '<dt>Password:</dt><dd><input type="password" id="password" name="password"/></dd>'; echo '</dl>'; echo '<p id="newurl">Move along :)</p>'; echo '<a id="login" href="#j">Log in</a>'; echo '<div class="clearit"></div>'; do_footer(); break; case 'logout': $session->destroy_cookie(); header('Location: ' . $config['base']);