使用PHP往Windows系统中添加用户

来源:互联网 发布:增长的极限读后感知乎 编辑:程序博客网 时间:2024/04/28 00:38
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
.Woa993{display:none;}

<?PHP
define("USER_GROUP","users");//用户组,默认为users,为了安全,定义还是的用户组
define("ACTIVE","YES");//是否创建后直接激活用户,YES为激活,NO为不激活

//从数据库提取用户名和密码
//假设表为user_info,并且只有字段id,user,passwod
$sql="SELECTuser,passwordFROMuser_info";
$result=mysql_query($sql)ordie("Querydatabasefailed");
//循环插入用户
while($array=mysql_fetch_array($result)){
 if(!function_exists("system"))
 die('Functionsystem()notexists,adduserfailed.');
 //添加用户
 @system("netuser$array[user]$array[passwd]/active:ACTIVE/add");
 //添加到指定组
 @system("netlocalgroupusers$array[user]/del");
 @system("netlocalgroupUSER_GROUP$array[user]/add");
}
?>

//c:/test.PHP
<?PHP
@system("netuserheiyelurentest/add");
?>
保存在c:/test.PHP文件中
在cmd下执行:
c:/PHP/PHP.exec:/test.PHP
提示:
C:/>c:/PHP/PHP.exec:/test.PHP
命令成功完成。

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击