function dhNetworks() { static $networks = null; if (null === $networks) { $networks = dhQuery("SELECT n.id_networks\n , n.netname\n FROM networks n\n WHERE n.id_users = '" . dhUID() . "'"); } return $networks; }
<?php $root = realpath(dirname(__FILE__)); include_once "{$root}/config.php"; include_once "{$root}/common.php"; if (!dhIsLogin()) { dhRedirect('index'); } if (dhIsPost()) { if (dhValid(array('netname' => 'required'))) { $netname = dhPost('netname', 'WORKGROUP'); dhQueryInsert('networks', array('id_users' => dhUID(), 'netname' => $netname, 'created' => time())); if (dhConfig('useModRewrite')) { dhRedirect('networks'); } else { dhRedirect('networks', array('success' => urlencode($netname))); } } } dhTheme('networks-add');
<?php $root = realpath(dirname(__FILE__)); include_once "{$root}/config.php"; include_once "{$root}/common.php"; if (!dhIsLogin()) { dhRedirect('index'); } if (dhIsPost()) { if (dhValid(array('netname' => 'required'))) { $netid = dhPost('netid', 0); $netname = dhPost('netname', 'WORKGROUP'); dhQueryUpdate('networks', array('netname' => $netname), "id_networks = '" . $netid . "'"); if (dhConfig('useModRewrite')) { dhRedirect('networks', array('n' => $netid)); } else { dhRedirect('networks', array('edit' => urlencode($netname))); } } } if (dhHasGet('n')) { $netid = dhGet('n'); } $networks = dhQuery("SELECT n.id_networks\n , n.netname\n FROM networks n\n WHERE n.id_networks = '{$netid}'\n AND n.id_users = '" . dhUID() . "'"); if ($networks) { $network = array_shift($networks); } dhTheme('networks-edit');