Skip to content

Commit

Permalink
trying a global variable with popen
Browse files Browse the repository at this point in the history
git-svn-id: https://adam.cs.princeton.edu/svn/craq/src@4287 41643c41-6115-4a67-97d8-b2dbeab842be
  • Loading branch information
rucinski committed Apr 15, 2010
1 parent 57c9982 commit d4af95c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lighttpd_files/db2.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

global $id;

$request_method = $_ENV['REQUEST_METHOD'];
$request_uri = substr($_ENV['REQUEST_URI'], 1);
$content_length = $_ENV['CONTENT_LENGTH'];
Expand All @@ -8,19 +10,19 @@

if ($request_method === 'GET') {

$id = dba_open($filename, "r", "gdbm");
$id = dba_popen($filename, "r", "gdbm");
$val = dba_fetch($request_uri, $id);
echo $val;

} else if ($request_method === 'PUT') {

$buffer = file_get_contents('php://input');
$id = dba_open($filename, "c", "gdbm");
$id = dba_popen($filename, "c", "gdbm");
dba_replace($request_uri, $buffer, $id);

} else if ($request_method === 'DELETE') {

$id = dba_open($filename, "w", "gdbm");
$id = dba_popen($filename, "w", "gdbm");
dba_delete($request_uri, $id);

}
Expand Down

0 comments on commit d4af95c

Please sign in to comment.