Qlog::log("删除语句:" . $sql_detele);
            Qlog::log("更新语句:" . $sql_update);
            $result1 = $db->query($sql_detele);
            $result2 = $db->query($sql_update);
            if ($result1 && $result2) {
                $info = "操作成功!";
            } else {
                $result = "操作失败!";
                break;
            }
        }
    } else {
        die("无商品选中!");
    }
    $back = $_POST['back'] ? $_POST['back'] : "{$WEB_ROOT}admin/purchase_invoice/purchase_invoice_request_detail_new.php?purchase_invoice_request_id={$purchase_invoice_request_id}";
    alert_back($info, $back);
}
//处理异常发票清单号
if (empty($purchase_invoice_request)) {
    die("发票清单号不正确!");
}
$smarty->assign("purchase_invoice_request", $purchase_invoice_request);
$smarty->assign("added_item_list", $added_item_list);
$smarty->assign('facility_list', facility_list());
//导出csv
$csv = $_REQUEST['csv'];
if ($csv == "csv") {
    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:filename=" . iconv("UTF-8", "GB18030", get_provider_name($provider_id) . "开票清单") . ".csv");
    $out = $smarty->fetch('oukooext/purchase_invoice/purchase_invoice_request_detail_csv_new.htm');
    echo iconv("UTF-8", "GB18030", $out);
Beispiel #2
0
 public function register()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('name', '회사명', 'required|xss_clean');
     $this->form_validation->set_rules('charge_person_name', '담당자', 'required|xss_clean');
     $this->form_validation->set_rules('charge_phone', '휴대전화', 'xss_clean');
     $this->form_validation->set_rules('charge_email', 'E-mail', 'required|xss_clean|valid_email');
     $this->form_validation->set_rules('username', '클라이언트ID', 'required|xss_clean|alpha_dash|is_unique[users
     .username]');
     $this->form_validation->set_rules('user_password', '비밀번호', 'xss_clean|matches[user_password1]');
     $this->form_validation->set_rules('user_password1', '비밀번호 확인', 'xss_clean');
     $this->form_validation->set_rules('site_url', '사이트 주소', 'required|xss_clean');
     $this->form_validation->set_rules('ip_address', '서버 IP address', 'required|xss_clean');
     $this->form_validation->set_rules('mysql_id', 'MySQL ID', 'required|xss_clean');
     $this->form_validation->set_rules('mysql_pass', 'MySQL password', 'required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         $data['contact_id'] = $this->uri->segment(5, 0);
         if ($data['contact_id'] != 0) {
             $data['view'] = $this->client_m->get_contact_view($data['contact_id']);
             preg_match('@^(?:http://)?([^/]+)@i', $data['view']['web_url'], $web_url);
             $data['view']['ip_address'] = gethostbyname($web_url[1]);
             $data['view']['web_url'] = prep_url($web_url[0]);
             preg_match('@^(?:http://)?([^/]+)@i', $data['view']['web_url'], $client_name_preg);
             $client_name = $client_name_preg[1];
             $client_name = str_replace('www.', '', $client_name);
             $client_name = str_replace('.', '', $client_name);
             $data['view']['username'] = $client_name;
             $data['view']['mysql_id'] = $client_name;
             $data['view']['mysql_pass'] = sha1(rand(10000, 99999));
         } else {
             $data['view'] = array();
         }
         $this->load->view('/admin/client/register_v', $data);
     } else {
         $post = $this->input->post(NULL, TRUE);
         require_once 'application/libraries/phpass-0.1/PasswordHash.php';
         $this->load->config('tank_auth', TRUE);
         $hasher = new PasswordHash($this->config->item('phpass_hash_strength', 'tank_auth'), $this->config->item('phpass_hash_portable', 'tank_auth'));
         $user['username'] = $post['username'];
         $user['password'] = $hasher->HashPassword($post['user_password']);
         $user['email'] = $post['charge_email'];
         $user['nickname'] = $post['name'];
         $user['created'] = date('Y-m-d H:i:s');
         $adv['business_file'] = $post['business_images_url'];
         $adv['name'] = $post['name'];
         $adv['business_no'] = $post['business_no'];
         $adv['zip_code'] = $post['zip_code'];
         $adv['address1'] = $post['address1'];
         $adv['address2'] = $post['address2'];
         $adv['charge_person_name'] = $post['charge_person_name'];
         $adv['telephone'] = $post['telephone'];
         $adv['charge_phone'] = $post['charge_phone'];
         $adv['charge_email'] = $post['charge_email'];
         $adv['site_url'] = $post['site_url'];
         $adv['ip_address'] = $post['ip_address'];
         $adv['mysql_id'] = $post['mysql_id'];
         $adv['mysql_pass'] = $post['mysql_pass'];
         $adv['reg_date'] = date('Ymd');
         $post['client_id'] = $user_id = $this->client_m->set_user($user, $adv);
         //echo $user_id;
         if ($user_id) {
             //mysql 유저 생성 및 테이블 권한 주기
             $sql = "GRANT INSERT ON  pushwing.push_wait TO `" . $post['mysql_id'] . "`@`" . $post['ip_address'] . "`\n                IDENTIFIED BY '" . $post['mysql_pass'] . "' WITH GRANT OPTION";
             $this->db->query($sql);
             $sql1 = "FLUSH PRIVILEGES";
             $this->db->query($sql1);
             //contact_id와 연동처리
             if ($post['contact_id'] != 0) {
                 $u_arr = array('check_date' => date("Y-m-d H:i:s"), 'email_date' => date("Y-m-d H:i:s"), 'check_id' => $this->session->userdata['user_id'], 'client_id' => $user_id);
                 $this->db->where('id', $post['contact_id']);
                 $this->db->update('contact', $u_arr);
             }
             //email send
             $this->send_email($post);
             alert('등록되었습니다.', '/admin/client/lists/0/');
         } else {
             alert_back('등록 실패하였습니다.');
         }
     }
 }
<?php
include("config.php");

if( $_POST['username']=="" || $_POST['password']=="")
{
 alert_back('请填写登录信息'); 
}
	 
$username	=$_POST['username'];
$password	=$_POST['password'];

$user_query=$db->prepare("select username from suppliers where username=:username and password=:password");
$user_query->bindValue(':username',$username);
$user_query->bindValue(':password',$password);
$user=$user_query->execute(); 
$data=$user_query->fetch(); 
if(count($data)>1 )
{
	setcookie("username",$username );
	alert_and_reurl('登录成功!','orders.php');
}else
	alert_back('用户名或密码错误'); 
 
 ?>	
include("config.php");	 
$username	=$_POST['username'];
$password	=$_POST['password'];
$email		=$_POST['email'];
$company	=$_POST['company'];
$tel		=$_POST['tel'];
$address	=$_POST['address'];
$info		=$_POST['info']; 
 
 $user_query=$db->prepare("select username from suppliers where username=:username");
 $user_query->bindValue(':username',$username);
 
 $user=$user_query->execute(); 
 $data=$user_query->fetch(); 
if(count($data)>1) 
      alert_back('用户名被使用');

$stmt =$db->prepare("INSERT INTO suppliers (username   ,
 							         password   ,
								     email    	,
				 				     company	,
								     tel		,
								     address	,
								     info		 ) VALUES (
									 :username   ,
									 :password   ,
									 :email    	,
									 :company	,
									 :tel		,
									 :address	,
									 :info		 	)");