本文整理汇总了PHP中logs函数的典型用法代码示例。如果您正苦于以下问题:PHP logs函数的具体用法?PHP logs怎么用?PHP logs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: m__set_level
function m__set_level()
{
global $dbm;
$_POST = helper::sqlxss($_POST);
$aid = isset($_POST['aid']) ? intval($_POST['aid']) : 0;
$gid = isset($_POST['gid']) ? intval($_POST['gid']) : 0;
$_POST['level'] = isset($_POST['level']) ? $_POST['level'] : array();
if ($aid < 0 && $gid < 0) {
die('{"code":"1","msg":"请选择权限设置对象,无法设置"}');
}
if ($gid > 0) {
if ($gid == 1) {
die('{"code":"100","msg":"超级管理组权限无需设置"}');
}
check_level("B0301");
$fields['g_urank'] = implode(',', $_POST['level']);
$rs = $dbm->single_update(TB_PREFIX . 'admin_group', $fields, "group_id='{$gid}'");
logs("设置组权限成功:" . $fields['g_urank']);
die('{"code":"0","msg":"设置用户组权限成功"}');
}
if ($aid > 0) {
check_level("B0302");
//die(print_r($_POST));
$fields['alevel'] = implode(',', $_POST['level']);
$rs = $dbm->single_update(TB_PREFIX . 'admin_list', $fields, "admin_id='{$aid}'");
logs("设置组权限成功:" . $fields['alevel']);
die('{"code":"0","msg":"设置用户权限成功"}');
}
}
示例2: doAdd
public function doAdd()
{
$udata['user_name'] = text($_POST['user_name']);
$cs = M('members')->where($udata)->count('id');
if ($cs > 0) {
$this->error("添加失败,此用户名已被占用,请重试");
exit;
}
if (empty($udata['user_name'])) {
$this->error("用户名不能为空,请重试");
exit;
}
$udata['is_transfer'] = 1;
$udata['reg_ip'] = get_client_ip();
$udata['user_leve'] = 1;
$udata['time_limit'] = time() + 24 * 3600 * 360;
$udata['user_pass'] = md5(time() . rand(10, 99));
$udata['reg_time'] = strtotime($_POST['reg_time'] . " " . date("H:i:s", time()));
$newid = M('members')->add($udata);
if ($newid) {
$idata['uid'] = $newid;
$idata['real_name'] = text($_POST['real_name']);
$idata['address'] = text($_POST['address']);
$idata['info'] = text($_POST['info']);
M('member_info')->add($idata);
alogs("Tmembers", $newid, 1, '成功执行了流转会员的添加操作!');
//管理员操作日志
$this->success("添加成功", __URL__ . "/index");
} else {
logs("Tmembers", $newid, 0, '执行流转会员的添加操作失败!');
//管理员操作日志
$this->error("添加失败,请重试");
}
}
示例3: autoLogin
/**
* 保存登陆信息
* @param [type] $user
*/
private function autoLogin($user)
{
$loginData = ['uid' => $user['id'], 'account' => $user['account'], 'login' => $user['login'], 'last_time' => $user['last_time'], 'last_ip' => $user['last_ip']];
session('user_auth', $loginData);
session('user_auth_sign', data_auth_sign($loginData));
// 保存登陆信息
$saveData = ['last_ip' => get_client_ip(), 'last_time' => NOW_TIME, 'login' => ['exp', '`login`+1']];
Db::name('Member')->where('id', $user['id'])->update($saveData);
logs('登陆成功', '', $user['id']);
}
示例4: checkToken
function checkToken()
{
if (API_KEY != (isset($_GET["token"]) ? $_GET["token"] : false)) {
logs("ERROR TOKEN!");
logs_var("_GET", $_GET);
logs_var("_POST", $_POST);
logs_var("_SERVER", $_SERVER);
exit;
}
}
示例5: indexAction
public function indexAction()
{
$where = array('id' => 37936);
//第一个参数是要打印的内容
//第二各参数是生成日志文件名
//第三个参数$level分为:EMERG,ALERT,CRIT,ERR,WARN,NOTIC,INFO,DEBUG,SQL
logs('zas');
//$user=new ZysModel('hb_users');//直接实例化给表名就行了,其他跟操作thinkphp一样
//$result = $user->where($where)->select();
//echo $user->getlastsql();
//print_r($result);
alert("3");
exit;
}
示例6: runConsumer
function runConsumer($topic)
{
$lockfile = '/tmp/mytest.lock';
$startTime = explode(' ', microtime());
$kmlCachePath = getconfig('kmlCachePath');
//本地缓存里存在数据则优先执行
$cacheFiles = getFileList('./cache/' . $topic);
if (!empty($cacheFiles)) {
sort($cacheFiles);
foreach ($cacheFiles as $f) {
$kmls = json_decode(file_get_contents($f));
$items = array_chunk($kmls, 25);
foreach ($items as $item) {
updataKml($item, $startTime, $f, 2, $topic);
}
}
}
// $i = 1;
$f = '';
logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic);
while ($da = kafka::getInstance()->get($topic)) {
$starttime = explode(' ', microtime());
if (!empty($da->messageList)) {
foreach ($da->messageList as $d) {
$kmls[] = json_decode($d->message);
}
//$i++;
//if($i > 10){
updataKml($kmls, $starttime, $f, 1, $topic);
usleep(10);
logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic);
$kmls = [];
/* $i = 1;
}
}else{
if(!empty($kmls)){
updataKml($kmls,$starttime,$f,1, $topic);
}
break;*/
} else {
unlink($lockfile);
logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
echo 'aa';
exit;
}
}
logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
unlink($lockfile);
}
示例7: pJAccesslist2
/**
* @Title: pJAccesslist
* @Description: todo(任务节点权限生成)
* @param $id int 任务节点id(以前用于生成数组key值,后改用控制器名称)
* @param $actionname string 控制器名称
* @author 谢友志
* @date 2015-4-7 上午9:59:20
* @throws
*/
public function pJAccesslist2($actionname, $id = '')
{
//查找任务节点对应模板名称
$Action = $actionname;
//查找该模板名称对应记录
$nodedetails = M("node")->where("name='" . $Action . "'")->find();
if (!$nodedetails) {
logs($Action . "---------没有对应模板------------", "taskNodeAccess");
}
//$nodeid = getFieldBy($action,"name","id","node");
//查找该模板的操作节点
$nodemodel = M("node");
$list = $nodemodel->where("pid=" . $nodedetails['id'])->select();
/**
索引文件以“paaccess_”+任务节点id为key值 已对应模板名称为value值组成数组
*/
if ($list) {
//组合一个索引文件的元素 这里直接做成一个数组,后面与索引文件取得的数组进行合并
$name = "pjaccess_" . $Action;
//对操作节点数据进行重组$detailes
$temp = array('GROUPID' => $nodedetails['group_id']);
foreach ($list as $k => $v) {
$optionname = strtoupper($v['name']);
// if($optionname=="INDEX"){
$temp1 = array($optionname => $v['id'] . "-1");
// }else{
// $temp1 = array($optionname=>$v['id']."-4");
// }
$temp = array_merge($temp, $temp1);
}
$detailes = array($Action => $temp);
//套表 组合表情况下 添加权限详情元素
$isbinddetailes = $this->pjAccessisbind($Action);
$detailes = array_merge($detailes, $isbinddetailes);
//暂时生成文件 其操作节点权限全部为1
//任务节点权限文件夹
$pathconf = DConfig_PATH . '/PJAccessList';
if (!file_exists($pathconf)) {
createFolder($pathconf);
}
//调用lookupobj模型的写入文件方法
$lookupmodel = D("LookupObj");
// 每个任务节点生成单独的文件
$detailesfile = $pathconf . '/' . $name . '.php';
$detailesnum = $lookupmodel->SetSongleRule($detailesfile, $detailes);
} else {
logs($Action . "=======没有对应下级操作========", "taskNodeAccess");
}
}
示例8: cleartable
public function cleartable()
{
$model = D("User");
$sql = "SELECT tablename,formid FROM `mis_dynamic_form_manage` LEFT JOIN `mis_dynamic_database_mas` ON mis_dynamic_form_manage.id=mis_dynamic_database_mas.formid WHERE tpl NOT LIKE\t'%basisarchivestpl%' order by formid desc ";
$list = $model->query($sql);
$endsql = "";
$misDynamicFormProperyDao = M("mis_dynamic_form_propery");
$endresult = true;
$msg = "";
foreach ($list as $key => $val) {
if ($val['tablename']) {
$proMap = array();
$proMap['category'] = "datatable";
$proMap['formid'] = $val['formid'];
$datelist = $misDynamicFormProperyDao->where($proMap)->getField("dbname,fieldname");
if ($datelist) {
foreach ($datelist as $dkey => $dval) {
$tablename = $dkey . "_sub_" . $dval;
$sql = "delete from `{$tablename}` ";
$result = $model->query($sql);
$autokey = "ALTER TABLE {$tablename} AUTO_INCREMENT = 1;";
$autoresult = $model->query($autokey);
$model->commit();
if (!$result) {
$msg .= $model->getDbError();
$endresult = false;
}
}
}
$endsql = "delete from `{$val['tablename']}` ";
$result = $model->query($endsql);
logs('清理数据---' . $endsql, 'cleardate');
$autokey = "ALTER TABLE {$val['tablename']} AUTO_INCREMENT = 1;";
$result = $model->query($autokey);
logs('重置key---' . $autokey, 'cleardate');
$model->commit();
if (!$result) {
$msg .= $model->getDbError();
$endresult = false;
}
}
}
if ($endresult == false) {
$this->error("执行失败!");
} else {
$this->success("执行成功!");
}
}
示例9: sms
function sms($id, $erreur = '')
{
$infoServices = Connexion::query('SELECT services.id,services.nom,services.tel,tests.date,tests.heure,tests.trl,tests.codeHttp FROM tests,services WHERE tests.service_id=services.id AND tests.id=' . $id . '');
$tel = $infoServices[0][2];
if ($erreur != '') {
$sms = 'http://www.sms-lowcost.com/cgi-bin/?keyid=&num=' . $tel . '&sms=' . urlencode('[Monitoring Tridemark] Le service ' . $infoServices[0][1] . ' est maintenant rétabli (id:' . $infoServices[0][0] . ')');
} else {
$sms = 'http://www.sms-lowcost.com/cgi-bin/?keyid=&num=' . $tel . '&sms=' . urlencode('[Monitoring Tridemark] Erreur sur le service ' . $infoServices[0][1] . ' (id:' . $infoServices[0][0] . ')');
}
$fichier = file($sms);
if (substr($fichier[0], 55, 1) == 0) {
logs('envoi de sms, erreur pour le service ' . $id, 'reussi');
} else {
logs('envoi de sms, erreur pour le service ' . $id, 'echec');
}
}
示例10: runProducer
function runProducer()
{
$kmlPath = getconfig('kmlPath');
$xml_file = getFileList($kmlPath);
$lockfile = '/tmp/producer.lock';
if (empty($xml_file)) {
logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.");
unlink($lockfile);
exit;
}
sort($xml_file);
$startTime = explode(' ', microtime());
$totalNum = 0;
$i = $n = 1;
foreach ($xml_file as $f) {
//解析文件生成数组
$data = paseXml($f);
//XML格式检查
$res = isFormat($data, $f);
if ($res === false) {
continue;
}
//格式化
$kmldata = formatKmlData($data, $f);
$i++;
$fNum = count($kmldata);
$totalNum += $fNum;
//入队列
$kafkaTime = explode(' ', microtime());
$fileName = basename($f);
insertKafka($kmldata, $fileName);
logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime));
if ($n > 100) {
usleep(200);
$n = 1;
}
//备份文件:
backFile($f);
}
logs('Total time:' . getTime($startTime));
//unlock();
//$lockfile = '/tmp/producer.lock';
unlink($lockfile);
exit;
}
示例11: m__login
function m__login()
{
global $dbm;
$_POST = helper::sqlxss($_POST);
$_POST['uname'] = isset($_POST['uname']) ? $_POST['uname'] : '';
$verify = verify::verify_length($_POST['uname'], 1, 20);
if ($verify != '') {
die('{"code":"1","msg":"账号' . $verify . '","id":"uname"}');
}
$_POST['upass'] = isset($_POST['upass']) ? $_POST['upass'] : '';
$verify = verify::verify_upass($_POST['upass']);
if ($verify != '') {
die('{"code":"1","msg":"' . $verify . '","id":"uname","id":"upass"}');
}
$_POST['code'] = isset($_POST['code']) ? $_POST['code'] : '';
$_POST['safecode'] = isset($_POST['safecode']) ? $_POST['safecode'] : '';
if ($_POST['safecode'] != SAFE_CODE) {
die('{"code":"1","msg":"安全码错误","id":"safecode"}');
}
if ($_SESSION['login'] != md5(strtoupper($_POST['code']))) {
die('{"code":"1","msg":"验证码错误","id":"code"}');
}
$sql = "select a.*,b.g_urank,b.g_name from " . TB_PREFIX . "admin_list a left join " . TB_PREFIX . "admin_group b on a.group_id=b.group_id where aname='" . $_POST['uname'] . "' limit 1";
$rs = $dbm->query($sql);
//print_r($rs);
if (count($rs['list']) == 0) {
die('{"code":"1","msg":"账号不存在","id":"uname"}');
}
if ($rs['list'][0]['apass'] != helper::password_encrypt($_POST['upass'])) {
die('{"code":"1","msg":"密码错误","id":"upass"}');
}
if ($rs['list'][0]['astate'] != 0) {
die('{"code":"1","msg":"账号异常","id":"uname"}');
}
// 登陆成功
$_SESSION['admin']["admin_id"] = $rs['list'][0]['admin_id'];
$_SESSION['admin']["aname"] = $rs['list'][0]['aname'];
$_SESSION['admin']["aname_true"] = $rs['list'][0]['aname_true'];
$_SESSION['admin']["group_id"] = $rs['list'][0]['group_id'];
$_SESSION['admin']['group_level'] = $rs['list'][0]['g_urank'];
$_SESSION['admin']['gname'] = $rs['list'][0]['g_name'];
$_SESSION['admin']["alevel"] = $_SESSION['admin']['group_level'] . ',|,' . $rs['list'][0]['alevel'];
logs($_SESSION['admin']["aname"] . "登陆成功");
die('{"code":"0","msg":"登录成功"}');
}
示例12: addKml
function addKml($returndata, $kmls, $topic)
{
$result = formatKml($returndata, $kmls);
$dsn = getconfig('dsn');
$user = getconfig('user');
$pwd = getconfig('pwd');
$table = getconfig('table');
$db = new PDO($dsn, $user, $pwd);
$arr[] = '';
$sql = "INSERT INTO {$table} (`storeId`,`distribution`,`rtNum`,`kmlStatus`,`itno`,`qty`,`docTime`,`createTime`,`updateTime`,`kmlPath`) VALUES ";
foreach ($result as $k => $arr) {
$sql .= '("' . $arr['storeId'] . '","' . $arr['distribution'] . '","' . $arr['rtNum'] . '","' . $arr['kmlStatus'] . '","' . $arr['itno'] . '","' . $arr['qty'] . '","' . $arr['docTime'] . '","' . $arr['createTime'] . '","' . date('Y-m-d H:i:s', time()) . '","' . $arr['kmlPath'] . '"),';
}
$sql = substr($sql, 0, strlen($sql) - 1);
$row = $db->exec($sql);
if (empty($lastId)) {
logs('error insert into, SQL:' . $sql, 2, 'consumer', $topic);
}
return $row;
}
示例13: Query
function Query($query)
{
$query = str_replace('%pre%', $this->dbpre, $query);
$results = mysql_query($query);
$data = array();
if ($results) {
while ($row = mysql_fetch_assoc($results)) {
$data[] = $row;
}
}
//$b=true;
$b = false;
if ($b) {
$query = "EXPLAIN " . $query;
$results2 = mysql_query($query);
if ($results2) {
while ($row = mysql_fetch_assoc($results2)) {
$explain[] = $row;
}
}
logs("\r\n" . $query . "\r\n" . var_export($explain, true));
}
return $data;
}
示例14: backFile
function backFile($f)
{
$fileArr = explode('/', $f);
$filename = $fileArr[count($fileArr) - 1];
//$path = getconfig('kmlBakPath').'/'.date('Y-m-d'));
//mkFolder($path);
$path = getconfig('kmlBakPath');
if (file_exists($f)) {
// moveFile($f, $path.'/'.$filename);
$kmlBakPath = '/home/webdata/htdocs/data/feiniu/snd/NEW_KML_BACKUP/' . date('Y-m-d');
mkFolder($kmlBakPath);
moveFile($f, $kmlBakPath . '/' . $filename);
logs("success move to " . $kmlBakPath);
}
logs("success move to bakkup");
}
示例15: mysql_query
$_POST['wamount'] = $_POST['wamount'] * 1000000;
}
if ($_POST['wamount'] > $user->bank) {
echo "You do not have that much money in the bank";
}
if (!preg_match('~^[a-z0-9 ]+$~i', $_POST['wamount'])) {
echo "Invalid characters detected.";
include "_footer.php";
die;
}
if ($_POST['wamount'] <= $user->bank && $_POST['wamount'] > 0) {
echo "Money withdrawn.";
$user->bank = $user->bank - $_POST['wamount'];
$user->money = $user->money + $_POST['wamount'];
$result = mysql_query("UPDATE `users` SET `bank` = '" . $user->bank . "', `money` = '" . $user->money . "' WHERE `id`='" . $_SESSION['userid'] . "'");
logs($uid, " withdrew \$" . $_POST['wamount'] . " !");
}
}
?>
<center>
<table class="pretty-table"><tr>
<th>
Withdraw Money
</th>
</tr><tr>
<td>
<br><br>
<form method='post'>