ruạṛ
<?php /** * Update stockist in the database * @version 0.9 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS */ session_start(); require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/universal.php'; $connID = connect_to_db(); /** * get cleaned values */ //extract(get_form($whitelist,'POST',false)); $n = new stockist(clean_plain_data($_POST['stockist_id'])); $n->name = clean_plain_data($_POST['stockist_name']); $n->region_id = is_numeric_id($_POST['region'],false); $n->address = clean_plain_data($_POST['address']); $n->phone = clean_plain_data($_POST['phone']); $n->website = clean_plain_data($_POST['website']); $n->map_code = clean_html_data($_POST['map_code']); /** * validate stockist_id */ if(!is_numeric_id($n->stockist_id, false)) { getout('Invalid stockist ID','stockists.php'); exit; } /** * validation * @var string $message */ $message = ''; if($n->name == '') { $message .= 'Please enter a business name.<br />'; } if(!$n->region_id) { $message .= 'Please select a region.<br />'; } if($message != '') { getout($message); exit; } /* * update record */ if(!$n->update()) { getout('There was an error updating the stockist. Please try again.'); exit; } /** * clean up and exit script */ getout('Stockist updated successfully'); exit; ?>
cải xoăn