update() public method

public update ( $table, $data, $where = null )
コード例 #1
2
ファイル: info.update.php プロジェクト: a707937337/EcjtuOA
<?php

/*
*		功能:更新个人信息
*
*/
session_start();
header("Content-type:text/html; charset=utf8");
include_once './medoo/medoo.php';
$database = new medoo();
$Sname = $_SESSION['name'];
if ($_POST['submit']) {
    $name = $_POST['name'];
    $sex = $_POST['sex'];
    $posit = $_POST['posit'];
    $birth = $_POST['birth'];
    $tel = $_POST['tel'];
    $qq = $_POST['qq'];
    $sql = $database->update("user", array("name" => $name, "sex" => $sex, "depart" => $posit, "birth" => $birth, "tel" => $tel, "qq" => $qq), array("name" => $Sname));
    // 判断是否更新成功
    if ($sql) {
        echo "<script> alert('更新信息成功!'); history.go(-1);</script>";
    } else {
        echo "<script> alert('更新信息失败!'); history.go(-1);</script>";
    }
}
コード例 #2
1
<?php

session_start();
// error_reporting(null);
if (!isset($_SESSION['uid'])) {
    header("Location: login.php");
    exit;
}
date_default_timezone_set('Asia/Shanghai');
include "./medoo.min.php";
$database = new medoo();
if (isset($_GET['qid']) && isset($_POST['reply'])) {
    $name = $database->select("user", "name", array("id" => $_SESSION['uid']));
    $database->insert("answer", array("qid" => $_GET['qid'], "name" => $name[0], "content" => $_POST['reply']));
    $database->update("question", array("isanswer" => 1), array("id" => $_GET['qid']));
    header("Location: my.php");
}
コード例 #3
1
ファイル: router.php プロジェクト: shangwo/letter
$app->get("/buy", function () use($app) {
    try {
        $app->render("buy.html");
    } catch (Exception $e) {
        $app->notfound();
    }
});
$app->get("/buy/:uid/:month/:price", function ($uid, $month, $price) use($app, $databases) {
    try {
        $datas = $databases->select("user", "expire", array("uuid" => $uid, "ORDER" => array("id DESC", "time DESC"), "LIMIT" => array(0, 1)));
        $num;
        $expire = time() + $month * 30 * 24 * 3600;
        $num = $databases->insert("user", array("uuid" => $uid, "expire" => $expire, "price" => $price, "strtime" => $month, "ispay" => 0));
        $ispay = PayMoney($price, $uid, $month, $num);
        if ($ispay) {
            $sure = $databases->update("user", array("ispay" => 1), array("AND" => array("uuid" => $uid, "id" => $num)));
        }
        $type = $app->getCookie("ctype") ? $app->getCookie("ctype") : 1;
        $app->redirect("../../../thirdindex/" . $uid . "/" . $type);
    } catch (Exception $e) {
        $app->notfound();
    }
});
$app->run();
function PayMoney($money = 0, $uid, $month, $order_num)
{
    if ($money != 0) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://hdtv.xmbtn.com/hdtv/api/paylock/ajax/add");
        $post_data = array("stbid" => $uid, "username" => "test", "token" => "uS6jBRN9shDtDf5R", "amount" => $money * 100, "order_msg" => iconv("UTF-8", "GBK", "购买庄子识字套餐" . $month . "个月"), "extra_msg" => "", "cp" => iconv("UTF-8", "GBK", "庄子快速识字"), "name" => iconv("UTF-8", "GBK", "购买套餐"), "type" => iconv("UTF-8", "GBK", "购买套餐"), "order_num" => $order_num);
        $query_data = http_build_query($post_data);
コード例 #4
0
ファイル: MedooPlus.php プロジェクト: wwtg99/data_pool
 /**
  * @param string $table
  * @param array $data
  * @param array $where
  * @return bool|int
  */
 public function update($table, $data, $where = null)
 {
     $re = parent::update($table, $data, $where);
     $this->lastSql = $this->last_query();
     $this->lastError = $this->error();
     return $re;
 }
コード例 #5
0
/**
 * 导入数据到 wd_120answer_temp 中
 * @author gaoqing
 * 2015年11月9日
 * @param array $initAskArr 初始要导入的问答信息集
 * @param int $preInsertCount 每次插入的条数
 * @param medoo $connection 连接数据库对象
 * @param int $sleepSeconds 休眠的秒数
 * @return int $importCount 成功导入的信息数
 */
function importData($initAskArr, $preInsertCount, $connection, $sleepSeconds)
{
    $importCount = 0;
    $data = array("isimport" => 1);
    $insertArr = array();
    $updateIDArr = array();
    $initAskArrCount = count($initAskArr);
    foreach ($initAskArr as $key => $initAsk) {
        if ($key % 100 == 0) {
            sleep($sleepSeconds);
        }
        $insertArr[] = getInserArr($initAsk);
        $updateIDArr[] = $initAsk['id'];
        if ($key % $preInsertCount == $preInsertCount - 1 || $key == $initAskArrCount - 1) {
            //将 $insertArr 数组集,插入到 wd_fhanswer_temp 中
            if (!empty($insertArr)) {
                //插入到 wd_120answer_temp 中
                $idArr = $connection->insert(IMPORT_TABLE, $insertArr);
                $importCount += count($insertArr);
                $insertArr = array();
                //更新 wd_120answer_keshi 中的信息
                $where = array('id' => $updateIDArr);
                $connection->update(SELECT_TABLE, $data, $where);
                $updateIDArr = array();
            }
        }
    }
    return $importCount;
}
コード例 #6
0
ファイル: RootClass.php プロジェクト: indiwine/EMA-engine
 /**
  * Save cahges to DB
  * @param array $args
  * @param bool $extCall
  * @return bool True in case of success
  * @throws FatalError
  * @throws \Exception
  */
 public function save($args, $extCall = false)
 {
     $this->gp->checkAccess(__FUNCTION__, $extCall);
     $id = self::extractId($args);
     if (empty($id)) {
         throw new \Exception('Id is not valid');
     }
     if (is_numeric($args)) {
         $args = array('id' => $id);
     }
     $parsed_arg = $this->checkArguments($args);
     if ($this->isImplement("FileManage")) {
         $uploadedData = $this->saveUploadedFile($id);
         $parsed_arg = array_replace_recursive($parsed_arg, $uploadedData);
     }
     $parsed_arg = $this->parseJson($parsed_arg, true);
     if (EMA_DEBUG && EMA_LOG_SQL_QUERIES) {
         $this->logUpdateQuery($this->dbTable, $parsed_arg, array("id" => $id));
     }
     $dbData = $this->dbConnection->update($this->dbTable, $parsed_arg, array("id" => $id));
     if (is_int($dbData) === false) {
         $this->throwMysqlError();
     }
     if ($this->isImplement("Sitemap")) {
         $this->generateSitemap();
     }
     if ($this->isImplement("RssFeed")) {
         $this->rssFeedUpdate();
     }
     return true;
 }
コード例 #7
0
ファイル: Controller.php プロジェクト: bluestonemds/gongre
            header("location: ../../index.php");
        } else {
            header("location: ../../login.php?error");
        }
    } else {
        header("location: ../../login.php?error");
    }
}
if ("logout" === $action) {
    session_unset();
    header("location: ../../login.php");
}
if ("modify_pw" === $action) {
    $oldpw = $_GET["oldPw"];
    $newpw = $_GET["newPw"];
    $database->update("gr_op", ["pw" => $newpw], ["opid" => $_SESSION["opid"]]);
    echo "密码修改成功!2秒后跳转...";
    echo '<meta http-equiv="refresh" content="2;URL=../../index.php">';
}
if ("listAllOP" === $action) {
    listOP();
    header("location: ../../op.php");
}
function listOP()
{
    global $database;
    $allOP = $database->select("gr_op", "*");
    $_SESSION["allOP"] = $allOP;
}
if ("addOP" === $action) {
    $opid = htmlspecialchars($_GET["opid"]);
コード例 #8
0
ファイル: legacy-stage.php プロジェクト: WhiteXZ/Yuuki
<?php

require '../vendor/autoload.php';
require '../secrets.php';
$data = json_decode(urldecode($_GET['data']), true);
$data['address'] = $_SERVER['REMOTE_ADDR'];
$output = array();
$hash = md5($data['address'] . ":" . $data['port']);
$disableDB = false;
if (!$disableDB) {
    try {
        $database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $dbhost, 'username' => $dbuser, 'password' => $dbpass, 'port' => $dbport, 'charset' => 'utf8']);
    } catch (Exception $e) {
        die("Failed to connect to the database\r\n");
    }
    $record = $database->get("server", "id", ["id" => $hash]);
    if (empty($record)) {
        $database->insert("server", ["id" => $hash, "address" => $data['address'], "port" => $data['port'], "lastupdate" => time()]);
        $database->insert("server_details", ["serverid" => $hash, "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']]);
    } else {
        $database->update("server", ["id" => $hash, "address" => $data['address'], "port" => $data['port'], "lastupdate" => time()], ["id" => $hash]);
        $database->update("server_details", ["serverid" => $hash, "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']], ["serverid" => $hash]);
    }
}
$output["success"] = "Ok";
echo json_encode($output);
コード例 #9
0
ファイル: recipe-backing.php プロジェクト: pederszt/secret_h
ini_set('display_errors', 'On');
error_reporting(E_ALL);
require 'lib/medoo.php';
try {
    $database = new medoo(['database_type' => 'mysql', 'database_name' => 'recipe', 'server' => 'localhost', 'username' => 'recipe', 'password' => 'mPu92jfqRJSVMa8H', 'charset' => 'utf8']);
    $request_body = file_get_contents('php://input');
    if ($request_body != null) {
        $json = json_decode($request_body, true);
        if ($json['data']) {
            $json = $json['data'];
        }
        $resultObj = array();
        if ($json['recipe_id'] != null) {
            $recipe_id = $json['recipe_id'];
            $where = ['recipe_id' => $recipe_id];
            $result = $database->update("recipe", $json, $where);
        } else {
            $result = $database->insert("recipe", $json);
            $resultObj["recipe_id"] = $result;
        }
        print_r(json_encode($resultObj));
    } else {
        $data = $database->select("recipe", "*", []);
        foreach ($data as &$row) {
            $ingredients = $database->select("recipe_ingredient", ["[>]ingredient" => "ingredient_id", "[>]measure" => "measure_id"], "*", ["recipe_id" => $row["recipe_id"]]);
            $row["ingredients"] = $ingredients;
            foreach ($ingredients as &$ing) {
                if ($ing["amount"] == 1) {
                    $ing["measure"] = $ing["measure_abbr"];
                } else {
                    $ing["measure"] = $ing["measure_plural_abbr"];
コード例 #10
0
$con = mysql_connect($config['db']['server'], $config['db']['username'], $config['db']['password']);
//change configs
$db = mysql_select_db($config['db']['database_name'], $con);
//change database
$c_id = $_POST["courseid"];
foreach ($_POST as $key => $value) {
    if ($key != "courseid") {
        // echo "$key"."-->"."$value[0]"."<br>";
        // echo "$key"."-->"."$value[1]"."<br>";
        // echo "<br>"."<br>";
        mysql_query("INSERT INTO `feedback` (`question_id`,`answer`,`comment`,`courseid`) VALUES ('{$key}','{$value['0']}','{$value['1']}','{$c_id}')") or die(mysql_error());
    }
}
//update student course linkage
$db = new medoo($config['db']);
$db->update('student_course', ['done' => 1], ["AND" => ['student' => $userid, 'course' => $c_id]]);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Feedback successful</title>

    <!-- Bootstrap -->
    <link href="<?php 
echo $config['url']['base_url'];
?>
/css/bootstrap.min.css" rel="stylesheet">
コード例 #11
0
ファイル: view_item.php プロジェクト: pioytazsko/garantmarket
<?php

require 'medoo.min.php';
$id = $_POST['id'];
$view = $_POST['view'];
echo $id . $view;
//print_r($_POST);
$database = new medoo(array('database_type' => 'mysql', 'database_name' => 'garantmarket', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8'));
//$database = new medoo(array(
//	'database_type' => 'mysql',
//	'database_name' => 'garantma_db',
//	'server' => 'localhost',
//	'username' => 'garantma_user',
//	'password' => 'crKAyqBMMaEq',
//	'charset' => 'utf8'
//    ));
if ($view == 'not') {
    $database->update("catalog", array("view" => false), array("id" => $id));
} else {
    $database->update("catalog", array("view" => true), array("id" => $id));
}
コード例 #12
0
    // e.g 'F'
    $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
    $nrColumns = ord($highestColumn) - 64;
    //    echo "<br>The worksheet ".$worksheetTitle." has ";
    //    echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
    //    echo ' and ' . $highestRow . ' row.';
    //    echo '<br>Data: <table border="1"><tr>';
    for ($row = 1; $row <= $highestRow; ++$row) {
        //        echo '<tr>';
        //        for ($col = 0; $col < $highestColumnIndex; ++ $col) {
        //            $cell = $worksheet->getCellByColumnAndRow($col, $row);
        //            $val = $cell->getValue();
        //            $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
        //            echo '<td>' . $val . '<br>(Typ ' . $dataType . ')</td>';
        //        }
        //        echo '</tr>';
        // отправка данных в бд
        $id = $worksheet->getCellByColumnAndRow(0, $row)->getValue();
        $dataType = PHPExcel_Cell_DataType::dataTypeForValue($id);
        if ($dataType == 'n') {
            $name = $worksheet->getCellByColumnAndRow(1, $row)->getValue();
            $manufected = $worksheet->getCellByColumnAndRow(2, $row)->getValue();
            $price = $worksheet->getCellByColumnAndRow(3, $row)->getValue();
            $title = $worksheet->getCellByColumnAndRow(4, $row)->getValue();
            //            echo $dataType.$price;
            $database->update("catalog", array("name" => $name, "price" => $price, "title" => $title), array("id" => $id));
        }
        //        $database
    }
}
header('Location:http://garantmarket.by/admin/catalog.php?idp=26');
コード例 #13
0
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/1
 * Time: 16:41
 */
include '../../parameter/Medoo/Resource/medoo.php';
//改变meeting的状态,
$id = $_POST['id'];
$db = new medoo("meetingmanage");
$db->update("meeting", array("STATE" => 0), array("MEETING_ID" => $id));
//改变attendentce的状态
$db->update("attendence", array("STATE" => 0), array("MEETING_ID" => $id));
コード例 #14
0
<?php

require_once 'meedoo.php';
require_once 'config.php';
$database = new medoo();
$mealID = $_POST["mealID"];
$position = $_POST["position"];
$positionOrder = $_POST["positionOrder"];
$update = $database->update("meals", ["position" => $position, "PositionOrder" => $positionOrder], ["mealID" => $mealID]);
if ($update) {
    echo 'good';
} else {
    echo 'bad';
}
コード例 #15
0
    $title = match('/<td class="titleColumn">.*?<a.*?>(.*?)<\\/a>/msi', $m, 1);
    $year = match('/<td class="titleColumn">.*?<span.*?>\\((.*?)\\)<\\/span>/msi', $m, 1);
    $rating = match('/<td class="ratingColumn">.*?<strong.*?>(.*?)<\\/strong>/msi', $m, 1);
    $poster = match('/<td class="posterColumn">.*?<img src="(.*?)"/msi', $m, 1);
    $votesURL = "http://www.imdb.com/title/" . $id . "/";
    $votes = getvotes($votesURL);
    // create each movie object and set the variables
    $movie = new Movie();
    $movie->setId($id);
    $movie->setRank($rank);
    $movie->setTitle($title);
    $movie->setYear($year);
    $movie->setRating($rating);
    $movie->setVotes($votes);
    // insert $movie objects into an array
    array_push($top10Movies, $movie);
    // stop at 10
    if ($rank == 10) {
        break;
    }
}
$date = $db->select("movies", "date_added");
// insert into database using medoo if it does not exist
foreach ($top10Movies as $movie) {
    // check database for matching date, if same day update, else insert
    if (in_array($today, $date)) {
        $db->update("movies", ["imdb_id" => $movie->getId(), "rank" => $movie->getRank(), "rating" => $movie->getRating(), "title" => $movie->getTitle(), "year" => $movie->getYear(), "number_of_votes" => $movie->getVotes(), "date_added" => $today], ["date_added" => $today, "rank" => $movie->getRank()]);
    } else {
        $db->insert("movies", ["imdb_id" => $movie->getId(), "rank" => $movie->getRank(), "rating" => $movie->getRating(), "title" => $movie->getTitle(), "year" => $movie->getYear(), "number_of_votes" => $movie->getVotes(), "date_added" => $today]);
    }
}
コード例 #16
0
ファイル: upload_read.php プロジェクト: a707937337/EcjtuOA
<?php

/**
*	更新消息为已读消息
*
*/
session_start();
header("Content-type:text/html; charset=utf-8");
include 'medoo/medoo.php';
$database = new medoo();
if (@$_POST['read']) {
    $read = $_POST['read'];
    $name = $_SESSION['name'];
    $sql = $database->update("message", array("read" => $read), array("Toname" => $name));
    $result = array();
    if ($sql) {
        $result['state'] = "success";
    } else {
        $result['state'] = "error";
    }
    $result_json = json_encode($result);
    echo $result_json;
}
コード例 #17
0
ファイル: modify_pwd.php プロジェクト: keensting/ErhuoAmbass
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/10/14
 * Time: 13:55
 */
require_once '../../../medoo/medoo.php';
$rand = $_POST['rand'];
$key = $_POST['key'];
$pwd = sha1($rand . md5($_POST['pwd']));
//重新加密
$db = new medoo();
//修改数据库中的数据
$re = $db->update('ambassador', array('randdata' => $rand, 'pwd' => $pwd), array('ekey' => $key));
unset($db);
if ($re == 1) {
    echo 'ok';
} else {
    echo 'error';
}
コード例 #18
0
/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/8
 * Time: 12:51
 */
require_once './parameter/Medoo/Resource/medoo.php';
session_start();
$rid = $_SESSION['rid'];
$num = $_POST['num'];
$space = $_POST['space'];
$mic = $_POST['mic'];
$ppt = $_POST['ppt'];
$board = $_POST['board'];
$state = $_POST['state'];
$mydb = new medoo('meetingmanage');
$mydb->update('rooms', array('NUM' => $num, 'SPACE' => $space, 'MIC' => $mic, 'PPT' => $ppt, 'BOARD' => $board, 'STATE' => $state), array('ROOM_ID' => $rid));
?>

<html>
<head>

</head>
<body style="background-color: #ffffff">
<script>
    alert('该部门信息已修改完成!');
</script>
<meta http-equiv="refresh" content="1;url='./meetingroom.php'">
</body>

</html>
コード例 #19
0
ファイル: add_user.php プロジェクト: keensting/ErhuoAmbass
            $level = 21;
        } elseif ($_POST['auth'] == 1) {
            $level = 11;
        } else {
            $level = 0;
        }
        //时间格式转化
        $arr = explode('/', substr($_POST['date'], 0, 10));
        $date = gmmktime(0, 0, 0, $arr[0], $arr[1], $arr[2]);
        //        print_r($date);
        $id = $db->insert('ambassador', array('nickname' => $_POST['nickname'], 'ekey' => $_POST['key'], 'pwd' => $hash_pwd, 'auth' => $_POST['auth'], 'date' => $date, 'school' => $_POST['school'], 'province' => $_POST['province'], 'city' => $_POST['city'], 'randdata' => $_POST['randdata'], 'name' => $_POST['name'], 'level' => $level, 'salary' => 0));
        //信息和school表进行匹配更新
        $school = $db->select('school', '*', array('name' => $_POST['school']));
        if (empty($school)) {
            $db->insert('school', array('name' => $_POST['school'], 'area' => $_POST['province'], 'city' => $_POST['city']));
        } else {
            $db->update('school', array('area' => $_POST['province'], 'city' => $_POST['city']), array('name' => $_POST['school']));
        }
        unset($db);
    } catch (Exception $e) {
        echo '<center><h1 style="color: red">添加失败!</h1></center><meta http-equiv="refresh" content="2;url=http://am.erhuoapp.com/' . $type . '/project/htdocs/adduser.php">';
    }
    if ($id > 0) {
        echo '<center><h1 style="color: chartreuse;">添加成功!</h1></center><meta http-equiv="refresh" content="2;url=http://am.erhuoapp.com/' . $type . '/project/htdocs/adduser.php">';
    } else {
        echo $id;
        //        echo '<h1 style="color: red">添加失败!</h1><meta http-equiv="refresh" content="2;url=http://ambassador.erhuoapp.com/'.$type.'/project/htdocs/adduser.php">';
    }
} else {
    echo '<center><h1 style="color: red">权限不足!</h1></center><meta http-equiv="refresh" content="2;url=http://am.erhuoapp.com/' . $type . '/project/htdocs/adduser.php">';
}
コード例 #20
0
ファイル: submitpoll.php プロジェクト: jrwr/simplepoll
         $questions[$quest['qid']] = $quest['text'];
     }
     //match the arrays up and post the data
     foreach ($_POST['choice'] as &$choice) {
         $choice = (int) $choice;
         if (!empty($questions[$choice])) {
             $choicedb[] = $choice;
         } else {
             die('<img src="http://i.imgur.com/cuMtVS8.jpg"><br><br><h1>Missing Choice<br>WTF DID YOU DO? STOP F*****G ABOUT WITH THE POST DATA</h1>');
         }
     }
     //store votes
     foreach ($choicedb as &$cid) {
         $id = $database->insert("votes", ["ip" => $ip, "qid" => $cid, "pid" => $pid, "data" => 1]);
         //update results
         $id2 = $database->update("results", ["amount[+]" => 1], ["AND" => ["qid" => $cid, "pid" => $pid]]);
     }
     break;
 case 2:
     //Single Choice
     $questdb = $database->select("questions", ["qid", "text"], ["pid" => $pid]);
     //redo array to have key/value for this
     foreach ($questdb as &$quest) {
         $questions[$quest['qid']] = $quest['text'];
     }
     //match the arrays up and post the data
     $choice = (int) $_POST['radio'];
     if (!empty($questions[$choice])) {
         $id = $database->insert("votes", ["ip" => $ip, "qid" => $choice, "pid" => $pid, "data" => 1]);
         //update results
         $id2 = $database->update("results", ["amount[+]" => 1], ["AND" => ["qid" => $choice, "pid" => $pid]]);
コード例 #21
0
ファイル: set_zfb.php プロジェクト: keensting/ErhuoAmbass
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/10/21
 * Time: 10:47
 */
//设置支付宝账号,返回ok说明设置成功
require_once '../../../medoo/medoo.php';
$demo = new medoo();
$name = $_POST['name'];
session_start();
$key = $_SESSION['userinfo']['ekey'];
$re = $demo->update('ambassador', array('zfb_id' => $name), array('ekey' => $key));
if ($re == 1) {
    $_SESSION['userinfo']['zfb_id'] = $name;
    echo 'ok';
} else {
    echo 'error';
}
コード例 #22
0
ファイル: Medoo.php プロジェクト: larryli/ipv4-medoo
 /**
  * @param $table
  * @param $data
  * @param null $where
  * @return bool|int
  */
 public function update($table, $data, $where = null)
 {
     return parent::update($this->prefix . $table, $data, $where);
 }
コード例 #23
0
ファイル: message.back.php プロジェクト: a707937337/EcjtuOA
*
*/
session_start();
header("Content-type:text/html; charset=utf8");
date_default_timezone_set('Asia/Shanghai');
include_once "./medoo/medoo.php";
$database = new medoo();
$result = array();
$time = date("Y-m-d H:i:s");
if (@$_POST['id']) {
    $id = $_POST['id'];
    $backmes = $_POST['backmes'];
    if ($backmes == "") {
        $result['state'] = "error";
        $result['message'] = "内容不能为空!";
        exit;
    }
    $sql = $database->update("message", array("backmes" => $backmes, "mid" => 1, "backtime" => $time), array("id" => $id));
    if ($sql) {
        $result['state'] = "success";
        $result['message'] = "回复成功!";
    } else {
        $result['state'] = "error";
        $result['message'] = "回复失败!";
    }
} else {
    $result['state'] = "error";
    $result['message'] = "未获得POST的值!";
}
$result_json = json_encode($result);
echo $result_json;
コード例 #24
0
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/8
 * Time: 10:41
 */
require_once './parameter/Medoo/Resource/medoo.php';
$id = $_GET['id'];
$mydb = new medoo('meetingmanage');
$mydb->update('user', array('STATE' => 0), array('USER_ID' => $id));
?>
<html>
<head>

</head>
<body style="background-color: #ffffff">
    <script>
        alert('该员工信息已经删除!');
    </script>
    <meta http-equiv="refresh" content="1;url='./person.php'">
</body>

</html>
コード例 #25
0
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/10/14
 * Time: 12:49
 */
require_once '../../../medoo/medoo.php';
$key = $_POST['key'];
$db = new medoo();
$re = $db->update('ambassador', array('auth' => 2), array('ekey' => $key));
unset($db);
if ($re == 1) {
    echo 'ok';
} else {
    echo 'error';
}
コード例 #26
0
ファイル: location.php プロジェクト: pioytazsko/garantmarket
<?php

define('__ROOT__', $_SERVER['DOCUMENT_ROOT']);
require_once __ROOT__ . '/medoo.min.php';
require_once __ROOT__ . '/config.php';
$database = new medoo(array('database_type' => $config_db['database_type'], 'database_name' => $config_db['database_name'], 'server_name' => $config_db['server_name'], 'username' => $config_db['username'], 'password' => $config_db['password'], 'charset' => $config_db['charset']));
$data = $_POST['data'];
$data = json_decode($data);
//print_r($data);
//отрабатываем изменение , потом  сохраняем
foreach ($data as $val) {
    $database->update("location_discount", array("discount" => $val->discount), array("city" => $val->name));
    echo $val->name;
}
コード例 #27
0
<?php

session_start();
error_reporting(null);
date_default_timezone_set('Asia/Shanghai');
include "./medoo.min.php";
$database = new medoo();
if (isset($_POST['uid']) && isset($_POST['qid'])) {
    $database->insert("who", array("qid" => $_POST['qid'], "uid" => $_POST['uid']));
    $database->update("question", array("isreply" => 1), array("id" => $_POST['qid']));
    header("Location: manager.php");
}
コード例 #28
0
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/7
 * Time: 13:09
 */
session_start();
$did = $_SESSION['did'];
$id = $_POST['depart'];
include './parameter/Medoo/Resource/medoo.php';
$mydb = new medoo('meetingmanage');
//换部门
$mydb->update('user', array('DEPART_ID' => $id), array('DEPART_ID' => $did));
//删除部门
$mydb->delete('departs', array('DEPART_ID' => $did));
?>
<html>
<head>

</head>
<body>
<script>
    alert("部门人员已经转移,部门已从列表中删除!");
</script>
    <meta http-equiv="refresh" content="1;href='./delDepart.php'";
</body>
</html>
コード例 #29
0
/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/1
 * Time: 16:22
 */
//todo,改变meting表中会议状态validity
// todo,inform 中增加一项
//todo,1,attendence中检索meeting id,2,对应状态state设置为0 无效,3,对应user id写成新的notice,4,并将user表中的mes改为当前inform_id
$mid = $_POST['id'];
session_start();
$id = $_SESSION['uid'];
include '../../parameter/Medoo/Resource/medoo.php';
//meeting
$db = new medoo('meetingmanage');
$db->update('meeting', array('VALIDITY' => 1), array('MEETING_ID' => $mid));
//
////inform
$re = $db->select('inform', 'CONTENT', array('MEETING_ID' => 40002));
$content = $re[0];
$new_mes = "注意:关于【" . $content . "】的会议已经取消,请您确认信息!";
$iid = $db->max('inform', 'INFORM_ID');
$iid += 1;
$date = date("Y/m/d");
$db->insert("inform", array('INFORM_ID' => $iid, 'USER_ID' => $id, 'DATE' => $date, 'CONTENT' => $new_mes, 'MEETING_ID' => $mid));
//attendence
//获得user列表
$users = $db->select('attendence', 'USER_ID', array('MEETING_ID' => 40000));
//跟新参会状态
$db->update('attendence', array('STATE' => 0), array('MEETING_ID' => $mid));
//notice & user
コード例 #30
0
    while ($k < $t) {
        $result = mysql_query("SELECT * FROM feedback WHERE question_id='{$q_id[$k]}'") or die(mysql_error());
        $resp = array("question" => $question[$k], "one" => "0", "two" => "0", "three" => "0", "four" => "0", "five" => "0", "six" => "0");
        if ($type[$k] == "radio") {
            while ($row = mysql_fetch_array($result)) {
                $resp[$row['answer']]++;
            }
            $p++;
            fputcsv($output, $resp);
        }
        $k++;
    }
    //reset feedback data
    $db = new medoo($config['db']);
    $db->delete('feedback', ['courseid' => $_GET['courseid']]);
    $db->update('student_course', ['done' => 0], ['course' => $_GET['courseid']]);
} else {
    ?>

<!doctype html>
<html>
	<head>
		<title>Feedback Statistics</title>
		<script src="<?php 
    echo $config['url']['base_url'] . $config['js_includes']['jquery'];
    ?>
"></script>
		<script src="Chart.js"></script>
	
		<link rel="stylesheet" href="accr.css" />