summaryrefslogtreecommitdiff
path: root/tests/test.php
blob: a6d6c1652b4db7c401b1d11e204926d3fe8e8300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$stderr = fopen('php://stderr', 'w'); 
$in = fopen('php://stdin', 'r');
fwrite($stderr, "Enter a valid username: ");
$user = trim(fgets($in));
fwrite($stderr, "Enter the password: ");
$password = trim(fgets($in));

$str = array(
  array('isuser', $user),
  array('isuser', '123456789'),
  array('auth', $user, 'localhost', $password),
  array('auth', $user, 'localhost', '123456789'),
  
  // These should all fail cleanly.
  array('setpass', '123456789', 'localhost', '123456789'),
  array('tryregister', '123456789', 'localhost', '123456789'),
  array('removeuser', '123456789', 'localhost', '123456789'),
  array('removeuser3', '123456789', 'localhost', '123456789'),
);

foreach ($str as $command) {
  $command = implode(':', $command);
  print pack('n', strlen($command));
  print $command;
}