/** * non-OO logging function ported from CW * * For CW logging. * * @param $msg */ function logThis($msg) { $logFile = getConfigValue('log', 'logfile'); if ($logFile) { // it's configured so let's write to it. ("3" means append to a specific file) $formattedMsg = "\n" . microDateTime() . ' ' . $msg; error_log($formattedMsg, 3, $logFile); } }
function _send($to, $subject, $message) { $from = getConfigValue("email_from"); $this->CI->email->set_mailtype("html"); $this->CI->email->from($from); $this->CI->email->to($from); $this->CI->email->subject($subject); $this->CI->email->message($message); $this->CI->email->send(); }
public function upload($blobRestProxy, $container, $filePath) { $this->md5 = md5_file($filePath); //Get file hash $this->name = generateRandomString(); //Generate file blob name $this->url = 'https://' . getConfigValue('azure_storage_account') . '.blob.core.windows.net/' . $container . '/' . $this->name; //Get Azure blob URL $this->fileHandle = fopen($filePath, 'r'); $blobRestProxy->createBlockBlob($container, $this->name, $this->fileHandle); //Upload blob to Azure Blob Service }
/** * Constructor takes a PCML string and converts to an array-based new toolkit parameter array. * * @param string $pcml The string of PCML * @param ToolkitService $connection connection object for toolkit * @param array $countersAndCounted * @throws \Exception */ public function __construct($pcml, ToolkitService $connection, $countersAndCounted = array()) { $this->setConnection($connection); $this->setCountersAndCounted($countersAndCounted); // Convert PCML from ANSI format (which old toolkit required) to UTF-8 (which SimpleXML requires). $encoding = getConfigValue('system', 'encoding', 'ISO-8859-1'); // XML encoding /* * Look for optionally set <?xml encoding attribute * and change encoding if attribute is set and not UTF-8 * or change encoding if attribute is not set and ini encoding is not UTF-8 */ $pcml = trim($pcml); $matches = array(); $regex = '/^<\\?xml\\s.*?encoding=["\']([^"\']+)["\'].*?\\?>/is'; if (preg_match($regex, $pcml, $matches) && $matches[1] != 'UTF-8') { //remove xml-tag $pcml = substr($pcml, strlen($matches[0])); $pcml = mb_convert_encoding($pcml, 'UTF-8', $matches[1]); } elseif ($encoding != 'UTF-8') { $pcml = mb_convert_encoding($pcml, 'UTF-8', $encoding); } //program name is stored as: /pcml/program name="/qsys.lib/eacdemo.lib/teststruc.pgm" $xmlObj = new \SimpleXMLElement($pcml); // get root node and make sure it's named 'pcml' if (!isset($xmlObj[0]) || $xmlObj[0]->getName() != 'pcml') { throw new \Exception("PCML file must contain pcml tag"); } $pcmlObj = $xmlObj[0]; // get program name, path, etc. if (!isset($pcmlObj->program) || !$pcmlObj->program) { throw new \Exception("PCML file must contain program tag"); } /** * sample: * <program name="name" * [ entrypoint="entry-point-name" ] * [ epccsid="ccsid" ] * [ path="path-name" ] * [ parseorder="name-list" ] * [ returnvalue="{ void | integer }" ] * [ threadsafe="{ true | false }" ]> * </program> */ // Now create data description array. // @todo create separate method to convert PCML to param array. $dataDescriptionArray = $this->pcmlToArray($xmlObj); //Change the encoding back to the one wanted by the user, since SimpleXML encodes its output always in UTF-8 mb_convert_variables($encoding, 'UTF-8', $dataDescriptionArray); $this->_description = $dataDescriptionArray; }
function stream($video = "") { /* //aktuellen titel finden $currentTrack = count($this->playlist)-1; while(($currentTime < $this->playlist[$currentTrack]['starttime']) && ($currentTrack>0)){ $currentTrack--; } //aktuelle sekunde des aktuellen titels herausfinden //aktuelle zeit - startzeit = laufzeit //laufzeit mod tracklänge = aktuelle position $runtime = $currentTime-$this->playlist[$currentTrack]['starttime']; $currentSecond = fmod($runtime,count($this->keyframecache->cache[$currentTrack])); $timeToRun = -1; //restlaufzeit für diesen titel berechnen if ((count($this->playlist)-1)>$currentTrack){ $timeToRun = $this->playlist[$currentTrack+1]['starttime']-$currentTime; } $flv = new CustomFLV($this->getFLVFileName($this->playlist[$currentTrack]['filename'])); $flv->setBrowserCaching(false); $flv->playFlv(1,$this->keyframecache->cache[$currentTrack][$currentSecond]); */ if ($video == "") { $this->getPlaylistEntry($video, $nextVideoName, $nextVideoStartTime); } // $fh = fopen('./tmp/test.log',w); // fwrite($fh,strtotime("now").': Playing '.getConfigValue('videopath').$video); // fclose($fh); // // header("Content-Disposition: filename=".basename($video)); // header("Content-Type: video/x-flv"); // header("Content-Length: " .(string)filesize(getConfigValue('videopath').$video)); // // $fh = fopen(getConfigValue('videopath').$video,r); // while (!feof($fh)){ // print(fread($fh, 1024)); // } // fclose($fh); $flv = new CustomFLV(getConfigValue('videopath') . $video); //$flv->setBrowserCaching(false); $flv->playFlv(); }
public function purchase() { $data['page_limit'] = getConfigValue('default_pagination'); $page_limit = $data['page_limit']; $data['limit'] = !$this->input->post('limit') ? $this->input->get('limit') ? $this->input->get('limit') : $page_limit : $this->input->post('limit'); $data['purchaselist'] = $this->points_model->get_all_purchases(); $config['total_rows'] = count($data['purchaselist']); $config['per_page'] = $data['limit'] == 'all' ? $config['total_rows'] : $data['limit']; $this->db->limit($config['per_page'], $_REQUEST['per_page']); //$data['userlist']=$this->points_model->get_all(); $params = '?t=1'; if ($data['limit'] != '') { $params .= '&limit=' . $data['limit']; } $this->load->library('pagination'); $config['base_url'] = site_url("admin/points/purchase") . "/" . $params; //-------------------------------------------------- // load pagination class $config['page_query_string'] = TRUE; $config['first_link'] = 'First'; $config['last_link'] = 'Last'; $config['full_tag_open'] = "<ul class='pagination'>"; $config['full_tag_close'] = "</ul>"; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>"; $config['cur_tag_close'] = "<span class='sr-only'></span></a></li>"; $config['next_tag_open'] = "<li>"; $config['next_tagl_close'] = "</li>"; $config['prev_tag_open'] = "<li>"; $config['prev_tagl_close'] = "</li>"; $config['first_tag_open'] = "<li>"; $config['first_tagl_close'] = "</li>"; $config['last_tag_open'] = "<li>"; $config['last_tagl_close'] = "</li>"; $data['page'] = $_REQUEST['per_page']; $this->pagination->initialize($config); //---------------------------------------------------------- //$output['output']=$this->showList($baseurl,count($data['userlist']),$data['userlist']); //print_r($output['output']);exit; //echo $this->points_model->db->last_query();exit; //echo "<pre>"; print_r($data['userlist']); echo "</pre>"; exit; $output['output'] = $this->load->view('admin/points/purchaselists', $data, true); $this->_render_output($output); }
public function lists() { $data['startDate'] = !$this->input->post('startDate') ? $this->input->get('startDate') ? $this->input->get('startDate') : date('Y-m-d') : $this->input->post('startDate'); $data['endDate'] = !$this->input->post('endDate') ? $this->input->get('endDate') ? $this->input->get('endDate') : date('Y-m-d') : $this->input->post('endDate'); $data['limit'] = !$this->input->post('limit') ? $this->input->get('limit') ? $this->input->get('limit') : $page_limit : $this->input->post('limit'); //$data['availablelist']=$this->availability_model->get_all_availability(); $data['availablelistBydate'] = $this->availability_model->getAvailabilityByDate($data['startDate'], $data['endDate']); $data['todayMatches'] = $this->availability_model->getMatchHistoryByMatchlog($data['startDate'], $data['endDate']); //echo "<pre>"; print_r($data['availablelistBydate']); echo "</pre>"; exit; $config['total_rows'] = count($data['availablelistBydate']); $config['per_page'] = getConfigValue('default_pagination'); $this->db->limit($config['per_page'], $_REQUEST['per_page']); $params = '?t=1'; // $this->load->library('pagination'); // $config['base_url'] = site_url("admin/availability/lists")."/".$params; // load pagination class /* $config['page_query_string'] = TRUE; $config['first_link'] = 'First'; $config['last_link'] = 'Last'; $config['full_tag_open'] = "<ul class='pagination'>"; $config['full_tag_close'] ="</ul>"; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>"; $config['cur_tag_close'] = "<span class='sr-only'></span></a></li>"; $config['next_tag_open'] = "<li>"; $config['next_tagl_close'] = "</li>"; $config['prev_tag_open'] = "<li>"; $config['prev_tagl_close'] = "</li>"; $config['first_tag_open'] = "<li>"; $config['first_tagl_close'] = "</li>"; $config['last_tag_open'] = "<li>"; $config['last_tagl_close'] = "</li>"; $data['page'] = $_REQUEST['per_page']; $this->pagination->initialize($config); */ //echo $this->availability_model->db->last_query();exit; //echo "<pre>"; print_r($data['userlist']); echo "</pre>"; exit; $output['output'] = $this->load->view('admin/availability/lists', $data, true); $this->_render_output($output); }
function checkConfigs() { // There you can add new config checks to your bot interface global $lang; $errors = 0; // Global Config Checker if (!preg_match('/[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/', getConfigValue('connection', 'server_ip'))) { echo "\n" . $lang->getLanguage('MNG_ERROR') . " " . $lang->getLanguage('NOT_VALID_IP') . "\n"; $errors++; } if (!is_numeric(getConfigValue('connection', 'server_query_port')) || !strlen(getConfigValue('connection', 'server_query_port')) > 5) { echo "\n" . $lang->getLanguage('MNG_ERROR') . " " . $lang->getLanguage('NOT_VALID_PORT') . "\n"; $errors++; } if (!is_numeric(getConfigValue('connection', 'server_id'))) { echo "\n" . $lang->getLanguage('MNG_ERROR') . " " . $lang->getLanguage('NOD_VALID_ID') . "\n"; $errors++; } if ($errors > 0) { exit; } return true; }
Author URI: http://www.softsprings.de Version: 0.17 Updated: 11/12/2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ require_once 'config_inc.php'; require_once getConfigValue('rootpath') . '/shared/flv4php/FLV.php'; // Path to flv.php / (flv4php) class CustomFLV extends FLV { /* Get Flv Thumb output's a thumb clip from offset point, locate a key frame and from there output's duration * if no key frame is found it use the first key frame. * * @param int $offset Offset in ms * @param bool $usemetadata Use metadata to attempt to find first keyframe * * @return int fileposition of the next frame */ function getFramePosition($offset = 0, $usemetadata = true) { session_write_close(); $this->start();
license@systemsmanager.net so we can mail you a copy immediately. */ /* Common Elements For Tabs - BEGIN */ $commonCancelButton = $jQuery->getPluginClass('button', array('id' => 'cancel_button', 'text' => 'Cancel')); $commonSaveButton = $jQuery->getPluginClass('button', array('id' => 'save_button', 'type' => 'submit', 'text' => 'Save')); /* Common Elements For Tabs - END */ /* Configuration Grid Setup - BEGIN */ if ($store_id == 1) { $filter = ' and (store_id = "' . (int) $store_id . '" or store_id = "0")'; } else { $filter = ' and store_id = "' . (int) $store_id . '"'; } $configuration_query = smn_db_query("select configuration_id, configuration_title, configuration_value, configuration_group_id from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int) $gID . "'" . $filter . " order by sort_order"); $configGridData = array(); while ($configuration = smn_db_fetch_array($configuration_query)) { $configGridData[] = array('configuration_id' => $configuration['configuration_id'], 'configuration_group_id' => $configuration['configuration_group_id'], 'configuration_title' => $configuration['configuration_title'], 'configuration_value' => getConfigValue($configuration['configuration_group_id'], $configuration['configuration_id'])); } $configGridEditButton = $jQuery->getPluginClass('button', array('id' => 'editButton', 'text' => 'Edit Selected')); $configGridHelpButton = $jQuery->getPluginClass('button', array('id' => 'helpButton', 'text' => 'Help')); $configGrid = $jQuery->getPluginClass('basicgrid', array('id' => 'configGrid', 'sortName' => 'configuration_title', 'paging' => true, 'page_size' => 20, 'columns' => array(array('id' => 'configuration_id', 'text' => 'cID', 'hidden' => true), array('id' => 'configuration_group_id', 'text' => 'gID', 'hidden' => true), array('id' => 'configuration_title', 'text' => TABLE_HEADING_CONFIGURATION_TITLE), array('id' => 'configuration_value', 'text' => TABLE_HEADING_CONFIGURATION_VALUE)), 'data' => $configGridData, 'buttons' => array($configGridEditButton, $configGridHelpButton))); /* Configuration Grid Setup - END */ /* Configuration Grid Delete Window Setup - BEGIN */ $configEditWindow = $jQuery->getStandAloneClass('box_window', array('id' => 'div_configuration_edit', 'form' => '<form id="configEditForm" action="#" method="post">', 'show_header' => true, 'show_footer' => true, 'header_text' => 'Edit Configuration', 'buttons' => array($commonSaveButton, $commonCancelButton))); /* Configuration Grid Delete Window Setup - END */ $jQuery->setHelpButton('helpButton'); ?> <script language="Javascript"> $(document).ready(function (){ <?php echo $jQuery->getScriptOutput(); ?>
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Foobar; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # record start time, to stop execution if time is exceeded... $startTime = time(); $yesterdayTimestamp = $startTime - 86400; // calculate the base path of the program $basePath = realpath(dirname(__FILE__) . '/../'); $DEBUG_MODE = 'cmd'; $DEBUG_LEVEL = '30'; // Common tasks for both web and cmd require $basePath . '/inc/common.inc.php'; debug('Checking whether resolving is enabled...', 40, __FILE__, __LINE__); $resolveClients = getConfigValue($link, 'resolveClients'); if ($resolveClients != 'enabled') { debug('Resolving is NOT enabled. Exiting...', 30, __FILE__, __LINE__); exit(0); } debug('Resolving is enabled.', 40, __FILE__, __LINE__); error_reporting(E_ALL); debug('Start timestamp is ' . $startTime, 40, __FILE__, __LINE__); debug('Configuration:' . print_r($iniConfig, TRUE), 40, __FILE__, __LINE__); $maxRunTime = 55; $query = 'SELECT '; $query .= 'id'; $query .= ','; $query .= 'INET6_NTOA(UNHEX(ip)) AS ip'; $query .= ' FROM '; $query .= ' hostnames ';
<?php require_once "SiteConfigVars.php"; $dbserver = getConfigValue("dbHost_w_menu"); $password = getConfigValue("dbPass_w_menu"); $username = "******"; $dbname = "w_menu"; $conn = new PDO("mysql:host={$dbserver};dbname={$dbname}", $username, $password); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM allUsers;'); $stmt->execute(); $result = $stmt->fetchAll(); $i = 0; $user_array = []; foreach ($result as $row) { $i++; $temp_array = array('place' => ordinal($i), 'user' => $row['user'], 'total' => $row['total']); array_push($user_array, $temp_array); } $conn = null; echo json_encode($user_array); function ordinal($number) { $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); if ($number % 100 >= 11 && $number % 100 <= 13) { return $number . 'th'; } else { return $number . $ends[$number % 10]; } }
public function saveData() { // John Mikolich December 30, 2010 // It appears the "timezone issue" can be fixed by // preceeding each call to the PHP date function with // a statement that sets the timezone like the one in the code block below. if ($this->data->id == 0) { date_default_timezone_set(getConfigValue("timeZone")); $this->data->timeAdded = date("Y-m-d H:i:s", time()); } $this->data->timeChanged = date("Y-m-d H:i:s", time()); $this->data->store(); }
</label> </div> </div> <div class="clearfix"></div> <!-- Text input--> <div class="form-group"> <div class="col-lg-5"> <label for="textinput" class="control-label">Notification Time</label> </div> <div class="col-lg-1">: </div> <div class="col-lg-6"> <label for="textinput" class="control-label"> <?php if ($preference[0]['notification_time'] != "") { echo date(getConfigValue('time_format'), strtotime($preference[0]['notification_time'])); } ?> </label> </div> </div> <div class="clearfix"></div> <!-- Text input--> <div class="form-group"> <div class="col-lg-5"> <label for="textinput" class="control-label">Companies To Exclude</label> </div> <div class="col-lg-1">: </div>
function saveNewBicycle($option) { global $mainframe; $item = new CbodbItem(); $postrow = JRequest::get('post'); $memberID = JRequest::getVar('memberID'); $db =& JFactory::getDBO(); $query = "SELECT MAX(tag) FROM #__cbodb_items"; $db->setQuery($query); $maxTag = $db->loadResult(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } $item->tag = $maxTag + 1; $item->isBike = 1; $item->setAll($postrow); //$item->commissionUserID = JRequest::getVar('memberID'); $item->saveData(); // Added 2012-07-26 Lee Reis Post-Givecamp 2012 $membertransaction = new CbodbTransaction(); date_default_timezone_set(getConfigValue("timeZone")); $membertransaction->dateOpen = date("Y-m-d H:i:s", time()); $membertransaction->dateClosed = date("Y-m-d H:i:s", time()); $membertransaction->type = 7; $membertransaction->memberID = $memberID; $membertransaction->itemID = $maxTag + 1; $membertransaction->cash = $item->priceSale; $membertransaction->saveData(); // End of Added 2012-07-26 $mainframe->redirect('index.php?option=' . $option . '&task=shop&key=3b767559374f5132236f6e68256b2529#top', "Bicycle is saved with tag number {$item->tag}. Please write the number on the bike's tag!"); }
} else { echo '<div class="notice">The pokemon has been edited.</div>'; $name = cleanSql($name); setConfigValue('snow_machine_price', $price); setConfigValue('snow_machine_pokemon', $name); setConfigValue('snow_machine_chance', $chance); setConfigValue('snow_machine_pokemon_level', $level); $handle = fopen('edit_snow_machine_log.txt', 'a+'); fwrite($handle, "{$_SESSION['username']} edited the snow machine. Name: {$name}, Price: {$price}, Chance: {$chance}, Level: {$level}" . PHP_EOL); fclose($handle); } } $smPrice = getConfigValue('snow_machine_price'); $smPokemon = getConfigValue('snow_machine_pokemon'); $smChance = getConfigValue('snow_machine_chance'); $smPokemonLevel = getConfigValue('snow_machine_pokemon_level'); echo ' <form method="post"> <table class="pretty-table center"> <tr> <th colspan="2">Edit Snow Machine</th> </tr> <tr> <td>Attempt Price:</td> <td> $ <input type="text" name="price" value="' . number_format($smPrice) . '" /><br /> <span class="small">Price per attempt at<br />fixing the machine.</span> </td> </tr> <tr> <td>Pokemon Name:</td>
/** * Close job. not really necessary unless want to close it before script end. * * this should run automatically when script ends. * * @param ToolkitServiceCw $connection * @return bool */ function i5_close(ToolkitServiceCw &$connection) { // if conn not passed in, get instance of toolkit. If can't be obtained, return false. if (!($connection = verifyConnection($connection))) { return false; } // or explicitly asked to close by INI file. $fullDbClose = getConfigValue('cw', 'fullDbClose', false); if ($fullDbClose) { $connection->disconnect(); } $connection->__destruct(); $connection = null; // @todo try/catch. if fail return false return true; }
mysql_query("UPDATE `user_pokemon` SET `exp`={$newExp} WHERE `id`='{$team[$pnum]['id']}'") or die('f'); mysql_query("UPDATE `users` SET `trainer_exp`={$newExp} WHERE `id`='{$uid}'") or die('f'); $newLevel = expToLevel($newExp); if ($newLevel > 10000) { $newLevel = 10000; } if ($newLevel != $team[$pnum]['level']) { $levelsGained = $newLevel - $team[$pnum]['level']; echo $team[$pnum]['name'] . ' gained ' . $levelsGained . ' levels.<br />'; mysql_query("UPDATE `user_pokemon` SET `level`={$newLevel} WHERE `id`='{$team[$pnum]['id']}'"); } echo '</div>'; } if (isset($_SESSION['battle']['uid'])) { $wUid = $_SESSION['battle']['uid']; if ($wUid == getConfigValue('champion_uid')) { setConfigValue('champion_uid', $uid); echo '<div>You are now the new champion!</div>'; } } $gymMsg = ''; if (isset($_SESSION['battle']['badge'])) { $badge = $_SESSION['battle']['badge']; $gymleader = $_SESSION['battle']['gymleader']; $gymMsg = ' <div> <img src="images/badges/' . $badge . '.gif" alt="' . $badge . ' Badge" /> You have beaten ' . $gymleader . ' and earned yourself the ' . $badge . ' badge! <img src="images/badges/' . $badge . '.gif" alt="' . $badge . ' Badge" /> </div> ';
public function ajaxblock() { $user_id = $this->input->get('id'); $block = $this->input->get('block') == 'Y' ? 'N' : 'Y'; $update_id = $this->user_model->update_by(array('member_id' => $user_id), array('is_block' => $block)); if ($block == 'Y') { $details = $this->user_model->getUserListsByID($user_id); $this->load->library('email'); $to = $details['email']; $from = getConfigValue("email_from"); $email = $this->email_model->get_email_template("user_blocked"); $subject = $email['email_subject']; $message = $email['email_template']; $fullname = $details['first_name'] . ' ' . $details['last_name']; $message = str_replace('#FULL_NAME#', $fullname, $message); $message = str_replace('#EMAIL#', $from, $message); $this->email->from($from); $this->email->reply_to($from); $this->email->to($to); $this->email->subject($subject); $this->email->message($message); $this->email->send(); $this->session->set_flashdata('message', " User Blocked "); } else { $this->session->set_flashdata('message', " User Unblocked "); } $this->session->set_flashdata('class', "success"); echo $status; }
</b><br/> </td> </tr> <tr><td> between <?php echo date(getConfigValue('time_format'), strtotime($val['schedule_timefrom'])); ?> and <?php echo date(getConfigValue('time_format'), strtotime($val['schedule_timeto'])); ?> <br /> on <?php echo date(getConfigValue('date_format'), strtotime($val['schedule_timeto'])); ?> </td> <td colspan="9"></td> <td> <?php echo $val['address']; ?> </i> </td> </tr> <table> <?php }
function _getToday($echo = false) { $DateTime = date(getConfigValue('date_format') . ' ' . getConfigValue('time_format')); if (!$echo) { return $DateTime; } else { echo $DateTime; } }
include 'config.php'; include 'functions.php'; if (!isLoggedIn()) { redirect('login.php'); } include '_header.php'; printHeader('Snow Machine'); $uid = (int) $_SESSION['userid']; $userMoney = getUserMoney($uid); $message = ''; $attemptPrice = getConfigValue('snow_machine_price'); $trappedPokemon = getConfigValue('snow_machine_pokemon'); $chanceOfWin = getConfigValue('snow_machine_chance'); $trappedLevel = getConfigValue('snow_machine_pokemon_level'); $spentMoney = getConfigValue('snow_machine_lost_money'); echo '<div style="text-align: center;"> Total spent money: ' . number_format($spentMoney) . '<br />'; if (isset($_POST['fix'])) { if ($userMoney < $attemptPrice) { $message = 'I am sorry but you do not have enough money.'; } else { // take money $userMoney -= $attemptPrice; updateUserMoney($uid, $userMoney); if (rand(1, 100) <= $chanceOfWin) { // they won $message = ' You have rescued a ' . $trappedPokemon . '!<br /> <img src="images/pokemon/' . $trappedPokemon . '.png" alt="' . $trappedPokemon . '" /> ';
require_once 'config.php'; require_once 'functions.php'; if (!isLoggedIn()) { redirect('index.php'); } include '_header.php'; printHeader('Lucky Hour'); function howlongtila($ts) { $ts = $ts - time(); return floor($ts / 60) . " minutes"; } $uid = $_SESSION['userid']; $user = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `id` = '{$uid}'")); $token = $user->signup_date * 3; $hitdown = getConfigValue('lucky_hour'); $hitrows1 = mysql_query("SELECT * FROM `lucky_hour`"); $hitrows = mysql_num_rows($hitrows1); $pid = rand(1, 713); $pokemon = mysql_fetch_object(mysql_query("SELECT * FROM `pokemon` WHERE `id` = '{$pid}'")); $level = 5; $exp = levelToExp($level); if ($hitrows == 0) { $newpokemon = giveUserPokemon($uid, $pokemon->name, $level, $exp, $pokemon->move1, $pokemon->move2, $pokemon->move3, $pokemon->move4); $newgold = 10000; } $timeleft = howlongtila($hitdown); $ts = $hitdown - time(); $secondz = $ts % 60; function Message($text) {
<?php require_once 'config.php'; require_once 'functions.php'; if (!isLoggedIn()) { redirect('login.php'); } include '_header.php'; printHeader('Release Pokemon'); $uid = (int) $_SESSION['userid']; $pid = (int) $_GET['id']; $releaseReward = getConfigValue('release_reward'); // check that the pokemon exists and they own it $query = mysql_query("SELECT * FROM `user_pokemon` WHERE `id`='{$pid}' AND `uid`='{$uid}'"); if (mysql_num_rows($query) == 0) { echo '<div class="error">This pokemon either doesn\'t exist or doesn\'t belong to you.</div>'; include '_footer.php'; die; } $pokeInfo = mysql_fetch_assoc($query); //--------------------------------- // check that it is not in their team $teamIds = getUserTeamIds($uid); if (in_array($pid, $teamIds)) { echo '<div class="error">You can not release a pokemon that is in your team.</div>'; include '_footer.php'; die; } // -------------------------------- if (isset($_GET['sure'])) { if (!isset($_SESSION['releaseToken'][$pid])) {
function handlePostData(&$data) { if (getPost("username_new")) { if (strlen(getPost("username_new")) >= 4) { setConfigValue("user", getPost("username_new")); $_POST["username"] = getPost("username_new"); $data["logged_in"] = true; $data["success"][] = "The username was successfully changed"; } else { $data["success"][] = "The specified username is too short!"; } } if (getPost("password_new") || getPost("password_new_retype")) { if (getPost("password_new") == getPost("password_new_retype")) { setConfigValue("pass", getPost("password_new")); $_POST["password"] = getPost("password_new"); $data["logged_in"] = true; $data["success"][] = "The password was successfully changed"; } else { $data["error"][] = "Passwords do not match!"; } } if (!getConfigValue("user")) { $data["user_set"] = false; } if (!getConfigValue("pass")) { $data["pass_set"] = false; } $data["code"] = md5(getConfigValue("user") . "/" . getConfigValue("pass")); $data["logged_in"] = true; if ($data["user_set"] && $data["pass_set"] && $data["logged_in"]) { createDemoContent(); } return true; }
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # record start time, to stop execution if time is exceeded... $startTime = mktime(); $yesterdayTimestamp = $startTime - 86400; // calculate the base path of the program $basePath = realpath(dirname(__FILE__) . '/../'); $DEBUG_MODE = 'cmd'; $DEBUG_LEVEL = '30'; // Common tasks for both web and cmd require $basePath . '/inc/common.inc.php'; $tmpPath = getConfigValue($link, 'tmpPath'); error_reporting(E_ALL); debug('Start timestamp is ' . $startTime, 40, __FILE__, __LINE__); debug('Configuration:' . print_r($iniConfig, TRUE), 40, __FILE__, __LINE__); $maxRunTime = 55; $cleanUntil = date('Y-m-d', mktime(0, 0, 0, substr($today, 5, 2), substr($today, 8, 2) - getConfigValue($link, 'keepHistoryDays'), substr($today, 0, 4))); debug('Cleaning up until ' . $cleanUntil, 40, __FILE__, __LINE__); // array containing tables to be cleaned $cleanTable = array('sites', 'traffic', 'trafficSummaries', 'users'); reset($cleanTable); while (list($key, $tableName) = each($cleanTable)) { debug('Cleaning-up ' . $tableName . '...', 40, __FILE__, __LINE__); $query = 'DELETE FROM ' . $tableName . " WHERE date<'" . $cleanUntil . "'"; db_delete($link, $query); } $query = 'SHOW TABLES'; $tables = db_select_all($link, $query); reset($tables); while (list($key, $tableName) = each($tables)) { $timestampNow = time(); debug('Now timestamp is: ' . $timestampNow . '. Script start was at: ' . $startTime, 40, __FILE__, __LINE__);
echo base_url(); ?> admin/points/purchasedetails/<?php echo $val['id']; ?> " class="link1"><?php echo $val['point']; ?> </a></td> <td><?php echo $val['price']; ?> </td> <td><?php echo date(getConfigValue('date_format'), strtotime($val['created_date'])); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="8">No records...</td></tr> <?php
// optional demo values $setLibList = trim(getConfigValue('demo', 'initlibl', '')); $setCcsid = trim(getConfigValue('demo', 'ccsid', '')); $setJobName = trim(getConfigValue('demo', 'jobname', '')); $setIdleTimeout = trim(getConfigValue('demo', 'idle_timeout', '')); $transportType = trim(getConfigValue('demo', 'transport_type', '')); // optional demo connection values $private = false; // default $privateNum = false; // default $persistent = trim(getConfigValue('demo', 'persistent', false)); if ($persistent) { // private can only happen with persistence $private = trim(getConfigValue('demo', 'private', false)); $privateNum = trim(getConfigValue('demo', 'private_num', '0')); } //(persistent) $scriptTitle = 'Test script for IBM i Compatibility Wrapper (CW)'; // TODO get test user from toolkit.ini // this user, TKITU1, should exist on the system $user = '******'; $testPw = 'NICE2USR'; function OkBad($success = false) { if ($success) { return 'Successful'; } else { return 'Failed with this error: ' . print_r(i5_error(), true); } }
public function convertTimeToSiteFormat($user_time_zone = '', $user_time = '', $to_time_zone = '') { $current_time_zone = date_default_timezone_get(); //$user_time_zone = 'America/Mexico_City'; $to_time_zone = $to_time_zone ? $to_time_zone : date_default_timezone_get(); $user_time_zone = $user_time_zone ? $user_time_zone : date_default_timezone_get(); //$triggerOn = '04/01/2013 03:08 PM'; //echo $triggerOn; // echoes 04/01/2013 03:08 PM if ($user_time_zone) { $schedule_date = new DateTime($user_time, new DateTimeZone($user_time_zone)); $schedule_date->setTimeZone(new DateTimeZone($to_time_zone)); $user_time = $schedule_date->format(getConfigValue('time_format')); } return $user_time; }
function askValue($prompt, &$value, $show = true) { while (true) { if ($show) { $message = sprintf('%s [%s]? ', $prompt, getConfigValue($value)); } else { $message = sprintf('%s? ', $prompt); } echo $message; $input = trim(fgets(STDIN)); // dont't modify value if just empty (press ENTER) if (0 == strlen($input)) { return; } if (is_bool($value)) { $input = strtolower($input); if (in_array($input, array('y', 'n'))) { $value = 'y' == $input ? true : false; break; } } elseif (is_int($value)) { if (is_numeric($input)) { $value = (int) $input; break; } } else { $value = $input; break; } } }