91 lines
3.0 KiB
PHP
91 lines
3.0 KiB
PHP
<?PHP
|
|
|
|
if (!$_POST){ header('Location: '.$site_url); }
|
|
|
|
/*
|
|
|
|
FIELD NAMES:
|
|
account_id
|
|
account_user_id_fk
|
|
account_advertiser
|
|
account_contact
|
|
account_phone
|
|
account_email
|
|
account_other
|
|
account_invoice
|
|
account_notes
|
|
|
|
*/
|
|
|
|
/* Need to ltrim and rtrim commas before insertion */
|
|
|
|
//Insert into database
|
|
//$pass = 'abc123';
|
|
$errmsg = NULL;
|
|
$insert_success = NULL;
|
|
//Check for blank fields
|
|
if ((!$_POST[account_advertiser])) $errmsg = $errmsg."Account Name, ";
|
|
if ((!$_POST[account_contact])) $errmsg = $errmsg."Primary Contact, ";
|
|
if ((!$_POST[account_user_id_fk])) $errmsg = $errmsg."Forum ID #, ";
|
|
if (!$_POST[account_city]) $errmsg = $errmsg."City, ";
|
|
if (!$_POST[account_state]) $errmsg = $errmsg."State, ";
|
|
if (!$_POST[account_address]) $errmsg = $errmsg."Address, ";
|
|
if (!$_POST[account_phone]) $errmsg = $errmsg."Phone, ";
|
|
if (!$_POST[account_email]) $errmsg = $errmsg."Email, ";
|
|
if (!$_POST[account_invoice]) $errmsg = $errmsg."Invoice, ";
|
|
if (isset($errmsg)) {
|
|
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
|
|
$errmsg = rtrim($errmsg, ", ");
|
|
}
|
|
|
|
|
|
// begin error message check
|
|
if(!$errmsg){
|
|
|
|
$account_id = $_POST[account_id];
|
|
$account_advertiser = trim($_POST[account_advertiser]);
|
|
$account_contact = trim($_POST[account_contact]);
|
|
$account_user_id_fk = trim($_POST[account_user_id_fk]);
|
|
$account_address = mysql_escape_string(trim($_POST[account_address]));
|
|
if (isset($_POST['account_address_two'])) { $account_address_two = mysql_escape_string(trim($_POST[account_address_two])); } else { $account_address_two = NULL; }
|
|
$account_city = mysql_escape_string(trim($_POST[account_city]));
|
|
$account_state = $_POST[account_state];
|
|
$account_state_tag = strtolower(str_replace(" ","", $account_state));
|
|
$account_zip = mysql_escape_string(trim($_POST[account_zip]));
|
|
$account_phone = trim($_POST[account_phone]);
|
|
$account_email = mysql_escape_string(trim($_POST[account_email]));
|
|
$account_other = mysql_escape_string(trim($_POST[account_other]));
|
|
$account_invoice = mysql_escape_string($_POST[account_invoice]);
|
|
$account_notes = mysql_escape_string(nl2br(substr(trim($_POST[account_notes]), 0, 4096)));
|
|
|
|
// begin boolean check to see if we should insert the account into the dbase
|
|
if($_POST[insert_account] == true){
|
|
$sql = "UPDATE io_account SET
|
|
account_advertiser = '$account_advertiser',
|
|
account_user_id_fk = '$account_user_id_fk',
|
|
account_contact = '$account_contact',
|
|
account_address = '$account_address',
|
|
account_address_two = '$account_address_two',
|
|
account_city = '$account_city',
|
|
account_state = '$account_state',
|
|
account_zip = '$account_zip',
|
|
account_phone = '$account_phone',
|
|
account_email = '$account_email',
|
|
account_other = '$account_other',
|
|
account_invoice = '$account_invoice',
|
|
account_notes = '$account_notes'
|
|
WHERE account_id = $account_id";
|
|
//echo("account entered!");
|
|
//echo($sql);
|
|
mysql_query($sql) OR die(mysql_error());
|
|
//exit();
|
|
$insert_success = true;
|
|
}else{
|
|
//echo("shop NOT entered.");
|
|
$confirm_account = true;
|
|
}
|
|
// end insert check
|
|
}
|
|
// end error message check
|
|
|
|
?>
|