ruạṛ
<?php /** * Manage stockist * @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'; require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/display.php'; $connID = connect_to_db(); /** * define variables to be passed to header function * @var string $current section of site for navigation menu highlighting * @var string $title page title for browser * @var string $keywords meta keywords * @var string $keywords meta description */ $current = 'stockists'; $title = 'Administration Panel'; $keywords = ''; $description = ''; /** * buffer then output page */ ob_start(); head($current,$title); this_page(); footer(); ob_end_flush(); /** * clean up and exit script */ exit; /** * function to display content specific to this page * @global int $cust_id */ function this_page() { /** * @todo document */ if(!$stockist_id = is_numeric_id($_GET['stockist'],false)) { $stockist = new stockist; if(isset($_SESSION['passback'])) { $stockist->load_from_data($_SESSION['passback']); } $button = $h1 = 'Add stockist'; $action = 'processes/process-stockist-new.php'; $new = true; } else { $stockist = new stockist($stockist_id); //print_r($stockist); if(!$stockist->stockist_id) { echo '<p class="center">Stockist not found.</p>'; return; } $action = 'processes/process-stockist-edit.php'; $button = 'Update stockist'; $h1 = 'Edit '.$stockist->name; } $regions = mysql_query("select * from stockist_regions order by order_id desc, region_name"); $region_select = ''; if($regions && mysql_num_rows($regions)>0) { $region_select = '<select name="region" id="region"> '; while($r = mysql_fetch_assoc($regions)) { $region_select .= '<option value="'.$r['region_id'].'"'; $region_select .= ($r['region_id']==$stockist->region_id) ? ' selected="selected"' : ''; $region_select .= '>'.$r['region_name'].'</option> '; } $region_select .=' </select>'; } ?> <h1><?php echo $h1; ?></h1> <form method="post" action="<?php echo $action; ?>" name="stockist_edit" id="stockist_edit" enctype="multipart/form-data" class="edit"> <input name="stockist_id" id="stockist_id" type="hidden" value="<?php echo $stockist->stockist_id; ?>" /> <div class="mock_table"> <label for="stockist_name"><span class="right">Business name:</span><span class="left"><input name="stockist_name" id="stockist_name" type="text" value="<?php echo $stockist->name; ?>" /></span></label> <label for="region"> <span class="right">Region:</span> <span class="left"><?php echo ($region_select) ? $region_select : 'Define regions from the Stockist page'; ?></span> </label> <label for="address"> <span class="right">Address:</span> <span class="left"><textarea name="address" id="address"><?php echo $stockist->address; ?></textarea></span> </label> <label for="phone"><span class="right">Phone:</span><span class="left"><input name="phone" id="phone" type="text" value="<?php echo $stockist->phone; ?>" /></span></label> <label for="website"><span class="right">Website:</span><span class="left">http://<input name="website" id="website" type="text" value="<?php echo $stockist->website; ?>" /></span></label> <label for="map"><span class="right">Map code:</span><span class="left"><textarea name="map_code" id="map_code" cols="40" rows="10"><?php echo $stockist->map_code; ?></textarea></span></label> <p> </p> </div> <!-- end mock_table --> <p class="center"> <input name="submit" id="submit" type="submit" value="<?php echo $button; ?>" /> </p> </form> <p> </p> <?php } ?>
cải xoăn