function get_yelp_data_for_truck($vendor_name, $lat, $long) { // Configuration. $consumer_key = ''; $consumer_secret = ''; $token = ''; $token_secret = ''; // Search params. $params = array('term' => $vendor_name, 'category_filter' => 'foodtrucks,foodstands', 'location' => 'San Francisco, CA', 'cll' => (string) $lat . "," . (string) $long, 'limit' => 1); // Build the request. $unsigned_uri = "http://api.yelp.com/v2/search/?" . http_build_query($params); // Token object built using the OAuth library $token = new OAuthToken($token, $token_secret); // Consumer object built using the OAuth library $consumer = new OAuthConsumer($consumer_key, $consumer_secret); // Yelp uses HMAC SHA1 encoding $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); $oauthrequest = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $unsigned_uri); // Sign the request $oauthrequest->sign_request($signature_method, $consumer, $token); // Get the signed URL $signed_url = $oauthrequest->to_url(); $results = fetch_data($signed_url); // Ensure a business listing is returned and the location is not closed // permanently. if (array_key_exists("businesses", $results) && !$results["businesses"][0]["is_closed"]) { return $results["businesses"][0]; } return null; }
protected function prepareSubmit() { $ewayurl = "?"; foreach ($this->fields as $name => $value) { $ewayurl .= $name . '=' . $value . '&'; } $ewayurl = rtrim($ewayurl, "&"); $spacereplace = str_replace(" ", "%20", $ewayurl); $posturl = $this->gatewayUrl . $spacereplace; $ch = curl_init(); $error["set_host"] = curl_setopt($ch, CURLOPT_URL, $posturl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($ch); $error["result"] = curl_error($ch); function fetch_data($string, $start_tag, $end_tag) { $position = stripos($string, $start_tag); $str = substr($string, $position); $str_second = substr($str, strlen($start_tag)); $second_positon = stripos($str_second, $end_tag); $str_third = substr($str_second, 0, $second_positon); $fetch_data = trim($str_third); return $fetch_data; } $responsemode = fetch_data($response, '<result>', '</result>'); $responseurl = fetch_data($response, '<uri>', '</uri>'); if ($responsemode == "True") { $this->gatewayUrl = explode("?", $responseurl); parse_str($this->gatewayUrl[1]); $this->gatewayUrl[1] = $value; } elseif ($this->eway_settings['use_sandbox'] != '') { echo "ERROR\n"; echo $error["set_host"] ? "Success" : "Failure"; echo " Setting host: " . $posturl . "\n"; echo $error["result"] . "\n"; echo $response . "\n"; } }
</div> <!-- / END ROW --> </div> <!-- / END CONTAINER --> </section> <section class="purchase-now" id="references"> <div class="container" > <br> <h2 class="white-text">References</h2> <div class="row"> <div class="col-md-12" data-scrollreveal="enter left after 0s over 1s" style="-webkit-transform: translatex(-60px);-moz-transform: translatex(-60px);-ms-transform: translatex(-60px);transform: translatex(-60px);opacity: 0;" data-sr-init="true"> <div id="referencetext" class="editable" style="color:#fff"> <?php echo fetch_data(public_path() . "/assets/itsp_assets/data/" . $by . "/referencetext.txt"); ?> </div> </div> </div> </div> </section> <!-- ========================= FEEDBACK ============================== --> @if($auth==1) <section class="features" id="feedbackform">
function espresso_process_eway($payment_data) { global $wpdb; $payment_data['payment_status'] = 'Incomplete'; $payment_data['txn_type'] = 'EW'; $payment_data['txn_id'] = 0; $payment_data['txn_details'] = serialize($_REQUEST); $eway_settings = get_option('event_espresso_eway_settings'); switch ($eway_settings['region']) { case 'NZ': $results_request = 'https://nz.ewaygateway.com/Result/'; break; case 'AU': $results_request = 'https://au.ewaygateway.com/Result/'; break; case 'UK': $results_request = 'https://payment.ewaygateway.com/Result/'; break; } if ($eway_settings['use_sandbox']) { $results_request .= "?CustomerID=" . '87654321'; $results_request .= "&UserName="******"?CustomerID=" . $eway_settings['eway_id']; $results_request .= "&UserName="******"&AccessPaymentCode=" . $_REQUEST['AccessPaymentCode']; $results_request = str_replace(" ", "%20", $results_request); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $results_request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); if (defined('CURL_PROXY_REQUIRED') && CURL_PROXY_REQUIRED == 'True') { $proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true; curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS); } function fetch_data($string, $start_tag, $end_tag) { $position = stripos($string, $start_tag); $str = substr($string, $position); $str_second = substr($str, strlen($start_tag)); $second_positon = stripos($str_second, $end_tag); $str_third = substr($str_second, 0, $second_positon); $fetch_data = trim($str_third); return $fetch_data; } $response = curl_exec($ch); if (!empty($response)) { $payment_data['txn_details'] = $response; $responsecode = fetch_data($response, '<responsecode>', '</responsecode>'); $payment_data['txn_id'] = fetch_data($response, '<trxnnumber>', '</trxnnumber>'); if ($responsecode == '00' || $responsecode == '08') { $payment_data['payment_status'] = 'Completed'; //Debugging option if ($eway_settings['use_sandbox']) { echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Debugging / Sandbox output', 'event_espresso') . '</h3><br />'; echo "Response code = " . $responsecode; echo "\nResponse = "; var_dump($response); echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('End of Debugging / Sandbox output (this will go away when you switch to live transactions)', 'event_espresso') . '</h3>'; // For this, we'll just email ourselves ALL the data as plain text output. $subject = 'Instant Payment Notification - Gateway Variable Dump'; $body = "An instant payment notification was successfully recieved\n"; $body .= "from " . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; $body .= $response; wp_mail($payment_data['contact'], $subject, $body); } } else { echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Debugging / Sandbox output', 'event_espresso') . '</h3><br />'; echo "Response code = " . $responsecode; echo "\nResponse = "; var_dump($response); echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('End of Debugging / Sandbox output (this will go away when you switch to live transactions)', 'event_espresso') . '</h3>'; $subject = 'Instant Payment Notification - Gateway Variable Dump'; $body = "An instant payment notification failed\n"; $body .= "from " . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; $body .= $response; wp_mail($payment_data['contact'], $subject, $body); } } //add_action('action_hook_espresso_email_after_payment', 'espresso_email_after_payment'); return $payment_data; }
</div> <!-- / END ROW --> </div> <!-- / END CONTAINER --> </section> <section class="purchase-now" id="references"> <div class="container" > <br> <h2 class="white-text">References</h2> <div class="row"> <div class="col-md-12" data-scrollreveal="enter left after 0s over 1s" style="-webkit-transform: translatex(-60px);-moz-transform: translatex(-60px);-ms-transform: translatex(-60px);transform: translatex(-60px);opacity: 0;" data-sr-init="true"> <div id="referencetext" class="editable" style="color:#fff"> <?php echo fetch_data("data/" . $by . "/referencetext.txt"); ?> </div> </div> </div> </div> </section> <!-- ========================= CONTACT US ============================== --> <section class="contact-us" id="contact"> <div class="container"> <!-- SECTION HEADER -->
$twip[] = '($longip>=' . $data[0] . ' AND $longip<=' . $data[1] . ')'; } } if (count($twip) > 0) { $file_head = '<?php /* * echo is_taiwan_ip(\'140.113.1.1\'); //TRUE * * @DataSource http://ip-to-country.webhosting.info/ * @LastUpdated ' . date('Y-m-d') . ' */ function is_taiwan_ip($ip) { $longip = sprintf("%u", ip2long($ip)); if ('; $file_foot = ' ) return TRUE; else return FALSE; } ?>'; $or = ' OR '; file_put_contents($output_file, $file_head . join($or, $twip) . $file_foot); } flock($ifp, LOCK_UN); fclose($ifp); } fetch_data(); decompress_data(); convert_data();
<?php function fetch_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $result = curl_exec($ch); curl_close($ch); return $result; } $count = 5; // the number of photos you want to fetch $access_token = ""; $display_size = "thumbnail"; // you can choose between "low_resolution", "thumbnail" and "standard_resolution" $result = fetch_data("https://api.instagram.com/v1/users/self/media/recent?count={$count}&access_token={$access_token}"); $result = json_decode($result); echo "<ul>"; foreach ($result->data as $photo) { $img = $photo->images->{$display_size}; echo "<li><a href='{$photo->link}'><img src='{$img->url}' /></a></li>"; } echo "</ul>";
</p> <table class='table table-bordered table-striped js-dataTable-full'> <thead> <tr class='column-provider'> <th>Name</th> <th>Email</th> <th>status</th> <th>Action</th> </tr> </thead> <tbody> <?php $rs = $sia_obj->get_email_notifications(); if (chk_result_if_empty($rs) > 0) { $result = fetch_data($rs); $notification_details = unserialize($result['option_value']); for ($j = 0; $j < count($notification_details); $j++) { if (!empty($notification_details['user' . $j])) { $notification_id = $result['id']; if (isset($notification_details['user' . $j][0])) { $name = $notification_details['user' . $j][0]; } else { $name = ""; } if (isset($notification_details['user' . $j][1])) { $email = $notification_details['user' . $j][1]; } else { $email = ""; } if (isset($notification_details['user' . $j][2])) {
$count = 8; // the number of photos you want to fetch $display_size = "standard_resolution"; // you can choose $ch = curl_init($url); function fetch_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $result = curl_exec($ch); curl_close($ch); return $result; } $result = fetch_data($url); $result = json_decode($result); $i = 1; foreach ($result->items as $photo) { $img = $photo->images->{$display_size}; $caption = $photo->caption; ?> <!-- // echo "{$caption->text}"; --> <div class='col-xs-6 col-sm-3' > <div class="insta-img" style='background-image: url(<?php echo $img->url; ?> );'></div> </div> <!-- echo "<div class='col-sm-3'><img src='{$img->url}' class='img-responsive'/></div>"; -->
function gateway_paypal_payflow($seperator, $sessionid) { global $wpdb, $wpsc_cart; $purchase_log_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1"; $purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A); $fraud = 'NO'; $env = get_option('paypal_payflow_test') ? 'Test' : 'Live'; $user = get_option('paypal_payflow_user'); $password = get_option('paypal_payflow_pass'); $partner = get_option('paypal_payflow_partner'); $vendor = get_option('paypal_payflow_vendor'); $currency = get_option('paypal_payflow_curcode'); if ($env == 'Live') { $submiturl = 'https://payflowpro.paypal.com'; $PayPalURL = 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='; } else { $submiturl = 'https://pilot-payflowpro.paypal.com'; $PayPalURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='; } $cart_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='" . $purchase_log[0]['id'] . "'"; $cart = $wpdb->get_results($cart_sql, ARRAY_A); $member_subtype = get_product_meta($cart[0]['prodid'], 'is_permenant', true); $member_shiptype = get_product_meta($cart[0]['prodid'], 'membership_length', true); $member_shiptype = $member_shiptype[0]; $status = get_product_meta($cart[0]['prodid'], 'is_membership', true); $is_member = $status; $is_perm = $member_subtype; $length = $member_shiptype['length']; $custom = $purchase_log[0]['id']; if ($_POST['collected_data'][get_option('paypal_form_first_name')] != '') { $data['first_name'] = urlencode($_POST['collected_data'][get_option('paypal_form_first_name')]); } if ($_POST['collected_data'][get_option('paypal_form_last_name')] != '') { $data['last_name'] = urlencode($_POST['collected_data'][get_option('paypal_form_last_name')]); } if ($_POST['collected_data'][get_option('paypal_form_address')] != '') { $address_rows = explode("\n\r", $_POST['collected_data'][get_option('paypal_form_address')]); $data['address1'] = urlencode(str_replace(array("\n", "\r"), '', $address_rows[0])); unset($address_rows[0]); if ($address_rows != null) { $data['address2'] = implode(", ", $address_rows); } else { $data['address2'] = ''; } } if ($_POST['collected_data'][get_option('paypal_form_city')] != '') { $data['city'] = urlencode($_POST['collected_data'][get_option('paypal_form_city')]); } if ($_POST['collected_data'][get_option('paypal_form_state')] != '') { $data['state'] = $wpdb->get_var("SELECT code FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE id='" . wpsc_get_customer_meta('billing_region') . "'"); } $customer_billing_country = wpsc_get_customer_meta('billing_country'); if (preg_match("/^[a-zA-Z]{2}\$/", $customer_billing_country)) { $data['country'] = $customer_billing_country; } if (is_numeric($_POST['collected_data'][get_option('paypal_form_post_code')])) { $data['zip'] = urlencode($_POST['collected_data'][get_option('paypal_form_post_code')]); } $email_data = $wpdb->get_results("SELECT `id`,`type` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1'", ARRAY_A); foreach ((array) $email_data as $email) { $data['email'] = $_POST['collected_data'][$email['id']]; } if ($_POST['collected_data'][get_option('email_form_field')] != null && $data['email'] == null) { $data['email'] = $_POST['collected_data'][get_option('email_form_field')]; } $card_num = $_POST['card_number']; $cvv2 = $_POST['card_cvv']; $expiry = $_POST['expiry']['month'] . $_POST['expiry']['year']; $unique_id = generateGUID(); $fname = $data['first_name']; $lname = $data['last_name']; $addr1 = $data['address1'] . $data['address2']; $addr2 = $data['city']; $addr3 = $data['state']; $addr4 = $data['zip']; $country = $data['country']; $email = $data['email']; $amount = wpsc_cart_total(false); $amount = number_format($amount, 2, '.', ''); if ($is_member[0]) { switch ($member_shiptype['unit']) { case 'w': $member_ship_unit = 'WEEK'; break; case 'm': $member_ship_unit = 'MONT'; break; case 'y': $member_ship_unit = 'YEAR'; break; } $paypal_query_array = array('USER' => $user, 'PROFILENAME' => $fname . $lname . $purchase_log[0]['id'], 'VENDOR' => $vendor, 'PARTNER' => $partner, 'PWD' => $password, 'TENDER' => 'C', 'TRXTYPE' => 'R', 'ACTION' => 'A', 'START' => date('m') . (date('d') + 1) . date('Y'), 'ACCT' => $card_num, 'CVV2' => $cvv2, 'EXPDATE' => $expiry, 'ACCTTYPE' => $card, 'AMT' => $amount, 'CURRENCY' => $currency, 'FIRSTNAME' => $fname, 'LASTNAME' => $lname, 'STREET' => $addr1, 'CITY' => $addr2, 'STATE' => $addr3, 'ZIP' => $addr4, 'COUNTRY' => $country, 'EMAIL' => $email, 'OPTIONALTRX' => 'A', 'OPTIONALTRXAMT' => '0.00', 'CLIENTIP' => $cust_ip, 'COMMENT1' => $custom, 'ORDERDESC' => $fname . $lname . $purchase_log[0]['id'], 'PAYPERIOD' => $member_ship_unit); foreach ($paypal_query_array as $key => $value) { if ($key == 'USER') { $paypal_query .= $key . '[' . strlen($value) . ']=' . $value; } else { $paypal_query .= '&' . $key . '[' . strlen($value) . ']=' . $value; } } $response = fetch_data($unique_id, $submiturl, $paypal_query); response_handler($response, 'NO', $sessionid, $colected_data, 1); } if (get_option('paypal_payflow_method') == '0') { $tender = 'P'; } else { $tender = 'C'; } $fname = $data['first_name']; $lname = $data['last_name']; $addr1 = $data['address1'] . $data['address2']; $addr2 = $data['city']; $addr3 = $data['state']; $addr4 = $data['zip']; $country = $data['country']; $email = $data['email']; $paypal_query_array = array('USER' => $user, 'VENDOR' => $vendor, 'PARTNER' => $partner, 'PWD' => $password, 'TENDER' => $tender, 'TRXTYPE' => 'S', 'ACCT' => $card_num, 'CVV2' => $cvv2, 'EXPDATE' => $expiry, 'ACCTTYPE' => $card, 'AMT' => $amount, 'CURRENCY' => $currency, 'FIRSTNAME' => $fname, 'LASTNAME' => $lname, 'STREET' => $addr1, 'CITY' => $addr2, 'STATE' => $addr3, 'ZIP' => $addr4, 'COUNTRY' => $country, 'EMAIL' => $email, 'CLIENTIP' => $cust_ip, 'COMMENT1' => $custom, 'COMMENT2' => '', 'INVNUM' => $order_num, 'ORDERDESC' => $desc, 'VERBOSITY' => 'MEDIUM', 'CARDSTART' => $card_start, 'CARDISSUE' => $card_issue); foreach ($paypal_query_array as $key => $value) { if ($key == 'USER') { $paypal_query .= $key . '[' . strlen($value) . ']=' . $value; } else { $paypal_query .= '&' . $key . '[' . strlen($value) . ']=' . $value; } } //exit("<pre>".print_r($paypal_query_array,true)."</pre>"); $response = fetch_data($unique_id, $submiturl, $paypal_query); response_handler($response, 'NO', $sessionid, $colected_data); exit; }
function send_email() { $mail = new PHPMailer(); $body = "Congratulation! <br> You have a new request to add him in your slack team. Please login to Slack Invitation App to respond on new request."; $mail->isSMTP(); $mail->Host = 'email-smtp.us-east-1.amazonaws.com'; $mail->SMTPAuth = true; $mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead $mail->Port = 587; $mail->Username = '******'; $mail->Password = '******'; $mail->setFrom('*****@*****.**', 'Brainstorm Force'); $mail->Subject = "Slack Invitation Request"; $mail->msgHTML($body); $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; $count = 0; $sql = run_query("select * from `sia-options` where `option_name` = 'notification-emails'"); $result = fetch_data($sql); $result = unserialize($result['option_value']); for ($i = 0; $i < count($result); $i++) { if (!empty($result['user' . $i])) { if ($result['user' . $i][2] == 'on') { $mail->addAddress($result['user' . $i][1], $result['user' . $i][0]); if (!$mail->send()) { echo "Mailer Error " . $mail->ErrorInfo . '<br />'; break; //Abandon sending } else { $count++; } } // Clear all addresses and attachments for next loop $mail->clearAddresses(); $mail->clearAttachments(); } } echo "Message sent to " . $count . " member(s)"; }
global $Users; $room->flag_active_member($Users->get_auth_email()); } function get_members_list($room) { global $config_server_poll_max_executing_time; return $room->get_members($config_server_poll_max_executing_time); } function get_admin_volume($room) { return $room->get_admin_volume(); } function get_admin_radio($room) { return $room->get_admin_random_radio(); } $room = $Rooms->get_room($room_id); update_member_flag($room); // add user to the room members list //update admin flag // check for admin presence //$room->set_admin($Users->get_auth_id()); while (!is_timeout($start_time, $config_server_poll_max_executing_time)) { if (new_playlist_data($room_id, $update_version)) { $data = fetch_data($room); send_data((object) ["timeout" => false, "room_id" => $room_id, "room_options" => $data["room_options"], "update_version" => $data["update_version"], "currently_playing_id" => $data["currently_playing_id"], "playlist" => $data["playlist"], "history" => $data["history"], "chat" => $data["chat"], "stats" => $room->get_stats(), "members" => $data["members"], "admin_volume" => $data["admin_volume"], "admin_radio" => $data["admin_radio"]]); } usleep(1000); } //timeout data: send_data((object) ["timeout" => true, "room_id" => $room_id, "members" => get_members_list($room)]);
function display($date1, $date2, $excel = False) { global $sql, $pCodes_lookup, $tender_pcode_lookup, $double_lookup; $classes = array("one", "two"); $cur = 0; $data = array(); $dataP = $sql->prepare("SELECT phpData FROM dailyDebitCredit WHERE dateStr=?"); $dataR = $sql->execute($dataP, array($date1 . ' ' . $date2)); if ($sql->num_rows($dataR) == 0) { $data = fetch_data($date1, $date2); $saveP = $sql->prepare("INSERT INTO dailyDebitCredit (dateStr, phpData) VALUES (?, ?)"); $saveR = $sql->execute($saveP, array($date1 . ' ' . $date2, serialize($data))); } else { $dataW = $sql->fetch_row($dataR); $data = unserialize($dataW['phpData']); } $ret = "<table cellspacing=0 cellpadding=4 border=1>"; $ret .= "<tr class={$classes[$cur]}>"; $cur = ($cur + 1) % 2; $ret .= "<td colspan=2>Sales Entries<br />{$date1} through {$date2}</td>"; if (!$excel) { $ret .= "<input type=hidden id=datestr value=\"{$date1} {$date2}\" />"; } $temp = explode("-", $date1); $startTS = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]); $sYear = (int) $temp[0]; $sMonth = (int) $temp[1]; (int) ($sDay = $temp[2]); $temp = explode("-", $date2); $endTS = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]); $num_days = round(($endTS - $startTS) / (60 * 60 * 24)) + 1; $stamps = ""; $overshorts = array(); for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $stamps .= $tstamp . ":"; $overshorts[$tstamp] = 0; } $stamps = substr($stamps, strlen($stamps) - 1); $ret .= "<input type=hidden id=timestamps value=\"{$stamps}\" />"; for ($i = 0; $i < $num_days; $i++) { $ret .= "<td colspan=2>Type: General<br />"; $ret .= sprintf("Date: %s</td>", date("m/d/y", mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear))); } $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td class=heading>Description</td><td class=heading>Account</td>"; for ($i = 0; $i < $num_days; $i++) { $ret .= "<td class=heading>Debit</td><td class=heading>Credit</td>"; } $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>Cash deposit</td><td>10120</td>"; for ($i = 0; $i < $num_days - 1; $i++) { $ret .= "<td> </td><td> </td>"; } $ret .= "<td class=money>"; $amt = isset($data['other']['depositAmount']) ? $data['other']['depositAmount'] : ''; $ret .= inputTypeOther(array('other', 'depositAmount', 'debit'), $amt, $excel, $endTS); $overshorts[$endTS] += $amt === '' ? 0 : $amt; $ret .= "</td>"; $ret .= "<td> </td>"; $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>Check deposit</td><td>10120</td>"; for ($i = 0; $i < $num_days - 1; $i++) { $ret .= "<td> </td><td> </td>"; } $ret .= "<td class=money>"; $amt = isset($data['other']['depositChecks']) ? $data['other']['depositChecks'] : ''; $ret .= inputTypeOther(array('other', 'depositChecks', 'debit'), $amt, $excel, $endTS); $overshorts[$endTS] += $amt === '' ? 0 : $amt; $ret .= "</td>"; $ret .= "<td> </td>"; $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>ATM Cash</td><td>10112</td>"; for ($i = 0; $i < $num_days - 1; $i++) { $ret .= "<td> </td><td> </td>"; } $ret .= "<td class=money>"; $amt = isset($data['other']['atmNet']) ? $data['other']['atmNet'] : ''; $ret .= inputTypeOther(array('other', 'atmNet', 'debit'), $amt, $excel, $endTS); $overshorts[$endTS] += $amt === '' ? 0 : $amt; $ret .= "</td>"; $ret .= "<td> </td>"; $ret .= "</tr>"; foreach ($data['tenders'] as $k => $v) { if ($k == "SCA" || $k == "") { continue; } $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>"; $ret .= $v['name']; $ret .= "</td><td>"; $ret .= $tender_pcode_lookup[$k]; $ret .= "</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); if ($i == $num_days - 1 && $k == "CA") { $v[$tstamp] = 0; $v[$tstamp] = array_sum($v) * -1; } $ret .= "<td class=money>"; if (!isset($v[$tstamp])) { $v[$tstamp] = 0; } $v[$tstamp] = round($v[$tstamp], 2); if ($v[$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . $v[$tstamp] . "\" "; $ret .= "onchange=\"save3(this.value,'tenders','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} id=tender{$tstamp}{$k} />"; } else { $ret .= $v[$tstamp]; } $overshorts[$tstamp] += $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money>"; if ($v[$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . -1 * $v[$tstamp] . "\" "; $ret .= "onchange=\"save3(this.value,'tenders','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} id=tender{$tstamp}{$k} />"; } else { $ret .= -1 * $v[$tstamp]; } $overshorts[$tstamp] -= -1 * $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; } $ret .= "</tr>"; } foreach ($data['sales'] as $k => $v) { $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; if ($k > 40000) { $ret .= "<td>"; $ret .= isset($pCodes_lookup[$k]) ? $pCodes_lookup[$k] : ''; $ret .= "</td>"; $ret .= "<td>{$k}</td>"; } else { $ret .= "<td>"; $ret .= $double_lookup[$k][0]; $ret .= "</td><td>"; $ret .= $double_lookup[$k][1]; $ret .= "</td>"; } for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; if (isset($v[$tstamp]) && $v[$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . sprintf("%.2f", -1 * $v[$tstamp]) . "\" "; $ret .= " onchange=\"save3(this.value,'sales','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} />"; } else { $ret .= sprintf("%.2f", -1 * $v[$tstamp]); } $overshorts[$tstamp] += -1 * $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money>"; if (isset($v[$tstamp]) && $v[$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . sprintf("%.2f", $v[$tstamp]) . "\" "; $ret .= "onchange=\"save3(this.value,'sales','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} />"; } else { $ret .= sprintf("%.2f", $v[$tstamp]); } $overshorts[$tstamp] -= $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; } $ret .= "</tr>"; } foreach ($data['other']['discount'] as $k => $v) { $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>" . $k . "</td>"; if ($k == "Member") { $ret .= "<td>66600</td>"; } else { $ret .= "<td>61170</td>"; } for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; if (isset($v[$tstamp]) && $v[$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . $v[$tstamp] . "\" "; $ret .= "onchange=\"save4(this.value,'other','discount','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} />"; } else { $ret .= $v[$tstamp]; } $overshorts[$tstamp] += $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; $ret .= "<td class=money>"; if (isset($v[$tstamp]) && $v[$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . -1 * $v[$tstamp] . "\" "; $ret .= "onchange=\"save4(this.value,'other','discount','{$k}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} />"; } else { $ret .= -1 * $v[$tstamp]; } $overshorts[$tstamp] -= -1 * $v[$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; } $ret .= "</tr>"; } $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>Sales Tax Collected</td><td>21180</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; if (isset($data['other']['tax'][$tstamp]) && $data['other']['tax'][$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . sprintf("%.2f", -1 * $data['other']['tax'][$tstamp]) . "\" "; $ret .= "onchange=\"save3(this.value,'other','tax','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} />"; } else { $ret .= -1 * $data['other']['tax'][$tstamp]; } $overshorts[$tstamp] += -1 * $data['other']['tax'][$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money>"; if (isset($data['other']['tax'][$tstamp]) && $data['other']['tax'][$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . sprintf("%.2f", $data['other']['tax'][$tstamp]) . "\" "; $ret .= "onchange=\"save3(this.value,'other','tax','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} />"; } else { $ret .= $data['other']['tax'][$tstamp]; } $overshorts[$tstamp] -= $data['other']['tax'][$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; } $ret .= "</tr>"; $other = array('gazette' => array('Gazette Ads', 10730), 'foundmoney' => array('Found Money', 63350)); foreach ($other as $key => $pair) { $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>{$pair[0]}</td><td>{$pair[1]}</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; $ret .= "</td><td class=money>"; if (isset($data['other'][$key][$tstamp]) && $data['other'][$key][$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . -1 * $data['other'][$key][$tstamp] . "\" "; $ret .= "onchange=\"save3(this.value,'other','{$key}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} />"; } else { $ret .= -1 * $data['other'][$key][$tstamp]; } $overshorts[$tstamp] += -1 * $data['other'][$key][$tstamp]; } else { $ret .= " "; } if (isset($data['other'][$key][$tstamp]) && $data['other'][$key][$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . $data['other'][$key][$tstamp] . "\" "; $ret .= "onchange=\"save3(this.value,'other','{$key}','{$tstamp}');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} />"; } else { $ret .= $data['other'][$key][$tstamp]; } $overshorts[$tstamp] -= $data['other'][$key][$tstamp]; } else { $ret .= " "; } } $ret .= "</tr>"; } $misc = array('misc0' => 'Old Misc', 'misc1' => 'Misc #1', 'misc2' => 'Misc #2'); foreach ($misc as $key => $label) { $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>{$label}</td><td>"; if (!$excel) { $ret .= "<input type=text onchange=\"saveMisc(this.value,'{$key}','0','pcode');\" "; $ret .= "value=\"" . $data['other'][$key][0] . "\" size=6 />"; } else { $ret .= $data['other'][$key][0]; } $ret .= "</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; if (isset($data['other'][$key][1][$tstamp]) && $data['other'][$key][1][$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . -1 * $data['other'][$key][1][$tstamp] . "\" "; $ret .= "onchange=\"saveMisc(this.value,'{$key}','{$tstamp}','sales');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} />"; } else { $ret .= -1 * $data['other'][$key][1][$tstamp]; } $overshorts[$tstamp] += -1 * $data['other'][$key][1][$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money>"; if (isset($data['other'][$key][1][$tstamp]) && $data['other'][$key][1][$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . $data['other'][$key][1][$tstamp] . "\" "; $ret .= "onchange=\"saveMisc(this.value,'{$key}','{$tstamp}','sales');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} />"; } else { $ret .= $data['other'][$key][1][$tstamp]; } $overshorts[$tstamp] -= $data['other'][$key][1][$tstamp]; } else { $ret .= " "; } } $ret .= "</tr>"; } $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>AMEX Fees</td><td>"; $ret .= $data['other']['axfees'][0]; $ret .= "</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $ret .= "<td class=money>"; if (isset($data['other']['axfees'][1][$tstamp]) && $data['other']['axfees'][1][$tstamp] >= 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . -1 * $data['other']['axfees'][1][$tstamp] . "\" "; $ret .= "onchange=\"saveMisc(this.value,'axfees','{$tstamp}','sales');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=debit{$tstamp} id=axfees{$tstamp} />"; } else { $ret .= -1 * $data['other']['axfees'][1][$tstamp]; } $overshorts[$tstamp] += -1 * $data['other']['axfees'][1][$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money>"; if (isset($data['other']['axfees'][1][$tstamp]) && $data['other']['axfees'][1][$tstamp] < 0) { if (!$excel) { $ret .= "<input type=text size=7 value=\"" . $data['other']['axfees'][1][$tstamp] . "\" "; $ret .= "onchange=\"saveMisc(this.value,'axfees','{$tstamp}','sales');rb({$tstamp});\" "; $ret .= "style=\"text-align:right\" name=credit{$tstamp} id=axfees{$tstamp} />"; } else { $ret .= $data['other']['axfees'][1][$tstamp]; } $overshorts[$tstamp] -= $data['other']['axfees'][1][$tstamp]; } else { $ret .= " "; } } $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>Change Buy</td><td>10120</td>"; for ($i = 0; $i < $num_days - 1; $i++) { $ret .= "<td> </td><td> </td>"; } $ret .= "<td> </td>"; $ret .= "<td class=money>"; $amt = isset($data['other']['buyAmount']) ? $data['other']['buyAmount'] : ''; $ret .= inputTypeOther(array('other', 'buyAmount', 'credit'), $amt, $excel, $endTS); $overshorts[$endTS] -= $amt === '' ? 0 : $amt; $ret .= "</td>"; $ret .= "</tr>"; $ret .= "<tr class={$classes[$c]}>"; $c = ($c + 1) % 2; $ret .= "<td>Over/Short</td><td>63350</td>"; for ($i = 0; $i < $num_days; $i++) { $tstamp = mktime(0, 0, 0, $sMonth, $sDay + $i, $sYear); $overshorts[$tstamp] = round($overshorts[$tstamp], 2); $ret .= "<td class=money id=overshortDebit{$tstamp}>"; if ($overshorts[$tstamp] < 0) { $ret .= -1 * $overshorts[$tstamp]; } else { $ret .= " "; } $ret .= "</td><td class=money id=overshortCredit{$tstamp}>"; if ($overshorts[$tstamp] >= 0) { $ret .= $overshorts[$tstamp]; } else { $ret .= " "; } $ret .= "</td>"; } $ret .= "</tr>"; $ret .= "</table>"; return $ret; }
function get_composer_ranking($limit) { $sql = "SELECT * FROM composers ORDER BY avgrating, lastname ASC LIMIT :limit"; $ranking = fetch_data($sql, array(array(":limit", $limit, 1))); return $ranking; }
<?php include_once "./inc/helper.php"; $res = fetch_data(); ?> <!DOCTYPE html> <html> <head> <!--Import Google Icon Font--> <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!--Import materialize.css--> <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/css/materialize.min.css"> <link type="text/css" rel="stylesheet" href="css/style.css" media="screen,projection"/> <!--Let browser know website is optimized for mobile--> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body> <!--Import jQuery before materialize.js--> <div id="map"></div> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/js/materialize.min.js"></script> <script type="text/javascript"> <?php echo "var spl = {$res}"; ?>