Esempio n. 1
0
    $contactsNew = new Contacts();
    $contactsNew->setFname($_POST['fname']);
    $contactsNew->setSname($_POST['sname']);
    $contactsNew->setCo_name($_POST['co_name']);
    $contactsNew->setRole($_POST['role']);
    $contactsNew->setCustid($_POST['custid']);
    $contactsNew->setSuppid($_POST['suppid']);
    $contactsNew->setAddsid($addsid);
    $contactsNew->setNotes($_POST['notes']);
    $contactId = $contactsNew->insertIntoDB();
    // Insert into DB
    $pwdNew = new Pwd();
    $pwdNew->setUsr($logon);
    $pwdNew->setContactsid($contactId);
    $pwdNew->setSeclev(100);
    $pwdNew->setPw(mkPwd($pw));
    file_put_contents('/etc/athenace/pwd', "{$_POST['custid']}\t{$_POST['suppid']}\t{$logon}\t{$pw}\n", FILE_APPEND);
    // Dont add to the Password table unless they have a custid or a suppid
    if (isset($_POST['custid']) && $_POST['custid'] > 0 || isset($_POST['suppid']) && $_POST['suppid'] > 0) {
        $pwdNew->insertIntoDB();
    } else {
        // Not adding to passwd table
        // i.e contacts not associated with a customer or supplier cant log in
    }
    $logresult = logEvent(6, $logContent);
    header("Location: /contacts/?Added=" . $result['id']);
    exit;
}
include "../tmpl/header.php";
if (isset($_GET['FromAddCustomer'])) {
    ?>
Esempio n. 2
0
    // Add to Address table
    $addsid = db_addAddress($_POST);
    # Insert into DB
    $staffNew = new Staff();
    $staffNew->setFname($_POST['fname']);
    $staffNew->setSname($_POST['sname']);
    $staffNew->setAddsid($addsid);
    $staffNew->setJobtitle($_POST['jobtitle']);
    $stfid = $staffNew->insertIntoDB();
    $usr = generateStafflogon($_POST['fname'], $_POST['sname']);
    $staffPwd = mkPwd($pw);
    # Insert Pwd into DB
    $pwdNew = new Pwd();
    $pwdNew->setUsr($usr);
    $pwdNew->setStaffid($stfid);
    $pwdNew->setPw($staffPwd);
    $pwdNew->insertIntoDB();
    file_put_contents('/etc/athenace/pwd', "Staff\t{$stfid}\t{$usr}\t{$pw}\n", FILE_APPEND);
    $logresult = logEvent(15, $logContent);
    $done = 1;
}
include "../tmpl/header.php";
if ($done) {
    ?>
<h1>New staff member has been added</h1>
<h2>Write down the password now. It cannot be found anywhere else.</h2>
Username:
<?php 
    echo $usr;
    ?>
<br>
Esempio n. 3
0
        $pwhelp = 'No upper case letters in password';
        $pw_errors[] = 'npw1';
    } elseif (!chkDigit($_POST['npw1'])) {
        $pwhelp = 'No numbers in password';
        $pw_errors[] = 'npw1';
    } elseif ($_POST['npw1'] != $_POST['npw2']) {
        $pwhelp = 'New passwords are not the same';
        $pw_errors[] = 'npw1';
    }
    $stfid = $_POST['stfid'];
    if (empty($pw_errors)) {
        $cryptPwd = mkPwd($_POST['npw1']);
        # Update DB
        $pwdUpdate = new Pwd();
        $pwdUpdate->setUsr($rrt->usr);
        $pwdUpdate->setPw($cryptPwd);
        $result = $pwdUpdate->updateDB();
        $logresult = logEvent(33, $logContent);
        $done = 1;
    }
}
$pagetitle = "staff";
include "../tmpl/header.php";
?>

<h1>Staff Log In</h1>
<?php 
if (isset($done) && $done) {
    echo '<h2 style="color:red;margin-top:40px;margin-left:150px;">The password has been changed</h2>';
} else {
    if ($pwhelp != '') {
Esempio n. 4
0
        $pwhelp = 'No upper case letters in password';
        $errors[] = 'npw1';
    } elseif (!chkDigit($_POST['npw1'])) {
        $pwhelp = 'No numbers in password';
        $errors[] = 'npw1';
    } elseif ($_POST['npw1'] != $_POST['npw2']) {
        $pwhelp = 'New passwords are not the same';
        $errors[] = 'npw1';
    }
    if (empty($errors)) {
        $newPwd = mkPwd($_POST['npw1']);
        $pwdid = getContactPwdID($contactsID);
        // Update DB
        $pwdUpdate = new Pwd();
        $pwdUpdate->setPwdid($pwdid);
        $pwdUpdate->setPw($newPwd);
        $pwdUpdate->updateDB();
        $logresult = logEvent(33, $logContent);
        $token = base64_encode(encrypt($rrt->usr . "|" . $_POST['npw1']));
        header("Location: /pass.php?t={$token}");
    }
}
include "tmpl/header.php";
?>

<ol>
	<li id=subtitle><h3>Your Login Details</h3></li>

	<li><label>Your Username</label> <span style="font-size: 110%; font-weight: bold;"><?php 
echo $rrt->usr;
?>
Esempio n. 5
0
                $pwdUpdate = new Pwd();
                $pwdUpdate->setPwdid($pwdid);
                $pwdUpdate->setPw($dbPwd);
                $pwdUpdate->updateDB();
                $pw_changed++;
            } else {
                $sqltext = "SELECT contactsid FROM contacts,address WHERE email=? AND contacts.addsid=address.addsid";
                $q = $db->select($sqltext, array($email, 's'));
                $r = $q[0];
                if (!empty($q)) {
                    $dbPwd = mkPwd($_POST['pw']);
                    $pwdid = getContactsEmailPwdID($email);
                    // Update DB
                    $pwdUpdate = new Pwd();
                    $pwdUpdate->setPwdid($pwdid);
                    $pwdUpdate->setPw($dbPwd);
                    $pwdUpdate->updateDB();
                    $pw_changed++;
                }
            }
        }
        if ($pw_changed) {
            header("Location: /login.php?pwch=y");
            exit;
        }
    }
}
include "tmpl/header.php";
echo 'Password Request Issued: ' . date('l jS \\of F Y h:i:s A', $prms[0]);
?>
<h2 class="form-signin-heading">Athena Reset Password</h2>