Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('lib/https.php');
- require_once('lib/common.php');
- Secure();
- error_reporting(E_ALL);
- ini_set('display_errors', true);
- ////////////////////////////////////////
- // Server Side
- $rs = new RecordSet();
- $rs->Connect();
- $subuser_id = '';
- $subuser_name = '';
- $subuser_username = '';
- $subuser_notes = '';
- $subuser_email = '';
- $subuser_reseller_id = '';
- $form_subuser_info = new Form('subuser information');
- //$form_subuser_info->AddElement('', 'user_id', 'hidden', (int)$_REQUEST['user_id']);
- $form_subuser_info->AddElement('Name', 'subuser_name', 'text', $subuser_name);
- $form_subuser_info->AddElement('Email', 'subuser_email', 'text', $subuser_email);
- $form_subuser_info->AddElement('Login Extension', 'subuser_loginid', 'text', $subuser_username);
- $form_subuser_info->AddElement('Password', 'subuser_password', 'password');
- $form_subuser_info->AddElement('Password', 'subuser_password2', 'password');
- $form_subuser_info->AddElement('Notes', 'subuser_notes', 'text', $subuser_notes);
- $form_subuser_info->AddElement('Update', 'submit', 'submit', null, null);
- //$form_subuser_info->AddElement('Update', 'submit', 'okcancel', '', 'window.close();');
- $form_subuser_info->AddRule('subuser_name', 'required');
- $form_subuser_info->AddRule('subuser_email', 'required');
- $form_subuser_info->AddRule('subuser_loginid', 'required');
- $form_subuser_info->SetProcessor('UpdateSettingsForuser');
- function UpdateSettingsForuser($form, $o)
- {
- /*$rs2 = new RecordSet();
- $rs2->Connect();
- $rs2->Open("SELECT * FROM subusers WHERE id='" . (int)$_REQUEST['user_id'] . "'");
- if(!$rs->IsEOF())
- {
- $rs2->edit('subusers');
- $rs2->SetValue('name', $form->GetValue('subuser_name'));
- $rs2->SetValue('email', $form->GetValue('subuser_email'));
- $rs2->SetValue('username', $form->GetValue('subuser_loginid'));
- if(strlen($form->GetValue('subuser_password')) <= 0
- && $form->GetValue('subuser_password') === $form->GetValue('subuser_password')
- && strlen($form->GetValue('subuser_password')) <= 12
- && strlen($form->GetValue('subuser_password')) >= 6)
- {
- //password entered into the form, change password to new password.
- $rs2->SetValue('password', sha1($form->GetValue('subuser_loginid')));
- }
- $rs2->SetValue('notes', $form->GetValue('subuser_notes'));
- //$rs->SetValue('hide_support', $form->GetValue('hide_support') ? true : false);
- $rs2->Update();
- }
- $rs2->Close();*/
- $o->alert("My Settings has been updated.");
- //$o->redirect('subuser_view.php?user_id=' . $form->GetValue('user_id'));
- }
- // Validate that reseller controls this customer
- function ValidateSubuser($user_id)
- {
- $rs4 = new RecordSet();
- $rs4->Connect();
- $rs4->Open("SELECT * FROM subusers WHERE id = '" . (int)$user_id . "' AND reseller_id = '" . (int)$_SESSION['security']['user_id'] . "'");
- if($rs4->IsEof())
- {
- $rs4->Close();
- $rs4->Disconnect();
- return false;
- }
- $rs4->Close();
- $rs4->Disconnect();
- return true;
- }
- ////////////////////////////////////////
- // Client Side
- $onload .= '';
- $onfocus .= '';
- if(ValidateSubuser((int)$_REQUEST['user_id']))
- {
- $rs->Open("SELECT * FROM subusers WHERE id='" . (int)$_REQUEST['user_id'] . "' AND reseller_id = '" . (int)$_SESSION['security']['user_id'] . "'");
- if(!$rs->IsEOF())
- {
- //Pull data from database.
- $subuser_id = $rs->GetValue('id');
- $subuser_name = $rs->GetValue('name');
- $subuser_username = $rs->GetValue('username');
- $subuser_notes = $rs->GetValue('notes');
- $subuser_email = $rs->GetValue('email');
- $subuser_reseller_id = $rs->GetValue('reseller_id');
- //set the form data
- $form_subuser_info->SetValue('user_id', (int)$_REQUEST['user_id']);
- $form_subuser_info->SetValue('subuser_name', $subuser_name);
- $form_subuser_info->SetValue('subuser_email', $subuser_email);
- $form_subuser_info->SetValue('subuser_loginid', $subuser_username);
- $form_subuser_info->SetValue('subuser_notes', $subuser_notes);
- }
- }
- require_once('include/header.php');
- ?>
- <?=$form_subuser_info->GetScript()?>
- <?php echo($form_subuser_info->GetHTML(null, true)); ?>
- <?php require_once('include/footer.php');?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement