source: locker/sql/bin/get-next-database @ 158

Last change on this file since 158 was 131, checked in by jbarnold, 17 years ago
added sql scripts
  • Property svn:executable set to *
File size: 405 bytes
Line 
1#!/usr/bin/php
2<?php
3
4list($h,$u,$p) = explode("\t",`/mit/scripts/sql/bin/get-password`);
5$newdb = str_replace($u.'+','',$argv[1]);
6$testdb = str_replace('.','',$u).'+'.$newdb;
7$dbs = explode("\n",file_get_contents("http://sql.mit.edu/~sql/tools/list_dbs.php?h=$h&u=$u&p=$p"));
8if (in_array($testdb,$dbs)) {
9        $i = 1;
10        while(in_array($testdb.$i,$dbs)) {
11                $i++;
12        }
13        echo $newdb.$i;
14} else echo $newdb;
15
16?>
Note: See TracBrowser for help on using the repository browser.