Hi was looking at the vBAmry system, as a reference to get a hang of how to write PHP efficiently for vB.
And I stubled upon this:
PHP Code:
<?php
if(THIS_SCRIPT != 'armysystem'){
die();
}
$att->clean(p,userid,uint);
$att->clean(p,username,str);
$att->clean(p,posted,str);
$playerinfo=false;
if($att->clean['posted']=='yes'){
if($att->clean['userid']){
$data->set(as_user);
$data->select('*');
$data->where(id,$att->clean['userid']);
$playerinfo=$data->execute(select1);
}else if($att->clean['username']){
$data->set(as_user);
$data->select('*');
$data->where(username,$att->clean['username']);
$playerinfo=$data->execute(select1);
}
$att->required($playerinfo['id']);
$att->buildtemplate(as_admin_edituser_userinfo);
}
$att->clean(p,deleteuser,str);
if($att->clean['deleteuser']==delete){
$att->clean(p,deleteuserid,uint);
$att->required($att->clean['deleteuserid']);
$data->set(as_user);
$data->select('*');
$data->where(id,$att->clean['deleteuserid']);
$playerinfo=$data->execute(select1);
$att->required($playerinfo);
$data->set(as_user);
$data->delete();
$data->where(id,$playerinfo['id']);
$data->execute(delete);
$data->set(as_inventory);
$data->delete();
$data->where(playerid,$playerinfo['id']);
$data->execute(delete);
$att->redirect("$att_filename.php?do=edituser");
}
$att->LoadMain(as_admin_edituser);
$att->navigation("$att_filename.php?do=edituser",'Edit User');
?>
Now, I know the very basics of this page. I know that the information is formated before entering the database via the clean function. I know that the $att variable is caring the information, how eactly I do not know And I know that the $data variable holds the information as it is enterd into the database?
Could someone be kind enough to write this:
PHP Code:
if($att->clean['userid']){
$data->set(as_user);
$data->select('*');
$data->where(id,$att->clean['userid']);
$playerinfo=$data->execute(select1);
}else if($att->clean['username']){
$data->set(as_user);
$data->select('*');
$data->where(username,$att->clean['username']);
$playerinfo=$data->execute(select1);
}
$att->required($playerinfo['id']);
$att->buildtemplate(as_admin_edituser_userinfo);
Into a written explanation as to what it does? I believe each if statement is writing the query' for the data to be entered into the database, while the the last if statments at the bottom of the page enters it. How I do not, could you provide a written eplanation of how this is occuring? Please and thank you.