PhpLabWare version 0.3 
/dd/ -> 0_0040_inc.php

1  <?php
2 
3  // creates table IPnumbers
4 
5  $newtableid=$db->GenID("tableoftables_gen_id_seq");
6  $newtablename=ipnumbers;
7  $newtablelabel="IP";
8  unset($hownew);
9  while (get_cell($db,"tableoftables","id","tablename",$newtablename)) {
10     $newtablename.="n";
11     $hownew++;
12  }
13  for ($i=0;$i<$hownew;$i++)
14     $newtablelabel.="new";
15  $newtableshortname=substr($newtablename,0,3).$newtableid;
16  $newtable_realname=$newtablename."_".$newtableid;
17  $newtable_desc_name=$newtable_realname."_desc";
18  $r=$db->Execute("INSERT INTO tableoftables (id,sortkey,tablename,shortname,display,permission,custom,real_tablename,table_desc_name,label,plugin_code) VALUES ('$newtableid','0','$newtablename','$newtableshortname','Y','Users',NULL,'$newtable_realname','$newtable_desc_name','$newtablelabel','plugins/ipnumbers_plugin.php')");
19  $rg=$db->Execute ("SELECT id FROM groups");
20  while (!$rg->EOF) {
21     $groupid=$rg->fields[0];
22     $db->Execute ("INSERT INTO groupxtable_display VALUES ($groupid,$newtableid)");
23     $rg->MoveNext();
24  }
25 
26  if ($r) {
27     $rb=$db->Execute("CREATE TABLE $newtable_desc_name (
28        id int NOT NULL,
29        sortkey int,
30        label text,
31        columnname text,
32        display_table char(1),
33        display_record char(1),
34        required char(1),
35        type text,
36        datatype text,
37        associated_table text,
38        associated_column text,
39        associated_local_key text,
40        thumb_x_size int,
41        thumb_y_size int,
42        link_first text,
43        link_last text,
44        modifiable char(1) )");
45     if ($rb) {
46        $newid=$db->GenID("newtable_desc_name"."_id");
47        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'175','online','online','Y','Y','N','text','text','','','','','','','','N')");
48        $newid=$db->GenID("newtable_desc_name"."_id");
49        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'140','Computer/User','title','Y','Y','Y','text','text','','','','','','','','Y')");
50        $newid=$db->GenID("newtable_desc_name"."_id");
51        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'180','Apple talk Name','atalkname','Y','Y','N','text','text','','','','','','','','Y')");
52        $newid=$db->GenID("newtable_desc_name"."_id");
53        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'200','Other','other','Y','Y','N','text','text','','','','','','','','Y')");
54        $newid=$db->GenID("newtable_desc_name"."_id");
55        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'160','IP','ipnumber','Y','Y','N','text','text','','','','','','','','Y')");
56        $newid=$db->GenID("newtable_desc_name"."_id");
57        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'170','OS','osother','Y','Y','N','text','pulldown','ipnumbers_10005ass_1','osother from ipnumbers_10005ass_1 where ','','','','','','Y')");
58        $ass_table=$newtable_realname."ass";
59        $id_ass=$db->GenId($ass_table,20);
60        $ass_table.="_$id_ass";
61        $db->Execute("CREATE TABLE $ass_table (
62           id int PRIMARY KEY,
63           sortkey int,
64           type text,
65           typeshort text)");
66        $db->Execute("UPDATE $newtable_desc_name SET associated_table='$ass_table' WHERE id=$newid");
67        $newid=$db->GenID("newtable_desc_name"."_id");
68        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'100','id','id','N','N','N','int','text','','','','','','','','N')");
69        $newid=$db->GenID("newtable_desc_name"."_id");
70        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'110','access','access','N','N','N','varchar(9)','text','','','','','','','','N')");
71        $newid=$db->GenID("newtable_desc_name"."_id");
72        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'120','ownerid','ownerid','N','N','N','int','text','','','','','','','','N')");
73        $newid=$db->GenID("newtable_desc_name"."_id");
74        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'130','magic','magic','N','N','N','int','text','','','','','','','','N')");
75        $newid=$db->GenID("newtable_desc_name"."_id");
76        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'150','lastmoddate','lastmoddate','N','N','N','int','text','','','','','','','','N')");
77        $newid=$db->GenID("newtable_desc_name"."_id");
78        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'160','lastmodby','lastmodby','N','N','N','int','text','','','','','','','','N')");
79        $newid=$db->GenID("newtable_desc_name"."_id");
80        $db->Execute("INSERT INTO $newtable_desc_name VALUES($newid,'170','date','date','N','N','N','int','text','','','','','','','','N')");
81        // and finally create the table
82        $rc=$db->Execute(" CREATE TABLE $newtable_realname (
83           online text ,
84           title text ,
85           atalkname text ,
86           other text ,
87           ipnumber text ,
88           osother text ,
89           id int NOT NULL,
90           access varchar(9) ,
91           ownerid int ,
92           magic int ,
93           lastmoddate int ,
94           lastmodby int ,
95           date int ) ");
96 
97     }
98 
99 
100  }
101 
102  ?>


Generated: Sun Oct 5 21:17:35 2003 SourceForge Logo Generated by PHPXref 0.2