/** * @author 张弼 * 循环输出数组 */ function print_arr($arr) { if (is_array($arr)) { echo "{$arr}[<br/>"; while (list($key, $val) = each($arr)) { if (is_array($val)) { echo " "; print_arr($val); } else { echo " " . "{$key} -> {$val}" . ",<br/>"; } } echo " ]<br/>"; } }
<?php include "local.php"; $sf = new scaffold("pedidos_paso"); $sf->open($r->id); $sf->delete(); print_arr(errorobject::errorlist()); echo "ok";
/** * load the user profile from the IDp api client */ function getUserProfile() { // refresh tokens if needed $this->refreshToken(); // ask google api for user infos $response = $this->api->api("https://www.googleapis.com/oauth2/v1/userinfo"); if (!isset($response->id) || isset($response->error)) { throw new Exception("User profile request failed! {$this->providerId} returned an invalid response.", 6); } print_arr($response); $this->user->profile->identifier = property_exists($response, 'id') ? $response->id : ""; $this->user->profile->firstName = property_exists($response, 'given_name') ? $response->given_name : ""; $this->user->profile->lastName = property_exists($response, 'family_name') ? $response->family_name : ""; $this->user->profile->displayName = property_exists($response, 'name') ? $response->name : ""; $this->user->profile->photoURL = property_exists($response, 'picture') ? $response->picture : ""; $this->user->profile->profileURL = "https://profiles.google.com/" . $this->user->profile->identifier; $this->user->profile->gender = property_exists($response, 'gender') ? $response->gender : ""; $this->user->profile->email = property_exists($response, 'email') ? $response->email : ""; $this->user->profile->emailVerified = property_exists($response, 'email') ? $response->email : ""; $this->user->profile->language = property_exists($response, 'locale') ? $response->locale : ""; if (property_exists($response, 'birthday')) { list($birthday_year, $birthday_month, $birthday_day) = explode('-', $response->birthday); $this->user->profile->birthDay = (int) $birthday_day; $this->user->profile->birthMonth = (int) $birthday_month; $this->user->profile->birthYear = (int) $birthday_year; } return $this->user->profile; }
/** * Метод для обновления статусов смс * устанавливает доставку или ошибку доставки смс * @return $this */ function update_status() { $query = "SELECT id_sms, device FROM `sended_sms`\n WHERE ((delivered='0' AND is_error='0') OR sended_sms.sended_to_phone='0')\n AND device IN (" . implode(',', $this->us->get_devices()) . ")"; echo $query; $res = $this->db->super_query($query)->get_res(); //print_arr($res); if (count($res) > 0) { $ids = array(); foreach ($res as $item) { // $ids[$item['device']][] = substr($item['id_sms'], -7);///ПО НЕВЕДОМОЙ ПРИЧИНЕ ПЕРЕД АЙДИ СМС СТОИТ ХРЕНОВА ТУЧА НУЛЕЙ //ВРЕМЕННЫЙ КОСТЫЛЬ. НЕ ЗАБЫТЬ ПЕРЕДЕЛАТЬ!!1 $ids[$item['device']][] = $item[id_sms]; } $out = $this->us->get_out_sms($ids)->get_result(); //print_arr($out); unset($res, $ids); foreach ($this->us->get_devices() as $device) { $ids[deliv] = array(); $ids[error] = array(); $ids[send_to_phone] = array(); $id_send_to_phone =& $ids[send_to_phone]; $id_error =& $ids[error]; $id_deliv =& $ids[deliv]; foreach ($out[$device]['data'] as $value) { if ($value['is_delivered'] == 1) { $id_deliv[] = $value['id']; } else { if ($value['is_error'] == 1 or $value['is_error_send'] == 1) { $id_error[] = $value['id']; } else { if ($value[is_send_to_phone] == 1) { $id_send_to_phone[] = $value[id]; } } } } print_arr($id_send_to_phone); if (count($id_deliv) > 0) { $query = "UPDATE `sended_sms` SET delivered='1'\n WHERE id_sms IN(" . implode(',', $id_deliv) . ") AND device='{$device}'"; $this->db->query($query); } if (count($id_error) > 0) { $query = "UPDATE `sended_sms` SET is_error='1'\n WHERE id_sms IN(" . implode(',', $id_error) . ") AND device='{$device}'"; $this->db->query($query); } if (count($id_send_to_phone) > 0) { $query = "UPDATE `sended_sms` SET sended_to_phone='1'\n WHERE id_sms IN(" . implode(',', $id_send_to_phone) . ") AND device='{$device}'"; $this->db->query($query); } } } return $this; }
$client_id = $resp['INSERT_ID']; } else { $client_id = $client_row[0]['client_id']; } // Check if the vehicle is already available $vehicle_row = db_vehicle_select("", $reg_no); if ($vehicle_row[0]['STATUS'] != 'OK') { echo "Error getting client details for {$client_name}"; exit; } if ($vehicle_row[0]['NROWS'] > 0) { echo "{$reg_no} already present. Continue... \n"; continue; exit; } // Inert the vehicle details $resp = db_vehicle_insert($reg_no, 0, $vehicle_model, "PERMANENT", $sticker_no, "DUMMYRCNO-{$reg_no}", "2099-12-31", "", "", "", "", "", "", "", "", "", "", "", "", "", "", $client_id, "", 1); if ($resp['STATUS'] != 'OK') { echo "Error inserting vehicle for {$reg_no}"; echo print_arr($resp); continue; exit; } $upload_count++; echo "{$reg_no} added successfully \n"; if ($upload_count % 500 == 0) { echo "Sleeping for 5 secs \n"; sleep(5); } } db_transaction_end();
/** * outputs errors while in debug mode and writes them into the error log * * @return NULL */ function process_errors() { global $glb_connection; global $glb_login; if (!is_null($glb_connection) && count($this->errors) > 0) { try { $sql_insert = "INSERT INTO t_log_error\r\n\t\t\t\t\t\t\t\t\t SET log_error_date = :log_error_date,\r\n\t\t\t\t\t\t\t\t\t\t log_error_level = :log_error_level,\r\n\t\t\t\t\t\t\t\t\t\t log_error_message = :log_error_message,\r\n\t\t\t\t\t\t\t\t\t\t log_error_file = :log_error_file,\r\n\t\t\t\t\t\t\t\t\t\t log_error_line = :log_error_line;"; $query_insert = $glb_connection->prepare($sql_insert); foreach ($this->errors as $error) { try { $query_insert->bindValue(':log_error_date', date('Y-m-d H:i:s', $error['log_error_date'])); $query_insert->bindValue(':log_error_level', $error['log_error_level']); $query_insert->bindValue(':log_error_message', $error['log_error_message']); $query_insert->bindValue(':log_error_file', $error['log_error_file']); $query_insert->bindValue(':log_error_line', $error['log_error_line']); $query_insert->execute(); } catch (PDOException $e) { } } } catch (PDOException $e) { } } if (CFG_DEBUG && count($this->errors) > 0) { print_arr($this->errors); } return; }
<?php include 'menu.php'; ?> <p><?php echo $breadcrumbs; ?> </p> <br> <hr> <?php if ($get_one_product) { ?> <?php print_arr($get_one_product); } else { ?> Такого товара нет <?php } ?> <hr> <h3>Отзывы к товару (<?php echo $count_comments; ?> )</h3> <ul class="comments"> <?php
if (count($res) >= 1) { $str2 = preg_replace("/define\\('ENCRYPT_KEY', '(.*)'\\);/", $res[0] . PHP_EOL . "define('COOKIE_KEY', '" . Option::createKey() . "');", $str); } file_put_contents(DATA_PATH . 'Config.php', $str2); } elseif (Option::getConfig('COOKIE_KEY') == 'Please generate key and paste here' || Option::getConfig('COOKIE_KEY') == '') { Option::setConfig('COOKIE_KEY', Option::createKey()); } echo 'Done!' . PHP_EOL; echo 'Now migrating database...' . PHP_EOL; if (PATH_SEPARATOR != ':') { $phinxCommand = ROOT_PATH . 'Package\\bin\\phinx.bat'; } else { $phinxCommand = PHP_BINARY . ' ' . ROOT_PATH . 'Package/robmorgan/phinx/bin/phinx'; } exec($phinxCommand . ' migrate', $return_arr, $return_arr2); print_arr($return_arr); if (stripos($return_arr[count($return_arr) - 1], 'All Done.') === false) { echo colorize(PHP_EOL . PHP_EOL . 'Failed to migrate database, you can try it manually: ', 'WARNING') . colorize('./Package/bin/phinx migrate', 'WARNING') . PHP_EOL; // rollback exec($phinxCommand . ' rollback', $return_arr, $return_arr2); break; } echo 'Now installing resources...' . PHP_EOL; echo 'Deleting old resources... ' . PHP_EOL; echo delDir(ROOT_PATH . 'Public/Resource') ? 'Done.' . PHP_EOL : 'old resources not exist.' . PHP_EOL; echo 'Copying resources...' . PHP_EOL; copyDir(ROOT_PATH . 'Resource', ROOT_PATH . 'Public/Resource'); echo colorize('All done~ Cheers! open site: ' . BASE_URL . 'yourdomain.com/', 'NOTE') . PHP_EOL; break; case 'import-sspanel': // TODO: 从 ss-panel 导入用户数据
ini_set('display_errors', 1); $_SERVER['SERVER_NAME'] = 'SERVER'; $_SERVER['REMOTE_ADDR'] = true; error_reporting(E_ERROR | E_PARSE); define("IGNORE_SWIFT", "true"); $DOMAIN = "script"; require_once '../../lib/swiftmailer/swift_required.php'; include "../../lib/utils.php"; include "../../tConf.php"; include "../../lib/db.php"; db_connect(); // Select vehicle $vehicle_report_select = execSQL("SELECT\n\t\t\t\t\t\t\t\t\t\treg_no,\n\t\t\t\t\t\t\t\t\t\timei,\n\t\t\t\t\t\t\t\t\t\tclient_name,\n\t\t\t\t\t\t\t\t\t\todometer_reading,\n\t\t\t\t\t\t\t\t\t\tfuel_filled,\n\t\t\t\t\t\t\t\t\t\tDATE_FORMAT(created_dt,'%Y-%m-%d %h:%i %p')\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\ttSearch\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\ttravel_id=4 AND\n\t\t\t\t\t\t\t\t\t\tcreated_dt like '" . date("Y-m-d") . "%' AND\n\t\t\t\t\t\t\t\t\t\tfuel_filled <> 0", array(), false); if ($vehicle_report_select[0]['STATUS'] !== 'OK') { echo "Error fetching vehicle "; echo print_arr($vehicle_report_select); exit; } $fp = fopen("megha_report.csv", "w"); $nrows = $vehicle_report_select[0]['NROWS']; unset($vehicle_report_select[0]['NROWS']); unset($vehicle_report_select[0]['STATUS']); $report = "REG NO, IMEI, CLIENT, ODOMETER READING, FUEL FILLED, DATE" . "\r\n"; for ($i = 0; $i < $nrows; $i++) { //echo implode( ',' ,$vehicle_report_select[$i])."\r\n"; $report = $report . implode(',', $vehicle_report_select[$i]) . "\r\n"; } $fp = fwrite($fp, $report); rewind($fp); $attachments_arr = array(); $attachments_arr[0]['filename'] = 'megha_report.csv';
<?php print_arr($_POST); ?> <section id="editor" style="width: 960px;"> <div class="editor"> <div class="editorLeft"> <div class="topControl"> <div id="textEditControl"> <div class="chooseFont"> <select> <option value="Arial" selected>Arial</option> <option value="Tahoma">Tahoma</option> <option value="Verdana">Verdana</option> <option value="Times New Roman">Times New Roman</option> <option value="Helvetica">Helvetica</option> <option value="Comic Sans MS">Comic Sans MS</option> <option value="Courier New">Courier New</option> <option value="Georgia">Georgia</option> <option value="Impact">Impact</option> <option value="Lucida Console">Lucida Console</option> <option value="Palatino Linotype">Palatino Linotype</option> <option value="Trebuchet MS">Trebuchet MS</option> </select> </div> <div class="chooseFontSize"> <select> <option value="8">8</option> <option value="10">10</option>
case 'upload_layout': $editor = true; $bigButtonsMenu = getMenu('big_buttons'); $title = getServiceTitle($layout_alias); if (!$title || $title == NULL) { setSession('error', 'Database error'); } else { unset($_SESSION['error']); } $tiraj = getTiraj($layout_alias); if ($layout_alias == 'vizitki') { $extra = getExtra(); } $paper_types = getPaperTypes(); $layouts = getLayouts(); print_arr($_SESSION); break; //catalog text page //catalog text page case 'textPage': $bigButtonsMenu = getMenu('big_buttons'); $page = getPageContent($catalogView); if (!$page) { $page = ''; } $view = 'textPage'; break; //registration //registration case 'register': if (isset($_POST[''])) {
<?php //defined('ISHOP') or die ('Access denied'); ?> <!--защита от прямого вызова --> <div id="content-order"> <h2>Оформление заказа</h2> <?php //print_arr($_SESSION['card'][1]); if (isset($_SESSION['order']['res'])) { print_arr($_SESSION['order']['res']); } ?> <?php if ($_SESSION['card']) { //проверка корзины на наличие товаров ?> <!--<div id="ajax">--> <table id="ajax" class="order-main-table" border="0" cellpadding="0" cellspacing="0"> <form method="post" action=""> <tr> <td class="z-top"> наименование</td> <td class="z-top" align="center">количество</td> <td class="z-top" align="center">стоимость</td> <td class="z-top" align="center"> </td> </tr> <?php foreach ($_SESSION['card'] as $key => $value) { ?> <tr>
// PDO::FETCH_NUM // $sql = "SELECT `eng` FROM `words` LIMIT 5"; // $stmt = $pdo->query($sql) ; // $data = $stmt->fetchAll(); // Получение объекта // $data = $stmt->fetchAll(PDO::FETCH_OBJ); // $obj = $data[4]; // echo $obj->eng; // var_dump($data); //PDO Like // $sql = "SELECT * FROM `words` WHERE `eng` LIKE ?"; // $str = '%fore%'; // $stmt = $pdo->prepare($sql); // $stmt->execute(array($str)); // $data = $stmt->fetchAll(PDO::FETCH_ASSOC); //PDO LIMIT // $limit = 5; // $sql = "SELECT * FROM `words` LIMIT ?"; // $stmt = $pdo->prepare($sql); // $stmt->bindValue(1, $limit, PDO::PARAM_INT); // $stmt->execute(); // $data = $stmt->fetchAll(); //PDO IN $ids = array(2, 4, 9); $in = str_repeat('?,', count($ids) - 1) . '?'; $sql = "SELECT * FROM `words` WHERE `id` IN({$in})"; $stmt = $pdo->prepare($sql); $stmt->execute($ids); $data = $stmt->fetchAll(); print_arr($data);
function createAd($propertyInfo, $imgs, &$finalised) { // download imgs $dir = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testDownload/"; $imgUrls = array(); downloadAll($imgs, $dir, $imgUrls); // print_arr ($imgUrls); // resize them $resizedUrls = array(); resizeAll($imgs, $propertyInfo['agency_localDir'], $resizedUrls); // print_arr ($resizedUrls); $templateDir = array(); $templateDirWeb = array(); makeTemplateDir($propertyInfo, $templateDir, $templateDirWeb); // put templates into imgs $jsonObject = get_json_object($propertyInfo['agency_localDir']); $dest = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testFinal/"; $finalised[0] = "/api/assets/testFinal/" . "0.jpg"; $finalised[1] = "/api/assets/testFinal/" . "00.jpg"; finaliseMainAdItem($propertyInfo, $jsonObject, $dest, $resizedUrls[0]); allocateLogo($resizedUrls, $jsonObject, $dest, $templateDir, $finalised); print_arr($finalised); foreach ($finalised as $oup) { echo "<img src='" . $oup . "' />" . "<br />" . "<br />"; } }
function print_arr($arr) { echo "<table class=\"print_arr\">"; foreach ($arr as $k => $v) { echo "<tr>\n\t\t\t\t<td class=\"print_arr_field\">\n\t\t\t\t" . $k . "</td>\n\t\t\t\t<td class=\"print_arr_value\">\n\t\t\t\t"; if (is_array($v) || is_object($v)) { print_arr($v); } else { echo "<b>" . $v . "</b>"; } echo "\n\t\t\t\t</td>\n\t\t\t\t</tr>"; } echo "</table>"; }