function modifyProduct()
{
    $productId = (int) $_GET['productId'];
    $catId = $_POST['cboCategory'];
    $name = $_POST['txtName'];
    $description = $_POST['mtxDescription'];
    $price = str_replace(',', '', $_POST['txtPrice']);
    $qty = $_POST['txtQty'];
    $images = uploadProductImage('fleImage', SRV_ROOT . 'images/product/');
    $mainImage = $images['image'];
    $thumbnail = $images['thumbnail'];
    // if uploading a new image
    // remove old image
    if ($mainImage != '') {
        _deleteImage($productId);
        $mainImage = "'{$mainImage}'";
        $thumbnail = "'{$thumbnail}'";
    } else {
        // if we're not updating the image
        // make sure the old path remain the same
        // in the database
        $mainImage = 'pd_image';
        $thumbnail = 'pd_thumbnail';
    }
    $sql = "UPDATE tbl_product \n\t          SET cat_id = {$catId}, pd_name = '{$name}', pd_description = '{$description}', pd_price = {$price}, \n\t\t\t      pd_qty = {$qty}, pd_image = {$mainImage}, pd_thumbnail = {$thumbnail}\n\t\t\t  WHERE pd_id = {$productId}";
    $result = dbQuery($sql);
    header('Location: index.php');
}
示例#2
0
$phone = '';
$website = '';
$birthday = '';
$image = '';
if (isPostRequest()) {
    // Get post values to populate fields
    $address_group_id = filter_input(INPUT_POST, 'address_group_id');
    $address_id = filter_input(INPUT_POST, 'address_id');
    $fullname = filter_input(INPUT_POST, 'fullname');
    $email = filter_input(INPUT_POST, 'email');
    $address = filter_input(INPUT_POST, 'address');
    $phone = filter_input(INPUT_POST, 'phone');
    $website = filter_input(INPUT_POST, 'website');
    $birthday = filter_input(INPUT_POST, 'birthday');
    $image = filter_input(INPUT_POST, 'upfile');
    $img = uploadProductImage();
    // function to update database
    updateNoImg($address_group_id, $address_id, $user_id, $fullname, $email, $address, $phone, $website, $img);
} else {
    $address_id = filter_input(INPUT_GET, 'address_id');
}
//fill variables from database function
$results = getAddress($address_id, $user_id);
$address_group_id = $results['address_group_id'];
$fullname = $results['fullname'];
$email = $results['email'];
$address = $results['address'];
$phone = $results['phone'];
$website = $results['website'];
$birthday = $results['birthday'];
$image = $results['image'];
示例#3
0
    } elseif (!preg_match($emailOnlyRegex, $email)) {
        $errors[] = 'Please Enter a valid email. (example@email.com)';
    }
    if (isEmptyField($address)) {
        $errors[] = 'Address cannot be blank!';
    }
    if (isEmptyField($phone)) {
        $errors[] = 'Phone cannot be blank!';
    } elseif (!preg_match($validPhoneRegex, $phone)) {
        $errors[] = "Please Enter a valid Phone Number: (XXX)XXX-XXXX";
    }
    if (isEmptyField($birthday)) {
        $errors[] = 'Birthday cannot be blank!';
    }
    if (empty($errors)) {
        $image = uploadProductImage();
        if (createAddress($user_id, $address_group_id, $fullname, $email, $address, $phone, $website, $birthday, $image)) {
            $results[] = 'Address Added';
        } else {
            $results[] = 'Address was not Added';
            var_dump($user_id, $address_group_id);
        }
        //
    }
}
?>
        
        <div class="nav">
            <img class="navimg" src="../images/logo4.png"/>
            <img class="navimgtext" src="../images/ab_text_only.png"/>
            <form action='../sessiondelete.php' method="post">
function doCompleteProfile()
{
    $fname = $_POST['input_fname'];
    $lname = $_POST['input_lname'];
    $pwd = $_POST['input_username'];
    $pwd = $_POST['input_password'];
    $email = $_POST['input_email'];
    $phone = $_POST['phone'];
    $dob = $_POST['dob'];
    $gender = $_POST['gender'];
    $add = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = (int) $_POST['zipcode'];
    //	$accno 	= (int)$_POST['accno'];
    $type = $_POST['acctype'];
    $pin = (int) $_POST['pin'];
    $errorMessage = '';
    $sql = "SELECT fname FROM tbl_users WHERE fname = '{$fname}'";
    $result = dbQuery($sql);
    if (dbNumRows($result) == 1) {
        $errorMessage = 'Username is already exist, please try another name.';
        return $errorMessage;
    }
    //first check if account number is already register or not...
    $accno = rand(9999999999.0, 99999999999.0);
    $accno = strlen($accno) != 10 ? substr($accno, 0, 10) : $accno;
    /*
    $sql = "SELECT acc_no FROM tbl_accounts WHERE acc_no = $accno";
    $result = dbQuery($sql);
    if (dbNumRows($result) == 1) {
    	$errorMessage = 'Account number is already register.';
    	return $errorMessage;
    }
    */
    $images = uploadProductImage('pic', SRV_ROOT . 'images/thumbnails/');
    $thumbnail = $images['thumbnail'];
    $insert_id = 0;
    $sql = "INSERT INTO tbl_users (fname, lname, pwd, email, phone, gender, is_active, utype, pics, bdate)\n\t\t\tVALUES ('{$fname}', '{$lname}', PASSWORD('{$pwd}'), '{$email}', '{$phone}', '{$gender}', 'FALSE', 'USER', '{$thumbnail}', NOW())";
    dbQuery($sql);
    $insert_id = dbInsertId();
    //now create a user address.
    $sql = "INSERT INTO tbl_address (user_id, address, city, state, zipcode, country) \n\t\t\tVALUES ({$insert_id}, '{$add}', '{$city}', '{$state}', {$zip}, 'Bangladesh')";
    dbQuery($sql);
    //and now create a account table entry...
    $sql = "INSERT INTO tbl_accounts (user_id, acc_no, type, balance, pin, status, bdate) \n\t\t\tVALUES ({$insert_id}, {$accno}, '{$type}', 0, {$pin}, 'INACTIVE', NOW())";
    dbQuery($sql);
    //now send email
    //email it now.
    $subject = "Account Registration";
    $to = $email;
    $msg_body = "Dear Customer,<br/><br/>\n\tThis is to inform you that your Account # {$accno} is register successfully with BAMS and currently in Inactive state. We will soon contact you once it get activate.<br/><br/>In case you need any further clarification for the same, please do get in touch with your Home Branch.<br/><br/>\n\tRegards,<br/>Admin, BAMS";
    $mail_data = array('to' => $to, 'sub' => $subject, 'msg' => 'register', 'body' => $msg_body);
    //send_email($mail_data);
    header('Location: aregister.php');
    exit;
}