Example #1
0
function MySQLSelectCell($SQL)
{
    global $Connect;
    $result = mysqli_query($Connect, $SQL);
    //2006和2013错误则重试一次
    if (!$result && in_array(mysqli_errno($Connect), array(2006, 2013))) {
        MySQLDisconnect();
        MySQLConnect();
        $result = mysqli_query($Connect, $SQL);
    }
    if (!$result) {
        return false;
    }
    $row = mysqli_fetch_row($result);
    if (!$row) {
        return false;
    }
    ResultTransform($row);
    $row = $row[0];
    return $row;
}
Example #2
0
}
function Heading2($strLabel)
{
    global $strAppURL;
    echo "<span style='font-size: 10pt; font-weight: bold; color: black;'>{$strLabel}</span>";
}
function NavCell($strLabel)
{
    global $strAppURL;
    echo "<tr>";
    echo "\t<td valign=top><img src=" . $strAppURL . "/images/arrow.png></td>";
    echo "\t<td width=100% valign=top>{$strLabel}</td>";
    echo "</tr>";
}
// connect to database
MySQLConnect();
//echo $_SERVER["SCRIPT_NAME"]."==========".$strLoginScriptPath; die;
if ($_SERVER["SCRIPT_NAME"] != $strLoginScriptPath && PHP_SAPI != "cli") {
    // echo $_SERVER["SCRIPT_NAME"]."==========".$strLoginScriptPath; die;
    $strWhere = "user_login = '******' and user_password = '******' and user_type = 1";
    $rstRow = GetRecord("tbluser", $strWhere);
    // if we have not found this user
    if (empty($rstRow["user_id"])) {
        header("Location: index?error=1");
        exit;
    } else {
        $_SESSION["nUserId"] = $rstRow["user_id"];
        $_SESSION["strUserName"] = $rstRow["user_name"];
        $_SESSION["strUserAdmin"] = $rstRow["user_admin"];
        $_SESSION["nEnableDisable"] = $rstRow["user_disabled"];
    }
Example #3
0
include 'MyPHP/My.php';
include 'MyPHP/MySQLi.php';
//参数
$user_id = MySessionGet('user_id');
if ($user_id === false) {
    MySuccess(1, '用户未登录');
}
if (MySetParameterInteger("group_id") === false) {
    MyException("缺少group_id参数或group_id不是整数");
}
if (MySetParameter("path") === false) {
    $path = '';
    //MyException("缺少path参数");
}
//权限验证
if (MySQLConnect() === false) {
    MyError('数据库连接错误');
}
$authority = MySQLSelectCell("SELECT `authority` FROM `user_group_info` WHERE `user_id` = {$user_id} and `group_id` = {$group_id}");
MySQLDisconnect();
if ((int) $authority < 2048) {
    MySuccess(2, '用户权限不足');
}
//文件保存
if (!isset($_FILES) || !isset($_FILES["file"])) {
    MyException("缺少file文件参数");
}
if (move_uploaded_file($_FILES["file"]["tmp_name"], ".../CloudDisk/{$group_id}/" . $path . $_FILES["file"]["name"]) === false) {
    MyError('文件移动失败');
}
MySuccess("http://115.159.106.238/CloudDisk/{$group_id}/" . $_FILES["file"]["name"], '文件上传成功');
$pgsql_username = base64_decode($config['datasources']['pgsql']['dbusername']);
$pgsql_password = base64_decode($config['datasources']['pgsql']['dbpassword']);
$pgsql_db = base64_decode($config['datasources']['pgsql']['database_name']);
$pgsql_table = base64_decode($config['datasources']['pgsql']['table_name']);
$pgsql_uname_field = base64_decode($config['datasources']['pgsql']['username_field']);
$pgsql_pass_field = base64_decode($config['datasources']['pgsql']['password_field']);
$sqlserver_hostname = base64_decode($config['datasources']['sqlserver']['hostname']);
$sqlserver_port = base64_decode($config['datasources']['sqlserver']['port']);
$sqlserver_username = base64_decode($config['datasources']['sqlserver']['dbusername']);
$sqlserver_password = base64_decode($config['datasources']['sqlserver']['dbpassword']);
$sqlserver_db = base64_decode($config['datasources']['sqlserver']['database_name']);
$sqlserver_table = base64_decode($config['datasources']['sqlserver']['table_name']);
$sqlserver_uname_field = base64_decode($config['datasources']['sqlserver']['username_field']);
$sqlserver_pass_field = base64_decode($config['datasources']['sqlserver']['password_field']);
if (!empty($mysql_hostname) && !empty($mysql_port) && !empty($mysql_username) && !empty($mysql_password) && !empty($mysql_db)) {
    $mysql_connection = MySQLConnect($mysql_hostname, $mysql_port, $mysql_username, $mysql_password, $mysql_db);
    if ($mysql_connection) {
        $mysql_connection_status = "Bağlandı";
        $mysql_connection_class = "label label-success";
        if (!empty($mysql_table) && !empty($mysql_uname_field) && !empty($mysql_pass_field)) {
            $mysql_available = true;
            $mysql_data = checkData($mysql_connection, $mysql_table, $mysql_uname_field, $mysql_pass_field);
            if ($mysql_data) {
                $mysql_data_status = "Kullanılabilir veri var";
                $mysql_data_class = "label label-success";
            } else {
                $mysql_data_status = "Veri bulunamadı";
                $mysql_data_class = "label label-important";
            }
        } else {
            $mysql_data_status = "Yapılandırılmadı";