database-zonder-mysql-alleen-met-php

Gesponsorde koppelingen

PHP script bestanden

  1. database-zonder-mysql-alleen-met-php

« Lees de omschrijving en reacties

files:

--config.php--

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?

//bestand openen
$db = 'database.txt';
$fopenr = fopen($db,"r");
$database = fread ($fopenr, filesize ($db));
//tabellen scheiden
$dbt = explode('#',$database);
//tellen hoeveel tabellen er zijn
$dbta = count($dbt);
 
//loop voor de tabellen
for($a = '0'; $a < $dbta; $a++){

    $dbr = explode('|',$dbt[$a]);
    $dbra = count($dbr);
    //naam van tabel $a
    $name_table[$a] = $dbr['0'];
    //naam van de rijen in de eerste tabel
    $name_cola = explode(',',$dbr['1']);
    $name_colaa = count($name_cola);
    
    for($aa='0';$aa < $name_colaa; $aa++){
    $name_col[$a][$aa] = $name_cola[$aa];
    
    }

    
    //naam voor het opslaan van inhoud van cellen
    $table_n = $dbr['0'];
    
    //loop voor rijen
    for($b='2', $ba='0'; $b < $dbra; $b++, $ba++){
        
        $dbc = explode('^',$dbr[$b]);
        $dbca = count($dbc);
        //naam voor de rij
        $name_row[$a][$ba] = $dbc['0'];
        //naam voor het opslaan van de inhoud van de cellen
        $row_n = $dbc['0'];
        
        //loop voor de cellen
        for($c = '1', $ca = '0'; $c < $dbca; $c++, $ca++){
            
            $col_n = $name_col[$a][$ca];
            //data opslaan
            $cel[$table_n][$row_n][$col_n] = $dbc[$c];
        }
    }
}


//delete rij ->> rijnaam,tabelnaam
function deleterow($rowname,$tablename){
    
    $db = 'database.txt';
    $fopenr = fopen($db,"r");
    $database = fread ($fopenr, filesize ($db));
    $dbt = explode('#',$database);
    $dbta = count($dbt);
        
    for($a='0';$a<$dbta ;$a++){
        $dbr = explode('|',$dbt[$a]);
        if($dbr['0'] !== $tablename){
            $data .= $dbt[$a];
            if($a<($dbta-'1')){
                $data .= '#';
            }
        }

        else{
            $data .= $dbr['0'].'|'.$dbr['1'].'|';
            $dbra = count($dbr);
            for($b='2';$b<$dbra;$b++){
            
                $dbc = explode('^',$dbr[$b]);
                $dbrn = $dbc['0'];
                if($dbrn == $rowname){
                    $nr = $b;
                }
            }

            for($c='2';$c<$dbra;$c++){
                if($c !== $nr){
                    
                    $data .= $dbr[$c];
                    if(($dbra-'1' == $nr)&&($c==($nr-'1'))){}
                    else{
                        if($c < ($dbra-'1')){
                            $data .= '|';
                        }
                    }
                }
            }

            if($a<($dbta-'1')){
                $data .= '#';
            }
        }
    }

    $fopenw = fopen($db, "w+");
    fwrite($fopenw, $data);
    fclose($fopenw);
}

//delete kolom ->> kolomnaam,tabelnaam
function deletecol($colname,$tablename){
    
    $db = 'database.txt';
    $fopenr = fopen($db,"r");
    $database = fread ($fopenr, filesize ($db));
    $dbt = explode('#',$database);
    $dbta = count($dbt);
        
    for($a='0';$a<$dbta ;$a++){
        $dbr = explode('|',$dbt[$a]);
        if($dbr['0'] !== $tablename){
            $data .= $dbt[$a];
            if($a<($dbta-'1')){
                $data .= '#';
            }
        }

        else{
            $data .= $dbr['0'].'|';
            $dbra = count($dbr);
            $dbcn = explode(',',$dbr['1']);
            $dbca = count($dbcn);
            for($b='0';$b<$dbca;$b++){
                if($dbcn[$b] == $colname){
                    $nr = $b;
                }
            }

            for($c='0';$c<$dbca;$c++){
                if($c !== $nr){
                    $data .= $dbcn[$c];
                    if(($dbca-'1' == $nr)&&($c==($nr-'1'))){}
                    else{
                        if($c < ($dbca-'1')){
                            $data .= ',';
                        }
                    }
                }
            }

            $data .= '|';
            for($d='2';$d<$dbra;$d++){
                $col = explode('^',$dbr[$d]);
                $data .= $col['0'].'^';
                for($e='0';$e<$dbca;$e++){
                    if($e!==$nr){
                        $data .= $col[($e+'1')];
                        if(($dbca-'1' == $nr)&&($e==($nr-'1'))){}
                        else{
                            if($e<($dbca-'1')){
                                $data.='^';
                            }
                        }
                    }
                }

                if($d<($dbra-'1')){
                    $data .= '|';
                }
            }

            if($a<($dbta-'1')){
                $data.='#';
            }
        }
    }

    
    $fopenw = fopen($db, "w+");
    fwrite($fopenw, $data);
    fclose($fopenw);
    
}

//delete tabel ->> tabelnaam
function deletetable($tablename){
    
    $db = 'database.txt';
    $fopenr = fopen($db,"r");
    $database = fread ($fopenr, filesize ($db));
    $dbt = explode('#',$database);
    $dbta = count($dbt);

    for($aa='0';$aa < $dbta;$aa++){
    
        $dbr = explode('|',$dbt[$aa]);
        
        if($tablename == $dbr['0']){
        
        $deletetable[$aa] = 'yes';
        
        }
    }

    
    for($a='0';$a<$dbta;$a++){
        $dbr = explode('|',$dbt[$a]);
        
        if($deletetable[$a] !== 'yes'){
                
        $dataa .= $dbt[$a];
        
        if($a < ($dbta-'1')){
        if(($a == ($dbta-'2'))&&($deletetable[($a+'1')] == 'yes')){
            }

        else{
        $dataa .= '#';
        }
            }}
    }


    $fopenschrijven = fopen($db, "w+");
    fwrite($fopenschrijven, $dataa);
    fclose($fopenschrijven);
}

//delete inhoud van een cel ->> tabelnaam,rijnaam,kolomnaam,nieuwe inhoud(optioneel)
function deletecontent($tablename,$rowname,$colname,$newcontent){
    
    
    
}

//maak nieuwe tabel ->> tabelnaam,aantal rijen(minimaal 1),aantal kolommen(minimaal 1),rijnamen(bij meer dan 1 rij namen in een array),kolomnamen(bij meer dan 1 kolom namen in een array)
function createtable($tablename,$a_row,$a_col,$rowname,$colname){
    
    
    
}

//maak nieuwe rij ->> rijnaam(bij meerdere in een array),aantal nieuwe rijen(minimaal 1),celinhoud(bij meer dan 1 kolom de inhoud in een array)
function createrow($rowname,$a_row,$celcontent){
    
    
    
}

//maak nieuwe kolom ->> kolomnaam(bij meerdere in een array),aantal nieuwe kolommen(minimaal 1),celinhoud(bij meer dan 1 rij de inhoud in een array)
function createcol($colname,$a_col,$celcontent){
    
    
    
}

//rename tabel ->> oude naam,nieuwe naam
function renametable($oldname,$newname){
    
    
    
}

//rename rij ->> oude naam,nieuwe naam,tabelnaam
function renamerow($oldname,$newname,$tablename){
    
    
}

//rename kolom ->> oude naam,nieuwe naam, tabelnaam
function renamecol($oldname,$newname,$tablename){
    
    
}

//voeg inhoud toe aan een cel ->> tabelnaam,rijnaam,kolomnaam,celinhoud
function add($tablename,$rowname,$colname,$celcontent){
    
}

?>






--show.php--

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form  name="formulier"  action="change.php" method="post" accept-charset="iso-8859-1">
<?php
include('config.php');
deletecol('unnamed col 1','dafs');
for($i='0';$i<$dbta;$i++){
    //tabellen aanmaken
    echo "\n".'name table = <input type="text" size="15" value="'.$name_table[$i].'" name="table['.$i.']"> &nbsp;&nbsp;';
    if($dbta>'1'){
    echo '<input type="checkbox" name="deletetable['.$i.']" value="yes"> delete this table';}
    echo '<br><br><table>';
    $rowa = count($name_row[$i]);
    $col_a = count($name_col[$i]);
    //kolom namen in tabel
    echo "\n".'<tr><td></td>';
    for($l='0';$l<$col_a;$l++){
    echo "\n".'<td><b><input type="text" size="32" value="'.$name_col[$i][$l].'" name="col['.$i.']['.$l.']"></b></td>';
    }

    echo "\n".'</tr>';
    
    for($j='0';$j<$rowa;$j++){
        //rijnamen in tabel
        echo '<tr>';
        $n_row = $name_row[$i][$j];
        echo "\n".'<td><b><input type="text" size="15" value="'.$n_row.'" name="row['.$i.']['.$j.']"><b></td>';
        //inhoud van de cellen
        for($k='0';$k<$col_a;$k++){
            $n_table = $name_table[$i];
            $n_col = $name_col[$i][$k];
            echo "\n".'<td><textarea rows="4" cols="25" name="cel['.$i.']['.$j.']['.$k.']">';
            
            echo $cel[$n_table][$n_row][$n_col].'</textarea></td>';
            }

        echo "\n</tr>";
        }

    

    //tabellen afsluiten
    echo "\n".'</table><br>'
    ?>

    <input type="checkbox" name="new[<? echo $i; ?>]" value="yes"> add
    <select name="amount[<? echo $i; ?>]"><option value="1" selected>1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                                <option value="10">10</option>
                                </select>
                                <select name="thing[<? echo $i; ?>]"><option value="row">row(s)</option><option value="col">col(s)</option></select>
                                <br>
    <?php
    echo '<br><hr>';
}


?>

<input type="checkbox" name="newtable" value="yes"> add new table --> table name: <input type="text" size="15" name="newtable_n"> with
<select name="newtable_r"><option value="1" selected>1 row</option>
                                <option value="2">2 rows</option>
                                <option value="3">3 rows</option>
                                <option value="4">4 rows</option>
                                <option value="5">5 rows</option>
                                <option value="6">6 rows</option>
                                <option value="7">7 rows</option>
                                <option value="8">8 rows</option>
                                <option value="9">9 rows</option>
                                <option value="10">10 rows</option>
                                </select> and
    <select name="newtable_c"><option value="1" selected>1 col</option>
                                <option value="2">2 cols</option>
                                <option value="3">3 cols</option>
                                <option value="4">4 cols</option>
                                <option value="5">5 cols</option>
                                <option value="6">6 cols</option>
                                <option value="7">7 cols</option>
                                <option value="8">8 cols</option>
                                <option value="9">9 cols</option>
                                <option value="10">10 cols</option>
                                </select><br>
<input type="submit" value="save changes">
</form>
</body>
</html>







--change.php--

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?


$database
= 'database.txt';



$table_a = count($table);
for($a='0';$a<$table_a;$a++){
    if ($deletetable[$a] !== 'yes'){
    
    
    $data .= $table[$a].'|';
    
    $col_a = count($col[$a]);
        
    for($b='0';$b<$col_a;$b++){
    

        
        $data .= $col[$a][$b];
        if($b < ($col_a-'1')){
        $data .= ',';}
        else{
        //kolom toevoegen
        if(($new[$a] == 'yes')&&($thing[$a] == 'col')){
        for($w = '1';$w<=$amount[$a];$w++){
        $data .= ',unnamed col '.$w;}}

        
        $data .= '|';}
    }

    $row_a = count($row[$a]);
    
    $row_aa = $row_a;
    //rijentoevoegen
    if(($new[$a] == 'yes')&&($thing[$a] == 'row')){
    $row_aa = $row_a;
    $row_a = ($row_a+$amount[$a]);
    }

    for($c='0'; $c < $row_a ; $c++){
        
        if($c >= $row_aa){
        $data .= 'unnamed row '.($c+'1');}
        else{
        $data .= $row[$a][$c].'^';
        }

        for($d='0' ; $d < $col_a ; $d++ ){
            //rijentoevoegen
            if($c < $row_aa){
            $data .= $cel[$a][$c][$d];
            }

            
            if($d < ($col_a-'1')){
            $data .= '^';}
            else{
            //kolom toevoegen
            if(($new[$a] == 'yes')&&($thing[$a] == 'col')){
            for($w = '1';$w<=$amount[$a];$w++){
            $data .= '^';}}
            
            if($c < ($row_a-'1')){            
            $data .= '|';}}
        }
                
    }

    
    
    
if($a < ($table_a-'1')) {
if(($a == ($table_a-'2'))&&($deletetable[($a+'1')] == 'yes')){
}
else{

$data .= '#';}}
}}

//nieuwe tabel
if($newtable == 'yes'){
$data .= '#'.$newtable_n.'|';
for($an='1';$an<=$newtable_c;$an++){
$data .= 'unnamed col '.$an;
if($an<$newtable_c){
$data .= ',';}
}

for($bn='1';$bn<=$newtable_r;$bn++){
    $data .= '|unnamed row '.$bn.'^';
    for($cn='1';$cn<$newtable_r;$cn++){
        $data .= '^';}
}}

        



$fopenw = fopen($database, "w+");
fwrite($fopenw, $data);
fclose($fopenw);

echo "<SCRIPT LANGUAGE=\"javascript\" TYPE=\"text/javascript\">window.location=\"show.php\"</SCRIPT>\n";


?>





--database.txt (moet chmod 777 hebben)--

unnamed table|unnamed col 1|unnamed row 1^

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.