summaryrefslogtreecommitdiff
path: root/tests/test.php
blob: ec6d35b6030312d7eac484c4acc5928cd9bbfe92 (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, 'localhost'),
  array('isuser', '123456789', 'localhost'),
  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;
}