function pleac_Checking_Whether_a_String_Is_a_Valid_Number()
{
    // Two basic approaches to numeric validation:
    // * Built-in functions like 'is_numeric', 'is_int', 'is_float' etc
    // * Regexes, as shown below
    $s = '12.345';
    preg_match('/\\D/', $s) && die("has nondigits\n");
    preg_match('/^\\d+$/', $s) || die("not a natural number\n");
    preg_match('/^-?\\d+$/', $s) || die("not an integer\n");
    preg_match('/^[+-]?\\d+$/', $s) || die("not an integer\n");
    preg_match('/^-?\\d+\\.?\\d*$/', $s) || die("not a decimal\n");
    preg_match('/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/', $s) || die("not a decimal\n");
    preg_match('/^([+-]?)(?=\\d|\\.\\d)\\d*(\\.\\d*)?([Ee]([+-]?\\d+))?$/', $s) || die("not a C float\n");
    // ----------------------------
    function getnum($s)
    {
        sscanf($s, "%D", $number);
        return isset($number) ? $number : 0;
    }
    echo getnum(123) . "\n";
    // ok
    echo getnum(0xff) . "\n";
    // ..
    echo getnum(044) . "\n";
    // ..
    echo getnum('x') . "\n";
    // fail
}
Beispiel #2
0
 public static function display()
 {
     //关闭缓冲
     ob_end_clean();
     header("Content-type: image/png");
     //图片参数
     $width = getnum("width", 90);
     //图片宽
     $height = getnum("height", 30);
     //图片高
     $len = 4;
     //生成几位验证码
     $bgcolor = "#ffffff";
     //背景色
     $noise = true;
     //生成杂点
     $noisenum = 150;
     //杂点数量
     $border = false;
     //边框
     $bordercolor = "#CCCCCC";
     //边框颜色
     //////////////////////////////////////
     //创建图片
     $image = imagecreate($width, $height);
     $back = self::getcolor($image, $bgcolor);
     imagefilledrectangle($image, 0, 0, $width, $height, $back);
     $size = $width / $len;
     if ($size > $height) {
         $size = $height;
     }
     $left = ($width - $len * ($size + $size / 10)) / $size;
     //字体位置
     $self = VI_ROOT . 'source/fonts/';
     if (!ini_get("safe_mode")) {
         putenv('GDFONTPATH=' . $self);
     }
     //生成字符
     for ($i = 0; $i < $len; $i++) {
         //当前字符
         $text = rand(0, 9);
         //累加验证码
         $code .= $text;
         //创建颜色
         $color = imagecolorallocate($image, rand(0, 100), rand(0, 100), rand(0, 100));
         //字体路径
         $font = $self . rand(1, 4) . ".ttf";
         //随机大小
         $randsize = rand($size - $size / 10, $size + $size / 10);
         //文字起始位置
         $location = $left + ($i * $size + $size / 10);
         imagettftext($image, $randsize, rand(-18, 18), $location, rand($size - $size / 10, $size + $size / 10), $color, $font, $text);
     }
     //生成杂点
     if ($noise == true) {
         self::setnoise($image, $width, $height, $back, $noisenum);
     }
     $_SESSION['captcha'] = $code;
     //生成边框
     $bordercolor = self::getcolor($image, $bordercolor);
     if ($border == true) {
         imagerectangle($image, 0, 0, $width - 1, $height - 1, $bordercolor);
     }
     //输出图片
     imagepng($image);
     imagedestroy($image);
 }
Beispiel #3
0
                        unlink(VI_ROOT . $row['name']);
                    }
                }
            }
            //写入日志
            System::insert_event($func, time(), time(), "删除文件:" . $list);
            //System :: redirect($url,"所选文件成功被删除!");
            $_G['project']['message'] = $row_count . "个文件成功被删除!";
            break;
    }
}
$s = getgpc("s");
$q = getgpc('q');
$f = getgpc("f");
$r = getnum("r", -1);
$a = getnum("a", 0);
//查看方式
$v = getgpc("v");
$v = $v ? $v : "list";
//exit($v);
//日期筛选
$start = getgpc('start');
$end = getgpc('end');
?>
    <div id="search">

        <!--用于文件操作-->
        <form name="post-form" id="post-form" method="post" action="?">
        <input name="list" id="list" type="hidden" value="">
        <input name="action" id="action" type="hidden" value="" />
        <input name="url" id="url" type="hidden" value="" />
Beispiel #4
0
    $jump = "admin.list.php";
}
$people = getgpc("people");
if ($people == "me") {
    $id = $_G['manager']['id'];
} else {
    $id = getnum('id', 0);
}
if ($action) {
    $account = trim(getgpc('name'));
    $password = trim(getgpc('password'));
    $confirm = getgpc('confirm');
    $avatar = getgpc('avatar');
    $gid = getnum('gid', 0);
    $state = getnum("state", 1);
    $gender = getnum('gender', 0);
    $email = getgpc('email');
    $phone = getgpc('phone');
    $blog = getgpc('blog');
    $qq = getgpc('qq');
    $birthday = getgpc('birthday');
    $extra = $_POST['extra'];
    $extra = format_json(fix_json($extra));
}
//连接数据库
System::connect();
//动作处理
switch ($action) {
    case "add":
        //检查权限
        $func = 'system-admin-add';
Beispiel #5
0
            } else {
                $_G['project']['message'] = "未找到指定用户!";
            }
            $_G['project']['jump'] = '';
            //写入日志
            System::insert_event($func, time(), time(), "删除用户:" . $_CACHE['system']['admin'][$id]["name"]);
            break;
    }
    //缓存系统用户
    Cached::table('system', 'sys:admin', array('jsonde' => array('config', 'weibo')));
}
//search
$s = getgpc("s");
$q = getgpc('q');
$line = getgpc("line");
$gid = getnum('gid', 0);
//查看方式
$v = getgpc("v");
$v = $v ? $v : "list";
?>
    
    <div id="search">
        <form name="form1" method="get" action="?">
            <span class="action">
                <button type="button" class="button" onclick="location.href='admin.edit.php';">添加用户</button>
                <button type="button" class="cancel" onclick="location.href='<?php 
echo VI_BASE;
?>
serv.php?action=address';">数据下载</button>
                <button type="button" class="button" onclick="if(confirm('确定现在要更新缓存吗?')){location.href='?action=create';}">更新缓存</button>
            </span>
</div>
<!--     <div class="contain12">
      <ul class="clear_f">
      		<?php 
if (is_array($folder)) {
    $i = 0;
    $__LIST__ = $folder;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
            ++$i;
            ?>
<li class="document"><div class="doctu"><a href="javascript:void(0);"><?php 
            echo count(getnum($vo["fileId"]));
            ?>
</a></div>
      		<p><?php 
            echo $vo["name"];
            ?>
</p>
      		<input type="hidden" name="id" class="fid" value="<?php 
            echo $vo["id"];
            ?>
" />
      		<input type="hidden" name="type" class="type_f" value="<?php 
            echo $vo["type"];
            ?>
" /></li><?php 
        }
Beispiel #7
0
 } else {
     $nbihua3 = 0;
     $nbihua4 = 0;
     $n2ming1 = substr($name2, 2, 2);
     $n2ming12 = substr($name2, 2, 2);
     $nbihua3 = getnum($n2ming1);
     $ndige1 = $nbihua3 + 1;
     $ndigee1 = $nbihua3 + 1;
     $nrenge2 = $nbihua3;
     $nrengee2 = $nbihua3;
     $nwaige1 = $nwaige1 + 1;
     $nwaigee1 = $nwaigee1 + 1;
     if (substr($name2, 4, 2) != "") {
         $n2ming2 = substr($name2, 4, 2);
         $n2ming22 = substr($name2, 4, 2);
         $nbihua4 = getnum($n2ming2);
         $ndige1 = $nbihua3 + $nbihua4;
         $ndigee1 = $nbihua3 + $nbihua4;
     }
 }
 $nzhongge1 = $nbihua1 + $nbihua2 + $nbihua3 + $nbihua4;
 $nzhonggee1 = $nbihua1 + $nbihua2 + $nbihua3 + $nbihua4;
 $nrenge1 = $nrenge1 + $nrenge2;
 $nrengee1 = $nrengee1 + $nrengee2;
 $nwaige1 = $nzhongge1 - $nrenge1;
 $nwaigee1 = $nzhonggee1 - $nrengee1;
 if (isset($n2xing2) && $n2xing2 == "") {
     $nwaige1 = $nwaige1 + 1;
     $nwaigee1 = $nwaigee1 + 1;
 }
 if (isset($n2ming2) && $n2ming2 == "") {
Beispiel #8
0
" /> </p>
		    
		            <p> <button type="submit">下一步</button> </p>
	    
	            </form>
	
	            <?php 
    //}
    ?>
	        
	        <?php 
}
/////////////////////////////////
if ($step == 4) {
    $mysql_host = trim(getgpc("mysql_host"));
    $mysql_port = getnum("mysql_port", 0);
    $mysql_db = trim(getgpc("mysql_db"));
    $mysql_user = trim(getgpc("mysql_user"));
    $mysql_password = trim(getgpc("mysql_password"));
    $mysql_manpre = trim(getgpc("mysql_manpre"));
    $mysql_modpre = trim(getgpc("mysql_modpre"));
    $mysql_admin = trim(getgpc("mysql_admin"));
    $mysql_pass = trim(getgpc("mysql_pass"));
    if (VI_DBMANPRE) {
        $mysql_manpre = VI_DBMANPRE;
    }
    if (VI_DBMODPRE) {
        $mysql_modpre = VI_DBMODPRE;
    }
    if ($mysql_host) {
        $mysql = @mysql_connect($mysql_host . ':' . $mysql_port, $mysql_user, $mysql_password);
Beispiel #9
0
$Logbook = array();
foreach ($_CACHE['system']['module']['system']['permit'] as $item => $array) {
    foreach ($array as $key => $value) {
        $Logbook["sys-" . $key] = $value;
    }
}
$Logbook["login"] = "******";
$Logbook["exit"] = "退出系统";
//日期筛选
$start = getgpc('start');
$end = getgpc('end');
//search
$s = getgpc("s");
$q = getgpc('q');
$event = getgpc("event");
$account = getnum("account", 0);
//sql
$sql = "SELECT * FROM `sys:event` WHERE 1=1 ";
//权限检查
/*
    if( $s && $q && System :: check_func( 'system-event' ) == false){
    
        $sql.=" and  event = 'login' and aid=".$_G['manager']['id'];
		
        $_G['project']['message']="<b>提示:</b> 没有权限查看其他用户的日志!";
        
    }else{
*/
if ($s && $q) {
    $sql .= " and `" . $s . "` like '%" . $q . "%'";
}
Beispiel #10
0
<?php

/*
		程序修正脚本
*/
if (!defined('VI_BASE')) {
    exit('Access Denied');
}
///////////////////////////////////
//安装步骤
$step = getnum("step", 1);
//////////////////////////
$base = VI_ROOT . "data/fixbug/";
$list = loop_file($base, array(), array("php"));
$fixfile = '';
foreach ($list as $file) {
    if (!file_exists(str_replace(".php", ".lock", $base . $file))) {
        $fixfile = $base . $file;
        break;
    }
}
if ($fixfile) {
    ?>

<script type="text/javascript">
	
	//暂停运行,显示安装界面
	Serv.END = true;

</script>
Beispiel #11
0
    $str1 = substr($strname1, 0, 2);
    $str2 = substr($strname1, 2, 2);
    $str3 = substr($strname1, 4, 2);
    $str4 = substr($strname1, 6, 2);
    $bihua1 = getnum($str1);
    $bihua2 = getnum($str2);
    $bihua3 = getnum($str3);
    $bihua4 = getnum($str4);
    $bihuaname1 = $bihua1 + $bihua2 + $bihua3 + $bihua4;
    $strname2 = $_REQUEST['name2'];
    $sstr1 = substr($strname2, 0, 2);
    $sstr2 = substr($strname2, 2, 2);
    $sstr3 = substr($strname2, 4, 2);
    $sstr4 = substr($strname2, 6, 2);
    $sbihua1 = getnum($sstr1);
    $sbihua2 = getnum($sstr2);
    $sbihua3 = getnum($sstr3);
    $sbihua4 = getnum($sstr4);
    $bihuaname2 = $sbihua1 + $sbihua2 + $sbihua3 + $sbihua4;
    $bihuac = $bihuaname1 + $bihuaname2;
    $bihuac = $bihuac % 100;
    //'¼ÆËã
    $sql = "select * from qlpdbh where bihua like ?";
    $db->query($sql, array('%' . $bihuac . '%'));
    if ($rs = $db->fetchArray()) {
        $intro = $rs['intro'];
    }
    $smarty->assign('strname1', $strname1);
    $smarty->assign('strname2', $strname2);
    $smarty->assign('intro', $intro);
}
Beispiel #12
0
function getpage($key)
{
    $num = getnum($key, 1);
    $num = $num < 1 ? 1 : $num;
    return $num;
}
Beispiel #13
0
            $_G['project']['message'] = "批量修改成功!";
            break;
            //状态
        //状态
        case "create":
            $sql = "UPDATE `mod:common_category` SET appid = 'system-district' WHERE appid = 'shop-area'";
            System::$db->execute($sql);
            $_G['project']['message'] = "缓存更新成功!";
            break;
        case "add":
            //检查权限
            System::check_func('system-system-set', false);
            $name = getgpc('name');
            $sort = getnum("sort", 0);
            $parent = getnum("parent", 0);
            $parent = $parent ? getnum("category", 0) : $parent;
            $sql = "INSERT INTO `mod:common_category`(appid,name,parent,sort,state,dateline) VALUES('system-district','" . $name . "'," . $parent . "," . $sort . ",1," . time() . ")";
            System::$db->execute($sql);
            $_G['project']['message'] = "新增区域成功!";
            break;
    }
    //更新分类数组缓存
    Cached::multi('system', "SELECT id,name,parent,state FROM `mod:common_category` WHERE appid = 'system-district' ORDER BY sort ASC", 'table.district', array('alias' => 'district'));
    //更新分类脚本缓存
    Cached::script('system', "SELECT id,name,parent FROM `mod:common_category` WHERE appid = 'system-district' ORDER BY sort ASC", "DISTRICT", "mod.district", array('unicode' => array('name')));
}
Cached::loader('system', 'table.district');
?>

	<?php 
echo System::check_func('system-system-set', true);
Beispiel #14
0
     delete($con, $token, $bid, $tid, $pid, $ip);
 } else {
     if ($ask == "move") {
         move($con, $token, $bid, $tid, $to);
     } else {
         if ($ask == "lzl") {
             lzl($con, @$_REQUEST['method'], $fid, $token, $ip);
         } else {
             if ($ask == "getpages") {
                 getpages($con, $bid, $tid);
             } else {
                 if ($ask == "getlznum") {
                     getlznum($con, $bid, $tid);
                 } else {
                     if ($ask == "getnum") {
                         getnum($con);
                     } else {
                         if ($ask == "sign_today") {
                             sign_today($con);
                         } else {
                             if ($ask == "sign_year") {
                                 sign_year($con);
                             } else {
                                 if ($ask == "sign_user") {
                                     sign_user($con);
                                 } else {
                                     if ($view != "") {
                                         view_user($con, $view);
                                     } else {
                                         if ($bid != "") {
                                             $page = @$_REQUEST['p'];
Beispiel #15
0
     $x = getnum("x", 0);
     $y = getnum("y", 0);
     $fx = getnum("fx", 0);
     $fy = getnum("fy", 0);
     //更新数据
     $sql = "UPDATE `sys:widget` SET x = '" . $x . "',y = '" . $y . "',fx = '" . $fx . "',fy = '" . $fy . "' WHERE aid='" . $_G['manager']['id'] . "' AND appid = '" . $appid . "' AND widget='" . $widget . "'";
     System::$db->execute($sql);
     //返回数据
     echo $callback . '( "' . $appid . '", "' . $widget . '", true );';
     break;
     ////////////////////////////
     //前置插件
 ////////////////////////////
 //前置插件
 case "front":
     $z = getnum("z", 0);
     //更新数据
     $sql = "UPDATE `sys:widget` SET z = '" . $z . "' WHERE aid='" . $_G['manager']['id'] . "' AND appid = '" . $appid . "' AND widget='" . $widget . "'";
     System::$db->execute($sql);
     //返回数据
     echo $callback . '( "' . $appid . '", "' . $widget . '", true );';
     break;
     ////////////////////////////
     //读取插件
 ////////////////////////////
 //读取插件
 case "reader":
     //更新数据,按时间顺序加载
     $sql = "SELECT appid,widget,x,y,z,fx,fy from `sys:widget` WHERE aid='" . $_G['manager']['id'] . "' ORDER BY dateline ASC";
     $res = System::$db->getAll($sql);
     $str = '';
Beispiel #16
0
Datei: xm.php Projekt: cwcw/cms
    $tiangee = $bihua1 + $bihua2;
    $renge1 = $bihua2;
}
//'名;
$bihua3 = 0;
$bihua4 = 0;
$ming1 = substr($ming, 0, 2);
$ming11 = substr($ming, 0, 2);
$bihua3 = getnum($ming1);
$dige = $bihua3 + 1;
$digee = $bihua3 + 1;
$renge2 = $bihua3;
if (substr($ming, 2, 2) != "") {
    $ming2 = substr($ming, 2, 2);
    $ming22 = substr($ming, 2, 2);
    $bihua4 = getnum($ming2);
    $dige = $bihua3 + $bihua4;
    $digee = $bihua3 + $bihua4;
}
$zhongge = $bihua1 + $bihua2 + $bihua3 + $bihua4;
$zhonggee = $bihua1 + $bihua2 + $bihua3 + $bihua4;
//'计算三才;
$renge = $renge1 + $renge2;
$rengee = $renge1 + $renge2;
$waige = $zhongge - $renge;
$waigee = $zhonggee - $rengee;
if (substr($xing, 2, 2) == "") {
    $waige = $waige + 1;
    $waigee = $waigee + 1;
}
if (substr($ming, 2, 2) == '') {
Beispiel #17
0
Datei: zgss.php Projekt: cwcw/cms
 $str1 = substr($strname, 0, 2);
 $str2 = substr($strname, 2, 2);
 $str3 = substr($strname, 4, 2);
 $smarty->assign('str1', $str1);
 $smarty->assign('str2', $str2);
 $smarty->assign('str3', $str3);
 if ($str1 != "" and $str2 != "" and $str3 != "") {
     $bihua1 = getnum($str1) % 10;
     if ($bihua1 == 0) {
         $bihua1 = 1;
     }
     $bihua2 = getnum($str2) % 10;
     if ($bihua2 == 0) {
         $bihua2 = 1;
     }
     $bihua3 = getnum($str3) % 10;
     if ($bihua3 == 0) {
         $bihua3 = 1;
     }
     $bihua = $bihua1 . $bihua2 . $bihua3;
     while ($bihua >= 384) {
         $bihua = $bihua - 384;
     }
     if ($bihua <= 9) {
         $bihua = "00" . $bihua;
     } elseif ($bihua <= 99) {
         $bihua = "0" . $bihua;
     }
     //'¼ÆËãÖî¸ðÉñÊý
     $sql = "select * from zhuge where id=?";
     $db->query($sql, array($bihua));
Beispiel #18
0
*/
require '../../source/dialog/loader.php';
html_start("用户组管理 - VeryIDE");
?>


	<?php 
//loader
require 'include/naver.admin.php';
//菜单处理
$action = getgpc('action');
$jump = getgpc('jump');
//连接数据库
System::connect();
$id = getnum('id', 0);
$state = getnum('state', 0);
if ($action) {
    //动作处理
    switch ($action) {
        case "state":
            //检查权限
            $func = 'system-group-mod';
            System::check_func($func, FALSE);
            //更新数据
            $sql = "UPDATE `sys:group` SET `state`='" . $state . "' WHERE id=" . $id;
            System::$db->execute($sql);
            if (System::$db->getAffectedRows()) {
                $_G['project']['message'] = "成功更改用户组状态!";
                //写入日志
                System::insert_event($func, time(), time(), "更改用户组状态:" . $_CACHE['system']['group'][$id]["name"]);
            } else {
Beispiel #19
0
*	http://www.veryide.com/
*/
require '../../source/dialog/loader.php';
html_start("我的权限 - VeryIDE");
?>


	<?php 
//其他用户组
if (getnum("gid")) {
    $gid = getnum("gid");
} else {
    //loader
    require 'include/naver.admin.php';
    //当前用户组
    $gid = getnum("gid") ? getnum("gid", 0) : $_G['manager']["gid"];
}
//从缓存读取
$row = $_CACHE['system']['group'][$gid];
//配置
$config = $row['config'];
?>
    	
	<div id="box">
                        
        <table cellpadding="0" cellspacing="0" class="form">
        
            <tr><td colspan="2" class="section"><strong>基本信息</strong></td></tr>
            
            <tr>
                <th>分组名称:</th>