D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
insert_company_profile.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $company_name = addslashes(stripslashes($_POST['company_name'])); $file_name = ""; $sign_name = ""; if(isset($_FILES['image'])){ $file_name = $_FILES['image']['name']; $temp = explode(".", $_FILES["image"]["name"]); $extension = end($temp); $result1 = preg_replace("/[^a-zA-Z0-9]+/", "", $company_name); $file_name = $result1."_".date("Ymdhis").".".$extension; $file_tmp =$_FILES['image']['tmp_name']; move_uploaded_file($file_tmp,"images/".$file_name); } if(isset($_FILES['signature'])){ $sign_name = $_FILES['signature']['name']; $temp = explode(".", $_FILES["signature"]["name"]); $extension = end($temp); $result1 = preg_replace("/[^a-zA-Z0-9]+/", "", $company_name); $sign_name = $result1."_".date("Ymdhis").".".$extension; $sign_tmp =$_FILES['signature']['tmp_name']; move_uploaded_file($sign_tmp,"signature/".$sign_name); } $id = $_POST["id"]; $pass = md5($_POST["actionKey"]); $gstin = addslashes(stripslashes($_POST['gstin'])); $phone = addslashes(stripslashes($_POST['phone'])); $reference = addslashes(stripslashes($_POST['reference'])); $address = addslashes(stripslashes($_POST['address'])); $city = addslashes(stripslashes($_POST['city'])); $state = addslashes(stripslashes($_POST['state'])); $country = addslashes(stripslashes($_POST['country'])); $account_name = addslashes(stripslashes($_POST['account_name'])); $account_no = addslashes(stripslashes($_POST['account_no'])); $bank_name = addslashes(stripslashes($_POST['bank_name'])); $ifsc = addslashes(stripslashes($_POST['ifsc'])); $shift = addslashes(stripslashes($_POST['shift'])); $branch = addslashes(stripslashes($_POST['branch'])); $company_color = $_POST['company_color']; $currency = addslashes(stripslashes($_POST['currency'])); $invoice_prifix = addslashes(stripslashes($_POST['invoice_prifix'])); $default_invoice = addslashes(stripslashes($_POST['default_invoice'])); $sql = "INSERT INTO company_details(company_name, company_logo, GSTIN, phone, email, address, city, state, country, account_name, account_no, bank_name, ifsc, shift, branch, company_color, currency, invoice_prifix, default_invoice, signature) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("ssssssssssssssssssss", $company_name, $file_name, $gstin, $phone, $reference, $address,$city, $state, $country, $account_name, $account_no, $bank_name, $ifsc, $shift, $branch, $company_color, $currency, $invoice_prifix, $default_invoice, $sign_name); $result = $stmt->execute(); $insertedId = $stmt->insert_id; if ($result) { $isDelete = 'no'; $name = 'Admin'; $sql = "INSERT INTO login_admin(email, password, name, data_delete, source_id) VALUES (?, ?, ?, ?, ?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("ssssi", $reference, $pass, $name, $isDelete, $insertedId); $stmt->execute(); $on = "on"; $sql = "INSERT INTO user_permission(user_email, source_id, contact_view, contact_add, contact_edit, contact_delete, inventory_view, inventory_add, inventory_edit, inventory_delete, finance_view, finance_add, finance_edit, finance_delete, general_view, general_add, general_edit, general_delete, user_view, user_add, user_edit, user_delete) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("sissssssssssssssssssss", $reference, $insertedId, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on, $on); $stmt->execute(); $sql = "DELETE FROM sign_up WHERE email = ? AND id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("si", $reference, $id); $stmt->execute(); echo '<script>localStorage.setItem("ProfileCreated", "true");</script>'; echo '<script>location.replace("index.php")</script>'; } else { echo "Error: " . $sql . "<br>" . $conn->error; } ?>