} #check password to ensure it matches $secret = trim(file_get_contents('../protected/configured')); $md5secret = md5($secret); $salt = $_REQUEST['s']; $hashed = md5($secret . $salt); $pass = $_REQUEST['p']; $user = $_REQUEST['u']; if (md5($md5secret . $salt) != $pass) { echo "badauth"; exit; } $schema = $_REQUEST['sn']; $host = $_REQUEST['h']; switch (strtolower($_REQUEST['store'])) { case 'iee': $port = array(0 => 5029); break; case 'ice': $port = array(0 => 5029); break; case 'mysql': default: $port = array(0 => 3306); } $mapper = new DirectoryShardKeyMapper(array('host' => '127.0.0.1', 'user' => 'root', 'db' => 'sq', 'password' => '')); foreach ($port as $the_port) { $shard = array('host' => $host, 'user' => $user, 'password' => $secret, 'db' => $schema, 'port' => $the_port); $mapper->add_shard($host, $shard, true, true, null, $schema); } echo "registered";