function ShareCode(&$arg, $enable = 1) { $sid = safefetch($arg, 'sid', "Fail"); global $login_uid; if ($login_uid == -1) { Fail("Must login first"); } $status = new StatusTbl($sid); if (!$status->Get()) { Fail("No such code"); } if ($login_uid != $status->detail["uid"]) { Fail("You are not the owner of the code"); } $status->update["public"] = $enable; $status->Update(); $status->FreeResource(); }