MagicSmoke  $VERSION$
admin.php File Reference

Functions

if(!$db->checkAdmin()) form ($m="GET")
 

Variables

if(isset($_GET["addanyhost"])) $admlst =$db->select("userrole","uname","role='_admin'")
 
if(isset($_GET["CreateDB"]))
if(isset($_GET["UpgradeDB"])) 
$canUseDb =$db->canUseDb()
 
 $cversion =$db->getConfig(WobSchema::configVersionRow())
 
for($i=0;$i< count($admlst);$i++)
if(isset($_POST["updatehost"])) 
$hlst =$db->select("host","hostname","")
 
 $xversion =$db->needVersion()
 
form("FILE")?> Backup file to
restore(MagicSmoke2) and
overwrites it with the old
data(MagicSmoke1).This re-uses
the credentials from the
configuration.< p ><?php if(isset($_GET["olddbup"])&&$_GET["olddbup"]
else 
do
 
if($canUseDb) else
 

Function Documentation

if (!$db->checkAdmin()) form (   $m = "GET")

Variable Documentation

if (isset($_GET["addanyhost"])) $admlst =$db->select("userrole","uname","role='_admin'")
if (isset($_GET["CreateDB"])) if (isset($_GET["UpgradeDB"])) $canUseDb =$db->canUseDb()
$cversion =$db->getConfig(WobSchema::configVersionRow())
for ($i=0;$i< count($admlst);$i++) if (isset($_POST["updatehost"])) $hlst =$db->select("host","hostname","")
$xversion =$db->needVersion()
form ("FILE") ?> Backup file to restore (MagicSmoke2) and overwrites it with the old data (MagicSmoke1). This re-uses the credentials from the configuration.<p> <?php if(isset($_GET["olddbup"]) && $_GET["olddbup"] else do
Initial value:
{
if(isset($_POST["adminuser"])&&isset($_POST["adminpwd1"])&&isset($_POST["adminpwd2"])){
if($_POST["adminpwd1"]==""){
print("Error: Cannot create user with empty password!<p>");
break;
}
if($_POST["adminpwd1"]!=$_POST["adminpwd2"]){
print("Error: Passwords do not match.<p>");
break;
}
$un=$_POST["adminuser"];
$usr=$db->select("user","uname","uname=".$db->escapeString($un));
if(count($usr)>0){
print("Error: User already exists.<p>");
break;
}
$salt=getSalt();
$pwd=$salt." ".sha1($salt.$_POST["adminpwd1"]);
$db->insert("user",array("uname"=>$un,"passwd"=>$pwd,"flags"=>"admin"));
$db->insert("userrole",array("uname"=>$un,"role"=>"_admin"));
$db->insert("userhost",array("uname"=>$un,"host"=>"_any"));
}
}while(0)
$db
Definition: config.php:16
getSalt()
return a salt value for Customer::setPassword
Definition: random.php:65
if ($canUseDb) else
Initial value:
{
print("Current Status:<p><ul><li>Connected to DB: ".($db->isConnected()?"yes":"no")." <li>can use/upgrade current DB Schema: ".($db->canUseDb(false)?"yes":"no"))
$db
Definition: config.php:16