svn up 使用链接执行

发布于:2015年12月31日 已被阅读

<?php
//require(dirname(__FILE__).'/include/config.inc.php');
//header("Content-Type: text/html; charset=utf-8");
//header("Cache-Control:no-cache,must-revalidate");
$p = $_GET['p'];
/////////////////////////////////
// zhuren
/////////////////////////////////
if($p == 'zhuren'){
    $username = 'xianyong';
    $password = 'qweasdzxc';
    $target_dir = '/var/www/域名/项目名';
    exec("source /etc/default/locale");
    exec("export LC_ALL=en_US.UTF-8");
    exec("export.UTF-8");
    exec("export LANGUAGE=en_US.UTF-8");
    exec("svn update --username $username --password $password $target_dir 2>&1", $output);
    print_r($output);
    exit;
}
if($p == 'puti'){
    $username = 'xianyong';
    $password = 'qweasdzxc';
    $target_dir = '/var/www/www.dyree.cn/puti';
    exec("source /etc/default/locale");
    exec("export LC_ALL=en_US.UTF-8");
    exec("export.UTF-8");
    exec("export LANGUAGE=en_US.UTF-8");
    exec("svn update --username $username --password $password $target_dir 2>&1", $output);
    print_r($output);
    exit;
}
else if($p == 'ls'){
    passthru("ls", $out);
    print_r($out);
    exit;
}

else {
    echo 'param error';
}
?>