我有一个很好用的脚本
<form name="contactform" method="POST" action="mssql.php">
<textarea name="user" cols="20" rows="6"></textarea>
<textarea name="pass" cols="20" rows="6"></textarea>
<input type="submit" value="Submit" />
</form>
<?php
$user = $_POST['user'];
$lines = explode("\n", $user);
$pass = $_POST['pass'];
$lines1 = explode("\n", $pass);
echo "Paste into command line to add user and passwords<br><br>";
echo "=======================================<br><br>";
foreach (array_combine($lines, $lines1) as $v => $t) {
echo "CREATE LOGIN " . $v . " WITH PASSWORD = '" . $t . "';<br>GO<br>";
}
echo "=======================================<br><br>";
?>
唯一的问题是输出:
Paste into command line to add user and passwords
=======================================
CREATE LOGIN user1 WITH PASSWORD = 'pass1 ';
GO
CREATE LOGIN user2 WITH PASSWORD = 'pass2';
GO
=======================================
注意 pass1 --> 'pass1' 后面的空格;
我该如何摆脱它?
谢谢你