コード例 #1
0
ファイル: main.php プロジェクト: kyng-doo/hohomkd
 public function view($id = -1)
 {
     if ($id === -1) {
         alertMsg("게시물이 없습니다.", "/main/lists/");
         return;
     }
     $data = array("id" => $id, "views" => $this->todo_m->get_view($id));
     $this->load->layout('list_v', $data);
 }
コード例 #2
0
function checkLogin()
{
    if (!isset($_SESSION['login'])) {
        alertMsg('请先登录', 'login.php');
        return false;
    } else {
        return true;
    }
}
コード例 #3
0
ファイル: user.inc.php プロジェクト: hardihuang/zihuaxiang
/**
 * 检测是否登陆.
 */
function checkLogin()
{
    if (!(isset($_SESSION['uid']) && isset($_SESSION['name']))) {
        alertMsg('请先登录', 'login.php');
        return false;
    } else {
        return true;
    }
}
コード例 #4
0
ファイル: functions.php プロジェクト: holasjuraj/diplomovka
function authorised($print = true)
{
    global $password;
    if (isset($_SESSION["authorised"]) && $_SESSION["authorised"] == sha1($password)) {
        return true;
    } else {
        if ($print) {
            alertMsg("danger", "You must be logged in!");
        }
        session_destroy();
        return false;
    }
}
コード例 #5
0
ファイル: index.php プロジェクト: holasjuraj/diplomovka
<?php

include "functions.php";
html_start("home");
if (isset($_POST["logout"])) {
    $_SESSION["authorised"] = false;
}
if (isset($_POST["login"])) {
    if ($_POST["password"] == $password) {
        $_SESSION["authorised"] = sha1($_POST["password"]);
    } else {
        alertMsg("danger", "Incorrect password!");
    }
}
if (authorised(false)) {
    ?>
		<h4 class="heading">Welcome</h4>
		<p>You can now proceed to <a href="submit.php">submit new task</a>, or to <a href="results.php">view results</a> of your previous tasks.</p>
		<br />
		<form method="post" action="index.php">
			<button type="submit" name="logout" type="button" class="btn btn-danger">Log out</button>
		</form>
		<?php 
} else {
    ?>
	<h4 class="heading">Log in</h4>
	<form class="form-horizontal" method="post" action="index.php">
		<fieldset>
			<div class="form-group">
				<label for="password" class="col-lg-2 col-xs-2 control-label">Password:</label>
				<div class="col-lg-4 col-xs-6">
コード例 #6
0
ファイル: admin.inc.php プロジェクト: yangchenglong/myshop
/**
 * 检查是否已经登录
 */
function checkLogined()
{
    if (!isset($_SESSION["adminId"]) && !isset($_COOKIE["adminId"])) {
        alertMsg("请先登录", "login.php");
    }
}
コード例 #7
0
ファイル: doLogin.php プロジェクト: yangchenglong/myshop
 * Created by PhpStorm.
 * User: Administrator
 * Date: 16-1-19
 * Time: 下午10:49
 */
require_once '../include.php';
$username = $_POST['username'];
$password = $_POST['password'];
$autoFlag = $_POST['autoFlag'];
$checkCode = $_POST['checkCode'];
$checkCode2 = $_SESSION['checkCode'];
echo "checkCode: " . $checkCode . "<br>";
echo "checkCode in session: " . $checkCode2;
if ($checkCode != $checkCode2) {
    alertMsg("登录失败,验证码有误!", "login.php");
} else {
    $password = md5($password);
    $sql = "select * from admin where username='******' and password='******'";
    $result = checkAdmin($sql);
    if ($result) {
        if ($autoFlag) {
            setcookie("adminId", $result["id"], time() + 7 * 24 * 3600);
            setcookie("adminName", $result["username"], time() + 7 * 24 * 3600);
        }
        $_SESSION["adminId"] = $result["id"];
        $_SESSION["adminName"] = $result["username"];
        alertMsg("登录成功", "index.php");
    } else {
        alertMsg("登录失败,用户名或密码有误!", "login.php");
    }
}
コード例 #8
0
ファイル: index.php プロジェクト: cengjing/fileManager-1
                        $dis = $_REQUEST['disFile'];
                        $msg = copyFolder($srcFile, 'file' . "/" . $dis);
                        alertMsg($msg, $urlt);
                    } elseif ($mode == 'cutFolder') {
                        $str = "\n        <form action='index.php?mode=doCutFolder' method='post'>\n            <input type='hidden' name='filename' value='{$filename}' />\n            <input type='hidden' name='path' value='{$path}' />\n            <label>前切:</label>\n            <input type='text' name='disFile' placeholder='前切到'>\n            <input type='submit' value='确定'/>\n        </form>";
                        echo $str;
                    } else {
                        if ($mode == 'doCutFolder') {
                            $dirpath = $filename;
                            $distpath = $_REQUEST['disFile'];
                            $msg = cutFolder($dirpath, $path . "/" . $distpath);
                            alertMsg($msg, $url);
                        } else {
                            if ($mode == 'deleteFolder') {
                                $msg = deleteFolder($filename);
                                alertMsg($msg, $url);
                            }
                        }
                    }
                }
            }
        }
    }
}
?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>文件管理系统</title>
    <link rel="stylesheet" href="resource/css/cikonss.css">
コード例 #9
0
ファイル: status.php プロジェクト: holasjuraj/diplomovka
<?php

include "functions.php";
html_start("results");
if (authorised()) {
    ?>
		<a href="#" class="scroll-down"><span class="glyphicon glyphicon-chevron-down"></span></a>
		<h4 class="heading">Task status</h4>
		<?php 
    if (!isset($_GET["task"]) || !file_exists($tasksDir . "/" . $_GET["task"])) {
        alertMsg("danger", "Invalid task ID!");
    } else {
        $dir = $tasksDir . "/" . $_GET["task"];
        $infoFile = fopen("{$dir}/inputInfo.txt", "r");
        $taskName = fgets($infoFile);
        $startTime = fgets($infoFile);
        fgets($infoFile);
        // Skip task directory
        $inputFile = fgets($infoFile);
        fclose($infoFile);
        echo "<p><b>Task name:</b> {$taskName}</p>\n";
        echo "<p><b>Submit time:</b> {$startTime}</p>\n";
        echo "<p><b>Input file:</b> {$inputFile}</p><br />\n";
        echo "<p><b>Status:</b></p>\n";
        echo "<pre>\n";
        $statusFilePath = "{$dir}/sysout.txt";
        if (!file_exists($statusFilePath)) {
            echo "Error: status file not found.";
        } else {
            $statusFile = fopen($statusFilePath, "r");
            while (!feof($statusFile)) {
コード例 #10
0
 public function doVote()
 {
     $id = I('id', 0, 'intval');
     //$sql = 'UPDATE think_vote SET count=count+1 WHERE id='.$id;M()->execute($sql)
     if (M('vote')->where(array('id' => $id))->setInc('count')) {
         alertMsg('投票成功');
     } else {
         alertMsg('投票失败');
     }
 }
コード例 #11
0
    public function action()
    {
        $path = I('path');
        $act = I('act');
        $filename = I('file');
        if ($act == 'showContent') {
            $content = htmlspecialchars(file_get_contents($filename));
            if (strlen($content)) {
                $str = <<<EOF
\t\t\t\t\t<textarea style="width:98.5%;height:550px;padding:10px;color:#333;background:#dee5de" name="content">{$content}</textarea>
EOF;
                echo $str;
            } else {
                echo '没有内容';
            }
        }
        if ($act == 'editContent') {
            $content = htmlspecialchars(file_get_contents($filename));
            $url = U('Theme/action', array('act' => 'doEdit'));
            if (strlen($content)) {
                $str = <<<EOF
\t\t\t\t<form action="{$url}" method="post">
\t\t\t\t\t<textarea style="width:98.5%;padding:10px;color:#333;background:#dee5de;overflow:auto;height:550px"  name="content">{$content}</textarea><br/>
\t\t\t\t\t<input type="hidden" name="path" value="{$path}" />
\t\t\t\t\t<input type="hidden" name="file" value="{$filename}" />
\t\t\t\t\t<input type="submit" value="修改文件内容" class="submit" />
\t\t\t\t</form>
EOF;
                echo $str;
            }
        }
        if ($_GET['act'] == 'doEdit') {
            $content = I('content');
            if (file_put_contents($filename, $content)) {
                $this->success('编辑成功');
            } else {
                $this->error('编辑失败');
            }
        }
        if ($act == 'download') {
            header('content-disposition:attachment;filename=' . basename($filename));
            header('content-length:' . filesize($filename));
            readfile($filename);
        }
        if ($act == 'rename') {
            $url = U('Theme/action', array('act' => 'doRename'));
            $str = <<<EOF
\t\t\t<form action="{$url}" method="post">
\t\t\t\t请输入新名称:<input type="text" name="newname" placeholder="重命名" class="input"/>
\t\t\t\t<input type="hidden" name="path" value="{$path}" class="input"/>
\t\t\t\t<input type="hidden" name="file" value="{$filename}" class="input"/>
\t\t\t\t<input type="submit" value="重命名" class="btn2"/>
\t\t\t</form>
\t\t\t
EOF;
            echo $str;
        }
        if ($_GET['act'] == 'doRename') {
            $newname = I('newname');
            if (empty($newname)) {
                alertMsg('新文件名不能为空');
                die;
            }
            if (!file_exists(dirname($filename) . '/' . $newname)) {
                if (rename($filename, dirname($filename) . '/' . $newname)) {
                    $this->success('重命名成功');
                } else {
                    $this->error('重命名失败');
                }
            } else {
                $this->error('已存在同名文件');
            }
        }
        if ($act == 'delFile') {
            if (is_file($filename)) {
                if (unlink($filename)) {
                    echo 1;
                } else {
                    echo 0;
                }
            }
        }
        if ($act == 'delFile') {
            if (is_dir($filename)) {
                if (deldir($filename, 1)) {
                    echo 1;
                } else {
                    echo 0;
                }
            }
        }
        if ($_GET['act'] == 'upFile') {
            $fileInfo = $_FILES['upFile'];
            $msg = uploadFile($fileInfo, $path);
            $this->success('上传成功');
        }
    }
コード例 #12
0
        if (!in_array($extension, $supported_extensions)) {
            alertMsg("danger", "File upload failed! Unsupported file format.");
            $status = false;
        } else {
            if (!file_exists($thisTaskDir)) {
                mkdir($thisTaskDir, 0777);
            }
            $destination = "{$thisTaskDir}/{$basename}";
            $temp_name = $_FILES["inputFile"]["tmp_name"];
            $move = move_uploaded_file($temp_name, $destination);
            if (!$move || $_FILES["inputFile"]["error"] > 0) {
                alertMsg("danger", "File upload failed! Upload error: " . $_FILES["inputFile"]["error"] . ", file move error: " . (!$move ? "yes" : "no"));
                $status = false;
            } else {
                chmod($destination, 0777);
            }
        }
    }
    if ($status && $destination) {
        $text = $_POST["taskName"] . "\n" . "{$startTimeText}\n" . "{$thisTaskDir}\n" . "{$basename}\n" . "# Parameters\n" . "min-pattern-size: " . $_POST["min-pattern-size"] . "\n" . "threads:" . $_POST["threads"] . "\n" . "comparing-method: " . $_POST["comparing-method"] . "\n" . "editdistance-early-stopping: " . $_POST["editdistance-early-stopping"] . "\n" . "qgram-size: " . $_POST["qgram-size"] . "\n" . "clustering-method: " . $_POST["clustering-method"] . "\n" . "clustering-threshold: " . $_POST["clustering-threshold"] . "\n";
        $inputInfoPath = "{$newTaskDir}/{$timestamp}-inputInfo.txt";
        $inputInfoFile = fopen($inputInfoPath, "w");
        fwrite($inputInfoFile, $text);
        fclose($inputInfoFile);
        chmod($inputInfoPath, 0777);
        alertMsg("success", "Task successfully submited!");
    }
    umask($oldmask);
    usleep(1000000);
    // Sleep for 1 second - wait until deamon creates info file
}
コード例 #13
0
ファイル: editAdmin.php プロジェクト: yangchenglong/myshop
<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 16-1-20
 * Time: 上午1:26
 */
require_once '../include.php';
$id = $_REQUEST["id"];
$row = fetchOne("select * from admin where id={$id}");
if (!$row) {
    alertMsg("管理员不存在,adminId={$id}", "listAdmin.php");
}
?>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑管理员</title>
    <link rel="stylesheet" href="styles/global.css">
</head>
<body>

<form action="doAdminAction.php?act=editAdmin" method="post">
    <input type="hidden" name="id" value="<?php 
echo $row['id'];
?>
">
    <table>