うまく機能するスクリプトがあります
<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 ';
どうすればそれを取り除くことができますか?
ありがとうございました