Ejemplo n.º 1
0
function checkimg($imgdir, $index = 0)
{
    $dir = opendir($imgdir);
    if ($dir == NULL) {
        return;
    }
    while ($file = readdir($dir)) {
        if ($file != "." and $file != "..") {
            //echo $imgdir."/".$file."<br>";
            $path = $imgdir . "/" . $file;
            if (is_dir($path)) {
                checkimg($path, $index + 1);
            } else {
                $filename = basename($path);
                $ifused = getresultNumrows(getresult("select * from I_article where contents like '%" . $filename . "%'"));
                if ($ifused <= 0) {
                    echo "删除:" . $path . "<br>";
                    unlink($path);
                }
            }
        }
    }
    closedir($dir);
    //呵呵,这个函数只能删除空文件夹,有文件的文件夹会失败
    if ($index != 0) {
        if (rmdir($imgdir)) {
            echo "删除" . $imgdir . "<br>";
        }
    }
}
Ejemplo n.º 2
0
function showColumnstructure($columnid, $classindex = 0)
{
    $query = "select childcolumn from I_column where id={$columnid}";
    $result = getresult($query);
    $count = getresultNumrows($result);
    if ($count > 0) {
        $childColumnId = getresultData($result, 0, "childcolumn");
        //没有子栏目即返回
        //echo $childColumnId."<br>";
        if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") {
            if ($classindex == 0) {
                echo "<tr style=\"height:24px;\">\n";
                echo "<td align='center' colspan='3'>" . gettext_r("haveNot") . gettext_r("column") . "</td>";
                echo "</tr>\n";
            }
            return false;
        }
        $childId = explode("|", $childColumnId);
        foreach ($childId as $id) {
            echo "<tr class='list'>\n";
            $getchildcolumnQuery = "select columnname,childcount from I_column where id={$id}";
            $childColumn = getresult($getchildcolumnQuery);
            $childColumnname = getresultData($childColumn, 0, "columnname");
            $childCount = getresultData($childColumn, 0, "childcount");
            echo "<td> " . $id . "</td>\n";
            echo "<td> " . space($classindex) . $childColumnname . "</td>\n";
            echo "<td align='center'>";
            echo " ";
            //如果为大栏目调整,不出现添子栏目菜单
            if ($columnid != 0) {
                echo "<a href=\"admin_column.php?action=add&columnid=" . $id . "\">" . gettext_r("add") . gettext_r("child") . gettext_r("column") . "</a>";
                echo " | ";
            }
            echo "<a href=\"javascript:jump('admin_column.php','modify'," . $id . ")\">" . gettext_r("update") . gettext_r("column") . gettext_r("attribute") . "</a>";
            echo " | ";
            if ($columnid != 0) {
                echo "<a href=\"admin_article.php?action=add&columnid=" . $id . "\">" . gettext_r("add") . gettext_r("article") . "</a>";
                echo " | ";
            }
            echo "<a href=\"javascript:if(confirm('" . gettext_r("deleteColumnTip") . "'))jump('admin_column.php','delete'," . $id . ")\">" . gettext_r("delete") . "</a>";
            //echo " | ";
            //如果有子栏目则显示管理子栏目
            /*					if($childCount > 0)
            						echo "<a href=\"admin_column.php?columnid=".$id."\">管理子栏目($childCount)</a>\n";
            					else
            						echo "<a href=\"#\">管理子栏目($childCount)</a>\n";*/
            echo "</tr>\n";
            //如果为大栏目调整,则不递归显示子栏目
            if ($columnid != 0) {
                showColumnstructure($id, $classindex + 1);
            }
        }
    } else {
        return false;
    }
}
Ejemplo n.º 3
0
function translatemylabel($mylabel)
{
    $result = getresult("select * from I_mylabel where labelname='{$mylabel}'");
    //echo "select * from I_mylabel where labelname='$mylabel'";
    if (getresultNumrows($result) < 1) {
        return $mylabel;
    } else {
        return getresultData($result, 0, "labelcontent");
    }
}
Ejemplo n.º 4
0
function showpowerlist($adminid = 0)
{
    if ($adminid != 0) {
        $tempresult = getresult("select * from I_admin where id={$adminid}");
        $functioncode = getresultData($tempresult, 0, "functioncode");
        $functionarray = translatefunctioncode($functioncode);
        $result = getresult("select * from I_column where parentid=0");
        while ($row = getresultArray($result)) {
            if ($functionarray[$row["id"]] === "1") {
                echo "<tr>\n";
                echo "<td><input checked=\"true\" type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input checked=\"checked\" type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            } elseif ($functionarray[$row["id"]] === "2") {
                echo "<tr>\n";
                echo "<td><input checked=\"true\" type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input checked=\"checked\" type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            } else {
                echo "<tr>\n";
                echo "<td><input type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            }
        }
        if ($functionarray["vote"] === "1") {
            echo " <tr>";
            echo " <td colspan=\"2\"><input type=\"checkbox\" checked=\"true\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
            echo "  </tr>";
        } else {
            echo " <tr>";
            echo " <td colspan=\"2\"><input type=\"checkbox\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
            echo "  </tr>";
        }
        return;
    }
    $result = getresult("select * from I_column where parentid=0");
    while ($row = getresultArray($result)) {
        echo "<tr>\n";
        echo "<td><input type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnnamezh"] . "</td>";
        echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
        echo "</tr>";
        echo "<tr class='segmentline'><td colspan='2'></td></tr>";
    }
    echo " <tr>";
    echo " <td colspan=\"2\"><input type=\"checkbox\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
    echo "  </tr>";
}
Ejemplo n.º 5
0
	public function getSource()
	{	
		$timestamp = time();
		// $oldTime = $timestamp - 300;
		$oldTime = $timestamp;
		$date = date('Y-m-d H:i:s',$oldTime);
		$oldDate = date('Y-m-d H:i:s',$timestamp);
		$workTime = $this->judgeTime(time());
		if ($workTime) {
			// SELECT * FROM `messages` inner join device on messages.device_id = device.id where 1;
			$sql = 'select messages.id,messages.pic,messages.state from messages inner join device on messages.device_id = device.id where device.ver = 3 and messages.update_time < \''.$date.'\' and messages.state = 382';
		}
		else{
			$sql = 'select messages.id,messages.pic,messages.state from messages inner join device on messages.device_id = device.id where device.ver = 3 and messages.update_time < \''.$oldDate.'\' and messages.state = 382';
		}
		
		// var_dump($sql);
		$res = $this->connection->query($sql);		
		// var_dump($res);
		// var_dump($res->num_rows);
		if ($res->num_rows > 0) {
			// echo "\n rows:".$res->num_rows;
			while ($row = $res->fetch_assoc()) {
				$duringTime = time() - $this->startTime;
				if ($duringTime > 60) {
					return;
					}
				$id = $row['id'];
				$state = $this->getState($id);
				if ($state != 382) {
					continue;
				}
				$this->connection->query("update messages set state = 9 where id =$id");
				$img_url = $this->baseUrl.'/'.$row['pic'];
				// 注释
				$translateRes = getresult($img_url);
				// echo "\n"."messages come: ".mb_detect_encoding($translateRes);
				// echo '对的';
				if ($translateRes != 'error') {
					$this->connection->query("set names utf8");
					// echo "update messages set reply = '$translateRes',state = 41 where id = $id";
					$this->connection->query("update messages set reply = '$translateRes',state = 41 where id = $id");

				}
				else{
					$this->connection->query("update messages set state = 42 where id = $id");
				}
			}
		}
		// print_r($res);
	}
Ejemplo n.º 6
0
function showfield($columnid)
{
    $result = getresult("select * from I_field where columnid={$columnid}");
    if (getresultnumrows($result) < 1) {
        echo "<tr>";
        echo "<td colspan='6' height='25' align='center'>" . gettext_r("haveNot") . gettext_r("field") . "</td>";
        echo "<tr>";
        return;
    }
    while ($row = getresultarray($result)) {
        echo "<tr class='list'>";
        echo "<td align='center'>" . $row["id"] . "</td>\n";
        echo "<td align='center'>" . $row["fieldname"] . "</td>";
        echo "<td align='center'>" . $row["info"] . "</td>";
        echo "<td align='center' width='100'>";
        echo "<a href=\"admin_field.php?action=modify&fieldid=" . $row["id"] . "&columnid={$columnid}\">" . gettext_r("update") . "</a>";
        echo " | ";
        echo "<a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_field.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>\n";
        echo "</tr>";
    }
}
Ejemplo n.º 7
0
function showtemplatelist($type)
{
    $tempresult = getresult("select count(*) as countoftemplate from I_template where templatetype={$type}");
    $countoftemplate = getresultData($tempresult, 0, "countoftemplate");
    if ($countoftemplate < 1) {
        echo "<tr class='list'>\n";
        echo "<td colspan='4' align='center'>" . gettext_r("haveNot") . gettext_r("template") . "</td>\n";
        echo "</tr>";
        return;
    }
    $query = "select * from I_template where templatetype={$type}";
    $result = getresult($query);
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td> " . $row["id"] . "</td>";
        echo "<td> " . $row["templatename"] . "</td>";
        echo "<td> " . $row["path"] . "</td>";
        echo "<td align='center'>";
        echo "<a href=\"admin_template.php?type={$type}&action=modify&id=" . $row["id"] . "\">" . gettext_r("update") . "</a> | <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_template.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>";
        echo "</tr>\n";
    }
}
Ejemplo n.º 8
0
function translatecolumnlist($template)
{
    //匹配自定义文章列表标签正则
    $flag = "/【columnlist】([\\s\\S]*?)【\\/columnlist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template."<br>".$flag;
    //得到需要循环的部分
    $str = $matches[0][1];
    //echo $str ;
    //得到子栏目id数组
    $columnid = $_GET["columnid"];
    $query = "select childcolumn,columnname from I_column where id={$columnid}";
    $result = getresult($query);
    if (getresultNumrows($result) < 1) {
        //没有才此栏目
        return str_replace($str, "No such column!", $html);
        return;
    }
    $columnname = getresultData($result, 0, "columnname");
    $childColumnId = getresultData($result, 0, "childcolumn");
    if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") {
        //没有子栏目
        return str_replace($str, "No child column!", $html);
        return;
    }
    $temphtml = "";
    $childId = explode("|", $childColumnId);
    foreach ($childId as $id) {
        $tempstr = str_replace("【#columnid】", "{$id}", $str);
        $tempstr = str_replace("【#columnname】", getcolumnformationBycolumnid($id, "columnname"), $tempstr);
        $temphtml .= $tempstr;
    }
    $html = str_replace($matches[0][0], $temphtml, $html);
    return $html;
}
Ejemplo n.º 9
0
                    }
                } else {
                    if ($_POST[$row["id"]] != 0) {
                        $functioncode .= "," . $row["id"] . "|" . $_POST[$row["id"]];
                    }
                }
            }
            if ($_POST["voteadmin"] == 1) {
                if ($functioncode == "") {
                    $functioncode = "vote|1";
                } else {
                    $functioncode .= ",vote|1";
                }
            }
            $query = "update I_admin set adminname='{$adminname}',password='******',adminrole=1,functioncode='{$functioncode}' where id={$adminid}";
            getresult($query);
            echo "<script type=\"text/javascript\">alert('" . gettext_r("update") . gettext_r("success") . "');window.location='admin_admin.php';</script>";
            die;
            //echo $functioncode;
        }
        ?>
<form id="form1" name="form1" method="post" action="" onsubmit="return admin_form_check()">
<table class="admininfo" cellspacing="0" cellpadding="3" border="1" bordercolor="#FFFFFF" style="border-collapse:collapse">
  <tr>
    <td class="label" width="80" align="right"><?php 
        echo gettext_r("manager") . gettext_r("name");
        ?>
:</td>
    <td><input id="adminname" type="text" value="<?php 
        echo $adminname;
        ?>
Ejemplo n.º 10
0
 function showLogpage($currentpage, $pagesize = 10, $logtype = 0)
 {
     $tempresult = getresult("select count(*) as countoflog from I_log where logtype={$logtype}");
     $countoflog = getresultData($tempresult, 0, "countoflog");
     if ($countoflog % $pagesize == 0) {
         $allpage = $countoflog / $pagesize;
     } else {
         $allpage = floor($countoflog / $pagesize) + 1;
     }
     //消除文章数为零时显示下一页链接的bug
     if ($countoflog == 0) {
         $allpage += 1;
     }
     //echo $countofcomment%$pagesize." ".$currentpage;
     echo gettext_r("total") . "<b> " . $allpage . " </b>" . gettext_r("page") . "(" . $pagesize . " " . gettext_r("piece") . gettext_r("article") . gettext_r("per") . gettext_r("page") . ") ";
     if ($currentpage == 1) {
         echo gettext_r("firstPage") . " | " . gettext_r("prePage") . " | ";
     } else {
         echo "<a href='admin_log.php?logtype={$logtype}&currentpage=1'>" . gettext_r("firstPage") . "</a> | <a href='admin_log.php?logtype={$logtype}&currentpage=" . ($currentpage - 1) . "'>" . gettext_r("prePage") . "</a> | ";
     }
     $temppage = 1;
     if ($currentpage - 1 < 5) {
         while ($temppage <= $currentpage) {
             if ($currentpage == $temppage) {
                 echo "<b>" . $temppage . "</b> ";
                 $temppage++;
                 continue;
             }
             echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
             $temppage++;
         }
     } else {
         while ($temppage <= $currentpage) {
             if ($currentpage == $temppage) {
                 echo "<b>" . $temppage . "</b> ";
                 $temppage++;
                 continue;
             }
             if ($temppage == 1) {
                 echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> … ";
                 $temppage++;
                 continue;
             }
             if ($currentpage - $temppage > 3) {
                 $temppage++;
                 continue;
             }
             echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
             $temppage++;
         }
     }
     if ($allpage - $currentpage < 5) {
         while ($temppage <= $allpage) {
             if ($temppage == 1) {
                 echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
                 $temppage++;
                 continue;
             }
             echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
             $temppage++;
         }
     } else {
         while ($temppage <= $allpage) {
             if ($temppage == $allpage) {
                 echo " … <a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
                 $temppage++;
                 continue;
             }
             if ($temppage - $currentpage > 3) {
                 $temppage++;
                 continue;
             }
             echo "<a href='admin_log.php?logtype={$logtype}&currentpage={$temppage}'>" . $temppage . "</a> ";
             $temppage++;
         }
     }
     if ($currentpage == $allpage) {
         echo "| " . gettext_r("nextPage") . " | " . gettext_r("lastPage");
     } else {
         echo "| <a href='admin_log.php?logtype={$logtype}&currentpage=" . ($currentpage + 1) . "'>" . gettext_r("nextPage") . "</a> | <a href='admin_log.php?logtype={$logtype}&currentpage={$allpage}'>" . gettext_r("lastPage") . "</a>";
     }
 }
Ejemplo n.º 11
0
session_start();
include_once "conn.php";
$username = $_GET["username"];
$password = md5($_GET["password"]);
if ($username == NULL || $username == "" || $password == NULL || $password == "") {
    if ($_COOKIE["username"] == NULL || $_COOKIE["username"] == "") {
        die("notlogin");
    }
}
try {
    $query = "select * from I_user where username = '******' and password = '******'";
    //echo $query;
    $result = getresult($query);
    if (getresultNumrows($result) < 1) {
        throw new Exception("登录失败!");
    } else {
        if (getresultData($result, 0, "iflock") === "1") {
            die("locked");
        }
        setcookie("username", getresultData($result, 0, "username"));
        setcookie("userid", getresultData($result, 0, "id"));
        $_SESSION["username"] = getresultData($result, 0, "username");
        $_SESSION["userid"] = getresultData($result, 0, "id");
        getresult("update I_user set logintimes=logintimes+1 where id=" . getresultData($result, 0, "id"));
        //echo "update I_admin set logintimes=logintimes+1,lastip=".$_SERVER["REMOTE_ADDR"].",lasttime=CURRENT_TIMESTAMP where id=$id";
        //echo getlogininfo("adminname");
        echo "logined";
    }
} catch (Exception $e) {
    //die ( "notlogin" );
}
Ejemplo n.º 12
0
include "../library/admin.comment.php";
$functionarray = translatefunctioncode($_SESSION["functioncode"]);
$columnid = $_GET["columnid"];
$action = $_GET["action"];
$preurl = $_GET["url"];
$currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
switch ($action) {
    case "delete":
        if (!getresult("delete from I_comment where id=" . $_GET["commentid"])) {
            echo "<script type=\"text/javascript\">alert('" . gettext_r("delete") . gettext_r("fail") . "');window.location=\"{$preurl}\";</script>";
        } else {
            echo "<script type=\"text/javascript\">alert('" . gettext_r("delete") . gettext_r("success") . "');window.location=\"{$preurl}\";</script>";
        }
        break;
    case "pass":
        getresult("update I_comment set ifpass="******"ifpass"] . " where id=" . $_GET["commentid"]);
        break;
    default:
        echo "<div id='navigation'>" . gettext_r("quickLink") . ":";
        showchildcolumncomment($columnid);
        //echo "<a href=\"admin_comment.php?columnid=".$columnid."\">添加文章</a>\n";
        echo "";
        echo "</div>";
        echo "<table width='100%' border='0' cellpadding='0' cellspacing='1' class='function'>\n";
        echo "<tr class='header'>\n";
        echo "<td align='center' width='40'>" . gettext_r("checkIn") . "</td>\n";
        echo "<td align='center' width='50'>" . gettext_r("serialNumber") . "</td>\n";
        echo "<td align='center' width='140'>" . gettext_r("article") . "</td>\n";
        echo "<td align='center' width='600'>" . gettext_r("contents") . "</td>\n";
        echo "<td align='center' width='100'>" . gettext_r("author") . "</td>\n";
        echo "<td align='center' width='100'>" . gettext_r("ifPass") . "</td>\n";
Ejemplo n.º 13
0
        if ($_POST["votetype"] == 0) {
            if ($_POST["option"] != NULL && $_POST["option"] != "") {
                getresult("update I_vote set count" . $_POST["option"] . "=count" . $_POST["option"] . "+1 where id={$voteid}");
            }
        } else {
            if ($_POST["option"] != NULL && $_POST["option"] != "") {
                $option = $_POST["option"];
                //echo count($option);
                for ($i = 0; $i < count($option); $i++) {
                    getresult("update I_vote set count" . $option[$i] . "=count" . $option[$i] . "+1 where id={$voteid}");
                }
            }
        }
    }
    //添加投票记录
    if (!getresult("insert into I_iprecord(ip,action,actionid,user) values('" . $userip . "','vote'," . $voteid . ",'" . $_SESSION["username"] . "')")) {
        //echo "insert into I_iprecord(ip,action,actionid,user) values('".$userip."','vote',".$voteid.",'".$_SESSION["userid"]."')";
    }
}
$countOfOption = getresultData($result, 0, "attrcount") + 1;
$countOfAll = 0;
for ($i = 1; $i < $countOfOption; $i++) {
    $countOfAll += getresultData($result, 0, "count" . $i);
}
echo "<tr><td height='46px' style='background:url(images/vote_fg2.png) repeat-y' valign='top' id='vote_title'>" . gettext_r("title") . ":" . getresultData($result, 0, "title") . "</td></tr>";
echo "<tr>";
echo "<td height='19px' style='background:url(images/vote_fg3.png) no-repeat'></td>";
echo "</tr>";
echo "<tr>";
echo "<td style='background:url(images/vote_fg4.png) repeat-y'>";
echo "<table width='820px' border='0' cellspacing='0' cellpadding='0' style='margin-left:70px'>";
Ejemplo n.º 14
0
</head>
<body style="padding:20px;" bgcolor="#f3f9ff">
<?php 
if ($_POST["submit"] == "提交") {
    include '../conn.php';
    include '../library/basefunction.php';
    $adminid = getlogininfo("adminid");
    $result = getresult("select * from I_admin where id = {$adminid}");
    if (md5($_POST["oldpassword"]) != getresultData($result, 0, "password")) {
        die("<script type='text/javascript'>alert('旧密码错误');history.back(-1);</script>");
    }
    if ($_POST["newpwd"] != $_POST["newpwd1"]) {
        die("<script type='text/javascript'>alert('两次密码输入不一致');history.back(-1);</script>");
    }
    if (getresult("update I_admin set password='******' where id={$adminid}")) {
        die("<script type='text/javascript'>alert('密码修改成功\\n请重新登录');parent.location='logout.php';</script>");
    }
}
?>
<div>
<form action="" method="post" onSubmit="return chpasswordcheck();">
  <table cellspacing="0" cellpadding="3" border="1" bordercolor="#FFFFFF" style="border-collapse:collapse">
    <tr>
      <td class="label" width="100px">密码:</td>
      <td><input type="password" name="oldpassword"></td>
      <td valign="center" style="font-size:12px; color:#0000CC; padding-left:10px;">* 请输入您现在正在使用的密码 </td>
    </tr>
    <tr>
      <td class="label">新密码:</td>
      <td><input type="password" name="newpwd"></td>
Ejemplo n.º 15
0
include_once 'templatefunction/Iron.article.php';
include_once 'templatefunction/Iron.column.php';
include_once 'templatefunction/Iron.label.php';
loadlibrary("library/third/FirePHPCore/fb.php");
FB::log('Log message');
FB::info('Info message');
FB::warn('Warn message');
FB::error('Error message');
readcache();
$siteconfig = getresult("SELECT * FROM I_siteconfig LIMIT 0 , 1");
//如果没有网站配置项
if (getresultNumrows($siteconfig) < 1) {
    die("<script type='text/javascript'>window.location='error.html'</script>");
}
$templateid = getresultData($siteconfig, 0, "indextemplate");
$templateinfo = getresult("select * from I_template where id={$templateid} limit 0,1");
if (getresultNumrows($templateinfo) < 1) {
    die("<script type='text/javascript'>window.location='error.html'</script>");
}
$templatepath = getresultData($templateinfo, 0, "path");
$templatefile = getroot() . "/templates/" . $templatepath;
//echo $templatefile;
if (!file_exists($templatefile)) {
    die("The template file doesn'n exit!");
}
$template = file_get_contents($templatefile);
//如果模板被删除
if (!$template) {
    die("<script type='text/javascript'>alert('The template doesn't exists!')window.location='error.html'</script>");
}
$template = translatelabel($template);
Ejemplo n.º 16
0
function showpage($currentpage, $pagesize = 10)
{
    $tempresult = getresult("select count(*) as countofuser from I_user");
    $countofuser = getresultData($tempresult, 0, "countofuser");
    if ($countofuser % $pagesize == 0) {
        $allpage = $countofuser / $pagesize;
    } else {
        $allpage = floor($countofuser / $pagesize) + 1;
    }
    //消除文章数为零时显示下一页链接的bug
    if ($countofuser == 0) {
        $allpage += 1;
    }
    echo gettext_r("total") . "<b> " . $allpage . " </b>" . gettext_r("page") . "(" . $pagesize . " " . gettext_r("piece") . gettext_r("user") . gettext_r("per") . gettext_r("page") . ") ";
    if ($currentpage == 1) {
        echo gettext_r("firstPage") . " | " . gettext_r("prePage") . " | ";
    } else {
        echo "<a href='admin_user.php?columnid={$columnid}&currentpage=1'>" . gettext_r("firstPage") . "</a> | <a href='admin_user.php?columnid={$columnid}&currentpage=" . ($currentpage - 1) . "'>" . gettext_r("prePage") . "</a> | ";
    }
    $temppage = 1;
    if ($currentpage - 1 < 5) {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            if ($temppage == 1) {
                echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> … ";
                $temppage++;
                continue;
            }
            if ($currentpage - $temppage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($allpage - $currentpage < 5) {
        while ($temppage <= $allpage) {
            if ($temppage == 1) {
                echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $allpage) {
            if ($temppage == $allpage) {
                echo " … <a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            if ($temppage - $currentpage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='admin_user.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($currentpage == $allpage) {
        echo "| " . gettext_r("nextPage") . " | " . gettext_r("lastPage");
    } else {
        echo "| <a href='admin_user.php?columnid={$columnid}&currentpage=" . ($currentpage + 1) . "'>" . gettext_r("nextPage") . "</a> | <a href='admin_user.php?columnid={$columnid}&currentpage={$allpage}'>" . gettext_r("lastPage") . "</a>";
    }
}
Ejemplo n.º 17
0
 default:
     echo "<div id='navigation'>" . gettext_r("quickLink") . ":";
     echo "<a href=\"admin_vote.php?action=add\">" . gettext_r("add") . gettext_r("vote") . "</a>\n";
     echo "</div>";
     echo "<table width='100%' border='0' cellpadding='0' cellspacing='1' class='function'>\n";
     echo "<tr class='header'>\n";
     echo "<td align='center' width='40'>" . gettext_r("checkIn") . "</td>\n";
     echo "<td align='center' width='40'>" . gettext_r("serialNumber") . "</td>\n";
     echo "<td align='center'>" . gettext_r("title") . "</td>\n";
     echo "<td align='center' width='300'>" . gettext_r("operate") . "</td>\n";
     echo "</tr>\n";
     $adminid = getlogininfo("adminid");
     if (getlogininfo("adminrole") === "0") {
         $result = getresult("select * from I_vote");
     } else {
         $result = getresult("select * from I_vote where adminid={$adminid}");
     }
     if (getresultNumrows($result) < 1) {
         echo "<tr class='list'>\n";
         echo "<td colspan='4' align='center'>" . gettext_r("haveNot") . gettext_r("vote") . "</td>";
         echo "</tr>";
     }
     while ($row = getresultArray($result)) {
         echo "<tr class='list'>\n";
         echo "<td align='center'><input type='checkbox' name='list' value='" . $row["id"] . "' /></td>";
         echo "<td> " . $row["id"] . "</td>";
         echo "<td> " . $row["title"] . "</td>";
         echo "<td align='center'>";
         echo "<a href='admin_vote.php?action=details&voteid=" . $row["id"] . "'>" . gettext_r("see") . gettext_r("result") . "</a> | <a href='admin_vote.php?action=modify&voteid=" . $row["id"] . "'>" . gettext_r("update") . "</a> | <a href='#' onclick=\"getvotecode(" . $row["id"] . ")\">" . gettext_r("getInvokeCode") . "</a>";
         echo "</td>";
         echo "</tr>";
Ejemplo n.º 18
0
function getarticleidlist($columnid)
{
    global $childcolumnString;
    getchildcolumnid_improveed($columnid);
    if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") {
        $query = "select id from I_article where columnid in ({$childcolumnString})";
    } else {
        $query = "select id from I_article where columnid in ({$childcolumnString}) and adminid=" . getlogininfo("adminid");
    }
    $result = getresult($query);
    if (getresultNumrows($result) < 1) {
        return "-1";
    } else {
        $articleidlist = "";
        while ($row = getresultArray($result)) {
            if ($articleidlist == "") {
                $articleidlist = $row["id"];
            }
            $articleidlist .= "," . $row["id"];
        }
        return $articleidlist;
    }
}
Ejemplo n.º 19
0
<?php

session_start();
include_once 'conn.php';
include_once 'library/basefunction.php';
include_once 'lang/envinit.php';
include_once 'templatefunction/Iron.article.php';
include_once 'templatefunction/Iron.column.php';
include_once 'templatefunction/Iron.label.php';
include_once 'templatefunction/Iron.search.php';
$columnid = $_GET["columnid"];
$templatefile = getroot() . "/templates/searchresult.html";
if ($columnid != NULL && $columnid != '') {
    $templateid = getcolumnformationBycolumnid($columnid, "searchtemplate");
    $templatepath = getresultData(getresult("select * from I_template where id={$templateid}"), 0, "path");
    $templatefile = getroot() . "/templates/" . $templatepath;
}
//echo $templatefile;
if (!file_exists($templatefile)) {
    die("The template file doesn'n exit!");
}
$template = file_get_contents($templatefile);
//如果模板被删除
if (!$template) {
    die("<script type='text/javascript'>alert('The template doesn't exists!')window.location='error.html'</script>");
}
$template = translatelabel($template);
$template = translateSearchlist($template);
$template = translateArticlelist($template);
$template = translateCommonlabel($template);
echo $template;
Ejemplo n.º 20
0
<?php

$initialValue = 20151125;
$row = 2947;
$column = 3029;
function getNumberOfIteration($row, $col)
{
    $rangeRow = range(0, $row - 1);
    $result = array_sum($rangeRow) + 1;
    if ($col > 1) {
        $rangeCol = range($row + 1, $col + $row - 1);
        $result += array_sum($rangeCol);
    }
    return $result;
}
function getresult($nbIteration, $initialValue)
{
    $result = $initialValue;
    for ($i = 1; $i < $nbIteration; $i++) {
        $result = $result * 252533 % 33554393;
    }
    return $result;
}
$nbIteration = getNumberOfIteration($row, $column);
$result = getresult($nbIteration, $initialValue);
print 'Part 1: ' . $result;
print PHP_EOL;
Ejemplo n.º 21
0
function getchildcolumnid($columnid, &$childidstring, $index = 0)
{
    if ($index == 0) {
        $childidstring = $columnid;
    }
    $query = "select childcolumn from I_column where id={$columnid}";
    $result = getresult($query);
    $count = getresultNumrows($result);
    if ($count > 0) {
        $childColumnId = getresultData($result, 0, "childcolumn");
        //没有子栏目即返回
        //echo $childColumnId."<br>";
        if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") {
            return false;
        }
        $childId = explode("|", $childColumnId);
        foreach ($childId as $id) {
            $childidstring .= "," . $id;
            //echo $childidstring;
            getchildcolumnid($id, $childidstring, $index + 1);
        }
    } else {
        return false;
    }
}
Ejemplo n.º 22
0
 }
 echo "  </select></td></tr>\n";
 echo "\t<tr><td class='label'>" . gettext_r("article") . gettext_r("template") . ":</td><td class='attributeinput'><select name=\"articletemplate\">\n";
 //文章模板列表
 $articletemplatelist = getresult("select id,templatename from I_template where templatetype=2");
 while (list($id, $templatename) = getresultRow($articletemplatelist)) {
     if ($id == $articletemplateid) {
         echo "<option selected=\"selected\" value='{$id}'>{$templatename}</option>\n";
     } else {
         echo "<option value='{$id}'>{$templatename}</option>\n";
     }
 }
 echo "  </select></td></tr>\n";
 echo "\t<tr><td class='label'>" . gettext_r("search") . gettext_r("template") . ":</td><td class='attributeinput'><select name=\"searchtemplate\">\n";
 //搜索模板列表
 $articletemplatelist = getresult("select id,templatename from I_template where templatetype=4");
 while (list($id, $templatename) = getresultRow($articletemplatelist)) {
     if ($id == $articletemplateid) {
         echo "<option selected=\"selected\" value='{$id}'>{$templatename}</option>\n";
     } else {
         echo "<option value='{$id}'>{$templatename}</option>\n";
     }
 }
 echo "  </select></td></tr>\n";
 echo "\t<tr><td class='label'>" . gettext_r("ifLock") . ":</td><td>";
 if ($isopen == 0) {
     echo gettext_r("yes") . "<input type=\"radio\" value=\"0\" name=\"isopen\" checked=\"checked\" />" . gettext_r("no") . "<input type=\"radio\" value=\"1\" name=\"isopen\" />";
 } else {
     echo gettext_r("yes") . "<input type=\"radio\" value=\"0\" name=\"isopen\" />" . gettext_r("no") . "<input type=\"radio\" value=\"1\" name=\"isopen\"  checked=\"checked\" />";
 }
 echo "</td></tr>\n";
Ejemplo n.º 23
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>article</title>
<link type="text/css" rel="stylesheet" href="css/article.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/front.js"></script>
</head>
<body>
<?php 
include "conn.php";
include 'frontshowfunction/frontbasefunction.php';
$articleid = $_GET["id"];
?>
<div id="article">
<?php 
getresult("update I_article set hits=hits+1 where id = {$articleid}");
showarticle($articleid);
?>
</div>
</body>
</html>
     echo "Find CProgrammingLanguage-BHH-ZJU/{$vvv->id}/{$vvv->id}_not_finished.c, and it will be renamed automatically.\n";
     waitforret();
     rename("CProgrammingLanguage-BHH-ZJU/{$vvv->id}/{$vvv->id}_not_finished.c", "CProgrammingLanguage-BHH-ZJU/{$vvv->id}/{$vvv->id}.c");
     goto ready_for_upload;
 } else {
     echo "Uploading CProgrammingLanguage-BHH-ZJU/{$vvv->id}/{$vvv->id}.c, please wait...\n";
     if (FALSE == uploadsrc($vvv->id, "CProgrammingLanguage-BHH-ZJU/{$vvv->id}/{$vvv->id}.c")) {
         echo "Error: cannot upload. \n";
         echo "fatal error.\n";
         echo "If this problem persists, please contact me.\n";
         exit(4);
     } else {
         $timer = 10;
         while ($timer) {
             $timer--;
             $problem_result = getresult();
             echo "Code: {$problem_result}\n";
             if ($problem_result == '运行完毕') {
                 break;
             }
             sleep(1);
         }
         if ($problem_result != '运行完毕') {
             echo "Your source code is incorrect? \n";
             echo "Try to correct it, and then press Enter/Return to retry.\n";
             waitforret();
             goto ready_for_upload;
         }
         if ($src_flag) {
             echo "It seems that my repo does not have your code.\n";
             echo "Would you like to share (pull request) this to me?\n";
Ejemplo n.º 25
0
        </td>
        <td align="center">
        第七章
        </td>
        <td align="center">
        第八章
        </td>
        <td align="center">
        第九章
        </td>
        </tr>

<?php 
    $query = "SELECT * FROM score ORDER BY usr_stuno";
    $ret = mysql_query($query, $link);
    while ($row = getresult($ret)) {
        ?>
    <tr>
    <td align="center">
    <?php 
        echo $row['usr_stuno'];
        ?>
    </td>
    <td align="center">
    <?php 
        echo $row['usr_name'];
        ?>
    </td>
    <td align="center"> 
    <?php 
        echo $row['score_2_1'] + $row['score_2_2'];
Ejemplo n.º 26
0
<?php

include_once "../conn.php";
$commentid = $_GET["commentid"];
getresult("update I_comment set against=against+1 where id={$commentid}");
Ejemplo n.º 27
0
    $password = md5(trim($_POST["password"]));
    $realname = $_POST["realname "];
    $email = $_POST["email"];
    $sex = $_POST["sex"];
    $qq = $_POST["qq"];
    $phone = $_POST["phone"];
    $address = $_POST["address"];
    if (strlen($username) < 4 || strlen($password) < 6) {
        die("<script type='text/javascript'>alert('Sorry ,You have not registed!');history.back(-1);</script>");
    }
    if (getresultNumrows(getresult("select * from I_user where username='******'")) > 0) {
        die("<script type='text/javascript'>alert('Sorry ,The username have existed!');history.back(-1);</script>");
    }
    $query = "insert into I_user(username,password,realname,email,sex,qq,tel,address) values('{$username}','{$password}','{$realname}','{$email}',{$sex},'{$qq}','{$phone}','{$address}')";
    //echo $query;
    if (!getresult($query)) {
        die("<script type='text/javascript'>alert('Sorry ,You have not registed!');history.back(-1);</script>");
    } else {
        die("<script type='text/javascript'>alert('Congratulations,You have registe successfully!');window.location='{$preurl}'</script>");
    }
}
?>
<div align="center">
  <div style="font-family:'微软雅黑','宋体'; font-size:24px; font-weight:bold; text-align:left; width:760px">用户注册</div>
  <div style="width:760px; border:solid #e1e1e1 5px;">
  <form name="form" method="post" action="" onsubmit="return check();">
  <input type="hidden" name="action" value="login" />
        <table width="100%" border="0" cellspacing="8" cellpadding="0">
          <tr>
            <td colspan="3" id="table1">请注意:带有<span style="color:#FF0000"> * </span>的项目必须填写</td>
          </tr>
Ejemplo n.º 28
0
        echo gettext_r("cancle");
        ?>
" /></td>
  </tr>
</table>
</form>
<?php 
        break;
    case "modify":
        $label = getresult("select * from I_mylabel where id ={$id}");
        if ($_POST["submit"] == gettext_r("submit")) {
            //修改自定义标签
            $id = $_GET["id"];
            $labelcontent = $_POST["labelcontent"];
            //echo "update I_mylabel set labelcontent='$labelcontent' where id=$id";
            if (getresult("update I_mylabel set labelcontent='" . mysql_escape_string($labelcontent) . "' where id={$id}")) {
                die("<script type=\"text/javascript\">alert('" . gettext_r("update") . gettext_r("success") . "');window.location='admin_mylabel.php'</script>");
            } else {
                //echo "update I_mylabel set labelcontent='$labelcontent' where id=$id";
                die("<script type=\"text/javascript\">alert('" . gettext_r("update") . gettext_r("fail") . "');history.back(-1);</script>");
            }
        }
        ?>
<form action="" method="post">
<table width="100%">
  <tr>
	<td class='label' width="150px"><?php 
        echo gettext_r("selfDefineTip");
        ?>
:</td>
    <td><input type="text" name="labelname" disabled="disabled" value="<?php 
Ejemplo n.º 29
0
        </td>
        <td align="center">
        第九章
        </td>
        </tr>
        <tr>
        <td align="center">
        <?php 
echo $_SESSION['user'];
?>
        </td>
        <td align="center">
        <?php 
$query = "SELECT * FROM score WHERE usr_name='" . $_SESSION['user'] . "'";
$ret = mysql_query($query, $link);
$row = getresult($ret);
echo $row['score_2_2'];
?>
		</td>
		<td align="center">
        <?php 
echo $row['score_3_2'];
?>
        </td>
		<td align="center">
        <?php 
echo $row['score_4_2'];
?>
        </td>
		<td align="center">
        <?php 
Ejemplo n.º 30
0
<?php

include "../conn.php";
$adminname = $_GET["adminname"];
$tempresult = getresult("select * from I_admin where adminname='{$adminname}'");
if (getresultNumrows($tempresult) >= 1) {
    echo "exist";
} else {
    echo "not";
}