Пример #1
0
 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     $users = new users();
     $clients = new clients();
     if ($id && $id > 0) {
         $lead = $this->getLead($id);
         $contact = $this->getLeadContact($id);
         $values = array('user' => $contact['email'], 'password' => '', 'firstname' => '', 'lastname' => '', 'phone' => $contact['phone'], 'role' => 3, 'clientId' => $lead['clientId']);
         if (isset($_POST['save'])) {
             if (isset($_POST['user']) && isset($_POST['firstname']) && isset($_POST['lastname'])) {
                 $hasher = new PasswordHash(8, TRUE);
                 $values = array('user' => $_POST['user'], 'password' => $hasher->HashPassword($_POST['password']), 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'clientId' => $_POST['clientId']);
                 if ($users->usernameExist($values['user']) !== true) {
                     $users->addUser($values);
                     $tpl->setNotification('USER_CREATED', 'success');
                 } else {
                     $tpl->setNotification('USERNAME_EXISTS', 'error');
                 }
             } else {
                 $tpl->setNotification('MISSING_FIELDS', 'error');
             }
         }
         $tpl->assign('values', $values);
         $tpl->assign('clients', $clients->getAll());
         $tpl->assign('roles', $users->getRoles());
         $tpl->display('leads.convertToUser');
     } else {
         $tpl->display('general.error');
     }
 }
Пример #2
0
function addUser($user_name, $user_id, $user_pass, $user_type)
{
    include_once "users.php";
    $user = new users();
    if (isset($_REQUEST['user_name']) && isset($_REQUEST['user_id']) && isset($_REQUEST['user_pass']) && isset($_REQUEST['user_type'])) {
        $name = $_REQUEST['user_name'];
        $id = $_REQUEST['user_id'];
        $type = $_REQUEST['user_type'];
        $pass = $_REQUEST['user_pass'];
        if ($user->addUser($name, $id, $pass, $type)) {
            echo '{"result":0, "message": "User succesfully added"}';
        } else {
            echo '{}';
        }
    }
}
Пример #3
0
    public function get()
    {
        $newUser = new users();
        $saveUser = new users();
        $deleteUser = new users();
        $userTables = new users();
        if (isset($_GET["firstname"]) && $_GET["firstname"] != '' && isset($_GET["lastname"]) && $_GET["lastname"] != '' && isset($_GET["email"]) && $_GET["email"] != '') {
            $newUser->addUser($_GET["firstname"], $_GET["lastname"], $_GET["email"]);
        }
        if ($_GET["save"] === "true") {
            $saveUser->updateUser($_GET["email"], $_GET["firstname"], $_GET["lastname"]);
        } elseif ($_GET["delete"] === "true") {
            $deleteUser->deleteUser($_GET["email"]);
        }
        echo ' <head>
			      <style>
				table, th, td {
    					border: 1px solid black;
    					border-collapse: collapse;
				}
				th, td {
    					padding: 15px;
				}
			      </style>
			      </head>
		              <body>
				<table style="width:100%">
  				<tr>
    					<td>Firstname</td>
    					<td>Lastname</td>
    					<td>Email</td>
  					</tr>';
        $userTables->userTable();
        echo '	</table>
				</body>
			';
    }
Пример #4
0
<?php

include "../models/class.config.php";
include "../models/class.users.php";
$user_email = filter_input(INPUT_POST, 'user_email');
$user_password = filter_input(INPUT_POST, 'user_password');
$confirm_password = filter_input(INPUT_POST, 'user_confirm');
#Starts The New User Functions
$users = new users();
$users->addUser($user_email, $user_password);
?>
<script type="text/javascript">window.location.assign('../index.php');</script>
Пример #5
0
<?php

require_once 'libs/settings/config.php';
$vars = ["name" => 'Beanzo', "email" => "*****@*****.**"];
$user = new users($db);
$user2 = new users($secondary_db);
echo $user->addUser($vars);
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo $user2->addUser($vars);
//$redirect = new redirect();
//$redirect->redirect(2);