-
Notifications
You must be signed in to change notification settings - Fork 0
/
filldb.php
executable file
·44 lines (37 loc) · 942 Bytes
/
filldb.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/php
<?php
$MYSQL_HOST="localhost";
$MYSQL_USER="a2service";
$MYSQL_PASS="a2";
$MYSQL_DB="tagchsel";
$con = mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASS);
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($MYSQL_DB, $con) || die (mysql_error());
$setup = array ( "IJOPCD", "GHQRKL", "EFSTMN", "ABUV" );
mysql_query("TRUNCATE channel;");
$input=0;
$query = "INSERT INTO channel (input,modul,pattern,bit,name,zbit) VALUES ";
foreach ($setup as $m => $conf) {
$bit=0;
$p=0;
for($i=0;$i<strlen($conf);$i++)
{
$base = ord($conf[$i])-65;
for($c=0;$c<16;++$c) {
$ch = $base*16+$c;
echo "Module $m, Char=$conf[$i], Base=$base, Subch=$c, Ch=$ch, Bit=$bit, Pattern=$p\n";
$query .= "($input,$m,$p,$bit,\"Tagger Ch $ch\",0),";
++$bit;
++$input;
if($bit==64) {
$bit = 0;
$p++;
}
}
}
}
$query[strlen($query)-1] = ";";
mysql_query($query) || die(mysql_error());
?>