/** * Asks user about new country code for given country - if it's different, updates it. * @param eZContentObject $country * @param QuestionInteractiveCli $cli * @return eZContentObject */ function interactiveUpdateCountry( $country, $cli ) { $countryCode = $country->Name; $question = "Specify the new name of the country {$countryCode} (leave empty if the name should not change)"; $countryCode = $cli->askQuestion( $question, array( '/(^$)|(^[a-zA-Z]{2,3}$)/' ), 'validateReplyRegex', false ); if ( $countryCode == '' || $countryCode == $country->Name ) { $countryCode = $country->Name; } else { $country = updateCountry( $country, $countryCode ); } return $country; }
session_start(); is_login(DOCROOT . "admin/login/"); //checking whether admin logged in or not. $countryid = $url_arr[3]; if ($_POST) { $countryname = htmlentities($_POST['countryname'], ENT_QUOTES); $countryid = $_POST['countryid']; $queryString = "select * from coupons_country where countryname = '{$countryname}' and countryid<>{$countryid}"; $resultSet = mysql_query($queryString); if (mysql_num_rows($resultSet) > 0) { set_response_mes(-1, $admin_language['countryexist']); $redirect_url = DOCROOT . 'edit/country/' . $countryid . '/'; url_redirect($redirect_url); } else { updateCountry($countryname, $countryid); set_response_mes(1, $admin_language['changesmodified']); $redirect_url = DOCROOT . 'manage/country/'; url_redirect($redirect_url); } } ?> <script type="text/javascript"> /* validation */ $(document).ready(function(){ $("#form_editcountry").validate();}); </script> <div class="form"> <div class="form_top"></div> <div class="form_cent">
<?php //echo _DIR_; require '../controller/dbsettings.php'; if (isset($_GET['db'])) { $db = $_GET['db']; } else { $db = "facts"; } if (isset($_POST['Submit']) && $_POST['Submit'] == "Submit") { if ($db == "facts") { updateCountry($_POST['country'], $_POST['url']); } else { updateSQL($_POST['id'], $_POST['url']); } } $source = getURL(); //echo "dsf"; //echo $source; function createImageTag($url, $highlight) { return "<img src = {$url} alt = '{$highlight}' onclick = 'check(this)' class = 'imgButton' height = '200' width = '250'>"; } //echo "~".$source."~"; preg_match('/^(.+), (.+)\\n\\[(.+)\\]$/', $source, $nameCapture); //print_r($nameCapture); preg_match_all('/[\'"]?(\\S+)[\'"]?/', $nameCapture[3], $imageCapture); //'/([^,]+)/' captures those ,'s inside the links -.- $outputSource = "<html>\n\t<style>\n\t\t.imgButton{\n\t\t\tcursor: pointer;\n\t\t\talign: center;"; $outputSource .= "\n\t\t}\n\t\t.imgButton:hover{\n\t\t\tborder: 2px solid #ccc\n\t\t}\n\t\t"; $outputSource .= ".cell{\n\t\t\tmin-width: 250;\n\t\t\tmin-height: 200;\n\t\t\talign: center;\n\t\t\tmax-width: 265;";
<?php // insert new user or update it if already exists include_once '../include/headers.php'; include_once '../include/dbutils.php'; include_once '../include/main.php'; include_once 'domain/users.php'; db_connect(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $request_payload = file_get_contents('php://input'); //var_dump($request_payload); $user = json_decode($request_payload); //var_dump($user); if (isset($_GET['acceptNewDispatch'])) { $response = acceptNewDispatch($user); } else { if (isset($_GET['updateCountry'])) { $response = updateCountry($user); } else { $response->successful = addOrUpdateUser($user); } } //return JSON array exit(json_encode($response)); }