function month_total_fee($month)
{
    $year = explode('-', $month)[0];
    $mon = explode('-', $month)[1];
    //获取需要的月份相应交费记录并计算总费用
    $sql = "select fee,date,dueDate from hh_fee";
    $rows = fetchAll($sql);
    $total = 0;
    foreach ($rows as $row) {
        $day1 = $row['date'];
        $day2 = $row['dueDate'];
        $fee = $row['fee'];
        $T = ceil($fee / days_dis($day1, $day2));
        //$T为 该笔学费每天的收入
        $days = month_days($day1, $day2, $month);
        if ($days) {
            $total = $days * $T + $total;
        }
    }
    $arr = array('year' => $year, 'month' => $mon, 'total' => $total);
    //如果已存在相应日期记录,则进行更新操作,否则进行插入
    $sql = "select count(total) from hh_totalFee where year={$year} and month={$mon}";
    $result = fetchOne($sql)['count(total)'];
    if ($result >= 1) {
        update('hh_totalFee', $arr, "year={$year} and month={$mon}");
    } else {
        insert('hh_totalFee', $arr);
    }
}
示例#2
0
 public function contact_delete($id)
 {
     $data_update = array('is_delete' => 1);
     update('inquiry', $id, $data_update);
     $this->session->set_flashdata('success', 'Inquiry has been deleted.');
     redirect('admin/inquiry/contact');
 }
function update($folder = '')
{
    if (empty($folder)) {
        return false;
    }
    $files = array();
    if ($dir = @opendir($folder)) {
        while (($file = readdir($dir)) !== false) {
            if (in_array($file, array('.', '..'))) {
                continue;
            }
            if (is_dir($folder . '/' . $file)) {
                $files2 = update($folder . '/' . $file);
                if ($files2) {
                    $files = array_merge($files, $files2);
                }
                $GLOBALS['pastas'][] = $folder . '/' . $file;
            } else {
                $GLOBALS['arquivos'][] = $folder . '/' . $file;
            }
        }
    }
    @closedir($dir);
    return $files;
}
 public function delete($id)
 {
     $data_update = array('is_delete' => 1);
     update('floorplan_category', $id, $data_update);
     $this->session->set_flashdata('success', 'Floorplan Category has been Deleted Successfully.');
     redirect('admin/floorplan_category/index');
 }
示例#5
0
/**
 *编辑商品
 * @param int $id
 * @return string
 */
function editUser($id)
{
    $arr = $_POST;
    $path = "../uploads";
    $uploadFiles = uploadFile($path);
    $where = "id={$id}";
    $totalCap = getCityCapById(getcIdById($id)) - getCapById($id) + $arr['capacity'];
    //减去旧的,加上新的
    $sql = "update biogas_city set totalCap=" . $totalCap . " where id=" . getcIdById($id);
    mysql_query($sql);
    //更新城市的总池容
    $res = update("biogas_user", $arr, $where);
    $uid = $id;
    if ($res && $uid) {
        if ($uploadFiles && is_array($uploadFiles)) {
            foreach ($uploadFiles as $uploadFile) {
                $arr1['uid'] = $uid;
                $arr1['albumPath'] = $uploadFile['name'];
                addAlbum($arr1);
            }
        }
        $mes = "<p>编辑成功!</p><a href='listUser.php' target='mainFrame'>查看用户列表</a>";
    } else {
        $mes = "<p>编辑失败!</p><a href='listUser.php' target='mainFrame'>重新编辑</a>";
    }
    return $mes;
}
示例#6
0
function apiDelete()
{
    //接口id
    $id = I($_POST['id']);
    $sql = "update api set isdel='1' where id='{$id}'";
    $re = update($sql);
    die($re ? '1' : '0');
}
示例#7
0
function apiDelete()
{
    //接口id
    $id = I($_POST['id']);
    $sql = "update " . session('login_name') . "_api set isdel='1' where id='{$id}'";
    $re = update($sql);
    die($re ? '1' : '0');
}
示例#8
0
function restoreAction()
{
    $id = $_GET['id'];
    update('products', array('isRecycle' => 0), 'id=' . $id);
    $message = '商品已经成功还原';
    $redirect = '<a href="recyclePro.php">返回回收站</a>';
    require_once 'thems/a.html';
}
示例#9
0
function child_render($param)
{
    global $g_page, $g_cfg;
    $g_page["frame"] = "site_admin/frame.html";
    if (!http_user_auth("admin", "admin")) {
        return redirect("/");
    }
    if (isset($param[1]) && $param[1] == "switch_status") {
        list($cname, $p) = [$_GET["name"], $_GET["p"]];
        if ($p == "close") {
            dbupdate("sys_variations", [], ["test" => $cname], ["completed" => "now()"]);
        }
        return redirect("/stats/multivariants");
    }
    $q = gettable("select * from sys_variations where completed is null");
    $t = [];
    foreach ($q as $row) {
        if (!isset($t[$row["test"]])) {
            $t[$row["test"]] = [];
        }
        if (!isset($t[$row["test"]][$row["variation"]])) {
            $t[$row["test"]][$row["variation"]] = ["goals" => []];
        }
        $t[$row["test"]][$row["variation"]]["content"] = substr($row["content"], 0, 256);
        $cm = new Variant($row["test"]);
        $t[$row["test"]][$row["variation"]]["enrolled"] = $cm->get() == $row["variation"] ? 1 : 0;
        $t[$row["test"]][$row["variation"]]["variation"] = $row["variation"];
        $cv = [];
        $cgoal = $row;
        $cgoal["pc"] = $row["sample"] == 0 ? "N/A" : round($row["conversion"] / $row["sample"] * 100, 2);
        $t[$row["test"]][$row["variation"]]["goals"][] = $cgoal;
        $t[$row["test"]][$row["variation"]] = update($t[$row["test"]][$row["variation"]], $cv);
    }
    $res = [];
    foreach ($t as $name => $row) {
        $cm = [];
        foreach ($t[$name] as $varname => $cvar) {
            uasort($cvar["goals"], function ($a, $b) {
                global $g_mv_goals;
                if (($i = array_search($a["goal"], $g_mv_goals)) === false) {
                    return -1;
                }
                if (($j = array_search($b["goal"], $g_mv_goals)) === false) {
                    return -1;
                }
                if ($i == $j) {
                    return 0;
                }
                return $i > $j ? 1 : -1;
            });
            $cm[] = $cvar;
        }
        $res[] = ["test" => $name, "var" => $cm];
    }
    // print_r($res); exit;
    $scr = new Scriptor("site_admin/multivariants.html", ["tests" => $res]);
    return $scr->result();
}
示例#10
0
/**
 * @param \PDO $link
 * @return bool
 */
function put_evaluation($link)
{
    /**
     * @param PDO $link
     * @param string $user
     * @param string $field1
     * @param string $field2
     * @param string $lang
     * @param string $group
     * @param string $id1
     * @param string $id2
     * @param string $word
     * @param int $type
     */
    function update($link, $user, $field1, $field2, $lang, $group, $id1, $id2, $word, $type)
    {
        $sql = "SELECT associd FROM `associations` WHERE id1 = :id1 AND id2 = :id2 AND word = :word AND user = :user AND assigned_group = :group AND lang = :lang AND type = :type";
        $stmt = $link->prepare($sql);
        $stmt->bindValue(':id1', $id1, PDO::PARAM_STR);
        $stmt->bindValue(':id2', $id2, PDO::PARAM_STR);
        $stmt->bindValue(':word', $word, PDO::PARAM_STR);
        $stmt->bindValue(':type', $type, PDO::PARAM_INT);
        $stmt->bindValue(':user', $user, PDO::PARAM_STR);
        $stmt->bindValue(':group', $group, PDO::PARAM_STR);
        $stmt->bindValue(':lang', $lang, PDO::PARAM_STR);
        if ($stmt->execute() === false) {
            error_log(var_export($link->errorInfo(), true));
            die("Error performing database operation.");
        }
        if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $sql = "INSERT INTO `evaluations` ( associd , evaluator , vote , popvote ) values ( :associd , :user , :vote , :popvote )";
            $stmt = $link->prepare($sql);
            $stmt->bindValue(':associd', $row['associd'], PDO::PARAM_STR);
            $stmt->bindValue(':user', $_SESSION['user_array']['user'], PDO::PARAM_STR);
            $stmt->bindValue(':vote', $field1 === 'upvotes' ? 2 : ($field1 === 'neutralvotes' ? 1 : 0), PDO::PARAM_INT);
            $stmt->bindValue(':popvote', $field2 === 'popupvotes' ? 2 : ($field2 === 'popneutralvotes' ? 1 : 0), PDO::PARAM_INT);
            if ($stmt->execute() === false) {
                error_log(var_export($link->errorInfo(), true));
                die("Error performing database operation.");
            }
        }
    }
    // Only the last presented item on a session can be evaluated
    // this is done on purpose, to avoid abuse.
    // A ticket is generated to ensure the item evaluation received
    // matches the presented item, both to avoid abuse and accidental
    // duplicates.
    if (!isset($_SESSION['rand_ticket']) || !isset($_SESSION['hashed_ticket']) || hash("sha256", $_SESSION['rand_ticket'] . $_SESSION['otheruser']) !== $_POST['ticket'] || $_SESSION['hashed_ticket'] !== hash("sha256", $_POST['ticket'] . $_POST['id1'] . $_POST['id2'])) {
        die("Bad ticket.");
    }
    unset($_SESSION['hashed_ticket']);
    unset($_SESSION['rand_ticket']);
    if (!isset($_POST['popvote']) || !isset($_POST['vote'])) {
        return false;
    }
    update($link, $_SESSION['otheruser'], $_POST['vote'], $_POST['popvote'], $_POST['lang'], $_POST['group'], $_POST['id1'], $_POST['id2'], $_POST['word'], $_POST['type']);
    return true;
}
function verwerk($id, $quant)
{
    // checken of product-id bestaat
    $id_query = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_id = " . $id);
    $row = mysql_fetch_array($id_query);
    if ($row != '') {
        update($id, $quant);
    }
}
 public function update($id, Request $request)
 {
     $input = update($request->all());
     $beritaa = Berita::findOrFail($id);
     $beritaa->judul = $input['judul'];
     $beritaa->isi = $input['isi'];
     $beritaa->save();
     return redirect('berita');
 }
示例#13
0
/**
 * 修改类别
 * @param int $id
 * @return string
 */
function editCate($id)
{
    $arr = $_POST;
    if (update("imooc_cate", $arr, "id={$id}")) {
        $mes = "修改成功!<a href='listCate.php'>查看类别列表</a>";
    } else {
        $mes = "修改失败!<a href='listCate.php'>重新修改</a>";
    }
    return $mes;
}
示例#14
0
function editCity($where)
{
    $arr = $_POST;
    if (update("biogas_city", $arr, $where)) {
        $mes = "修改成功!<br/><a href='listCity.php'>查看列表!</a>";
    } else {
        $mes = "修改失败!<br/><a href='listCity.php'>重新修改!</a>";
    }
    return $mes;
}
示例#15
0
/**
 * 修改分类的操作
 * @param string $where
 * @return string
 */
function editCate($where)
{
    $arr = $_POST;
    if (update("imooc_cate", $arr, $where)) {
        $mes = "分类修改成功!<br/><a href='listCate.php'>查看分类</a>";
    } else {
        $mes = "分类修改失败!<br/><a href='listCate.php'>重新修改</a>";
    }
    return $mes;
}
示例#16
0
/**
 * 修改分类的操作
 * @param string $where
 * @return string
 */
function editCate($where)
{
    $arr = $_POST;
    if (update("tigris_user_type", $arr, $where)) {
        $mes = "Edit success!<br/><a href='listCate.php'>View list</a>";
    } else {
        $mes = "Edit failed!<br/><a href='listCate.php'>Edit</a>";
    }
    return $mes;
}
示例#17
0
function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($_POST['password']);
    if (update('gud_admin', $arr, "id={$id}")) {
        $mes = "编辑成功!</br><a href='listAdmin.php'>查看管理员列表</a>";
    } else {
        $mes = "编辑失败!</br><a href='listAdmin.php'>请重新修改</a>";
    }
    return $mes;
}
示例#18
0
function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($_POST['password']);
    if (update("biogas_admin", $arr, "id={$id}")) {
        $mes = "编辑成功!<br/><a href='listAdmin.php'>查看列表!</a>";
    } else {
        $mes = "编辑失败!<br/><a href='listAdmin.php'>重新编辑!</a>";
    }
    return $mes;
}
示例#19
0
function update_user_cookies($u_id, $username, $email)
{
    //Add User Hash For Auto Login
    $user_hash = sha1($username + $email + time());
    //Function from DAL.php
    $sql = "update auto_login set a_u_hash = '{$user_hash}' where a_u_id = '{$u_id}' limit 1";
    $result = update($sql);
    //Set Cookie
    $expire = time() + 60 * 60 * 24 * 30;
    setcookie('remember_me', $user_hash, $expire, '/');
}
示例#20
0
function editarticle($where){
	$arr=$_POST;
	if(update("dw_article",$arr,$where)){
		echo "修改成功,<a href='list_article.php'>查看文章列表</a>";
		//print_r($arr);
		}
	else
	{
		echo "修改失败!";
		}
	}
示例#21
0
function setViews($topicoId)
{
    $topicoId = mysql_real_escape_string($topicoId);
    $readArtigo = read('up_posts', "WHERE id = '{$topicoId}'");
    foreach ($readArtigo as $artigo) {
    }
    $views = $artigo['visitas'];
    $views = $views + 1;
    $dataViews = array('visitas' => $views);
    update('up_posts', $dataViews, "id = '{$topicoId}'");
}
示例#22
0
function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($_POST['password']);
    if (update("myshop_admin", $arr, "id={$id}")) {
        $mes = "编辑成功!<br/><a href='listAdmin.php'>查看管理员列表</a>";
    } else {
        $mes = "编辑失败!<br/> <a href='listAdmin.php'>请重新修改</a>";
    }
    return $mes;
}
示例#23
0
/**
 * 修改管理员
 * @param unknown $id
 * @return string
 */
function editAdmin($id)
{
    $arr = $_POST;
    $arr["password"] = md5($arr["password"]);
    if (update("imooc_admin", $arr, "id={$id}")) {
        $mes = "编辑成功!<a href='listAdmin.php'>查看管理员列表</a>";
    } else {
        $mes = "编辑失败!<a href='listAdmin.php'>重新修改</a>";
    }
    return $mes;
}
示例#24
0
/**
 * 修改管理员
 * @param $id
 * @return string
 */
function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($arr['password']);
    if (update('imooc_admin', $arr, "id={$id}")) {
        $msg = "修改成功";
    } else {
        $msg = "修改失败";
    }
    return $msg;
}
示例#25
0
function editnav($where){
	$arr=$_POST;
	if(update("dw_nav",$arr,$where)){
		echo "修改成功,<a href='nav_config.php'>马上查看</a>";
		//print_r($arr);
		}
	else
	{
		echo "修改失败!";
		}
	}
示例#26
0
function editclass($where){
	$arr=$_POST;
	if(update("dw_class",$arr,$where)){
		echo "修改成功,<a href='class.php'>查看分类</a>";
		//print_r($arr);
		}
	else
	{
		echo "修改失败!";
		}
	}
示例#27
0
function setViews($topicoId)
{
    $con = mysqli_connect(HOST, USER, PASS, DBAS) or die(mysqli_error($con) . "Não foi possível fazer a conexão com o sistema");
    $topicoId = mysqli_real_escape_string($con, $topicoId);
    $readArtigo = read('post', "WHERE id = '{$topicoId}'");
    foreach ($readArtigo as $artigo) {
    }
    $views = $artigo['visitas'];
    $views = $views + 1;
    $dataViews = array('visitas' => $views);
    update('post', $dataViews, " WHERE id = '{$topicoId}'");
}
示例#28
0
文件: 1.php 项目: h0gar/Greplin
function testChar($pos)
{
    global $str, $save;
    //$occ = charOccurences($pos);
    for ($i = $pos + 1; $i < strlen($str); $i++) {
        if ($res = test($pos, $i)) {
            if (strlen($res) > strlen($save)) {
                update($res);
            }
        }
    }
}
示例#29
0
 public function delete($id)
 {
     $data_update = array('is_delete' => '1');
     update('company_mst', $id, $data_update);
     $developers = select('company_with_developer', 'id,developer_id', array('where' => array('company_id' => $id)), array('single' => FALSE));
     foreach ($developers as $developer) {
         $d_id = $developer['developer_id'];
         update('developers_mst', $d_id, $data_update);
     }
     $this->session->set_flashdata('success', 'Company has been Successfully Deleted.');
     redirect('/admin/company');
 }
示例#30
0
function addOrUpdate()
{
    $table = "events";
    $data = createDataFromPost($table);
    if (empty($_GET['id'])) {
        insert($table, $data);
    } else {
        update($table, $data);
    }
    header("Location: index.php");
    die("Redirecting to index.php");
}