%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/riacommer/domains/gasworld.com.my/private_html/admin/api/
Upload File :
Create Path :
Current File : /home/riacommer/domains/gasworld.com.my/private_html/admin/api/so.php

<?php
//error_reporting(-1); //report all error!
include_once("security.php");
include_once("db.php");

//customer id
$customerid='';

//billing
$firstname = '';
$lastname = '';
$contactno = '';
$company = '';
$address1 = '';
$address2 = '';
$address3 = '';
$city = '';
$postcode = '';
$country = '';
$state = '';
//shipping
$ship_firstname = '';
$ship_lastname = '';
$ship_contactno = '';
$ship_company = '';
$ship_address1 = '';
$ship_address2 = '';
$ship_address3 = '';
$ship_city = '';
$ship_postcode = '';
$ship_country = '';
$ship_state = '';
//others...
$status='';
$remarks='';

//for delete only
if(isset($_GET["id"])){
	if($_GET["id"]!=""){
		$id = $_GET["id"];
		$sql = "DELETE FROM sa_so WHERE id='$id'";
		mysql_query($sql);
		$sql = "DELETE FROM sa_so_product WHERE soid='$id'";
		mysql_query($sql);
		header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/so.php");
	} else {
		header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/400.php");
	}
} else {
//for create, update
if(isset($_POST["act"])){
	$act = trim($_POST["act"]);

//customer id
$customerid = $_POST["customerid"];

//billing
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$contactno = $_POST["contactno"];
$company = $_POST["company"];
$address1 = $_POST["address1"];
$address2 = $_POST["address2"];
$address3 = $_POST["address3"];
$city = $_POST["city"];
$postcode = $_POST["postcode"];
$country = $_POST["country"];
$state = $_POST["state"];
//shipping
$ship_firstname = $_POST["ship_firstname"];
$ship_lastname = $_POST["ship_lastname"];
$ship_contactno = $_POST["ship_contactno"];
$ship_company = $_POST["ship_company"];
$ship_address1 = $_POST["ship_address1"];
$ship_address2 = $_POST["ship_address2"];
$ship_address3 = $_POST["ship_address3"];
$ship_city = $_POST["ship_city"];
$ship_postcode = $_POST["ship_postcode"];
$ship_country = $_POST["ship_country"];
$ship_state = $_POST["ship_state"];
//others...
$status=$_POST["status"];
$remarks=$_POST["remarks"];
	
	if($act=="update"){
		$id = trim($_POST["id"]);
		
		$sql = "UPDATE sa_member SET name='$firstname', lname='$lastname', mobile='$contactno', company='$company', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', postcode='$postcode', country='$country' WHERE id=$customerid";
		mysql_query($sql);
		
		$sql = "UPDATE sa_so SET sname='$ship_firstname', slname='$ship_lastname', scontact='$ship_contactno', scompany='$ship_company', saddress='$ship_address1', saddress2='$ship_address2', saddress3='$ship_address3', scity='$ship_city', spostcode='$ship_postcode', sstate='$ship_state', scountry='$ship_country', status='$status', remarks='$remarks' WHERE id='$id'";		
		mysql_query($sql);
		
		header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/so.php");
	
	} else {
		header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/400.php");
	}
}}
?>

Zerion Mini Shell 1.0