REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 27.21 KB
Close
/home/justbyquicklly-old/justbyquicklly/www/include/functions.php
Text
Base64
<?php $url_components = parse_url("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); parse_str($url_components['query'], $paramsutm); function generateRandomPassword() { $chars = "ABCDEFGHJKLMNPQRSTUVWXYZ"; srand((double) microtime() * 1000000); $i = 0; $randno = ''; while ($i < 6) { $num = rand() % 24; $tmp = substr($chars, $num, 1); $randno = $randno . $tmp; $i++; } return strtoupper($randno); } function getRewardPoints($user_id) { /* $pointArr = mysqli_query($GLOBALS['conn'], "select sum(reward_point) as credit from tbl_reward_history where user_id='" . $user_id . "' and type='Cr'"); $rs = mysqli_fetch_object($pointArr); $total_cr = $rs->credit; $pointArr = mysqli_query($GLOBALS['conn'], "select sum(reward_point) as debit from tbl_reward_history where user_id='" . $user_id . "' and type='Dr'"); $rs = mysqli_fetch_object($pointArr); $total_dr = $rs->debit;*/ $current_points =0; //$total_cr - $total_dr; return($current_points); } function getwallet($user_id) { /* $pointArr = mysqli_query($GLOBALS['conn'], "select sum(wallet_balance) as credit from tbl_wallet where user_id='" . $user_id . "' and type='Cr'"); $rs = mysqli_fetch_object($pointArr); $total_cr = $rs->credit; $pointArr = mysqli_query($GLOBALS['conn'], "select sum(wallet_balance) as debit from tbl_wallet where user_id='" . $user_id . "' and type='Dr'"); $rs = mysqli_fetch_object($pointArr); $total_dr = $rs->debit;*/ $current_balance =0;// $total_cr - $total_dr; return($current_balance); } function generateCouponCode() { $chars = "ABCDEFGHJKLMNOPQRSRTUVWXYZ123456789"; srand((double) microtime() * 1000000); $i = 0; $randno = ''; while ($i < 6) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $randno = $randno . $tmp; $i++; } return strtoupper($randno); } function generateSlug($name, $tbl, $id) { /* $newurl = str_replace(" - ", " ", $name); $newurl = str_replace("&", "", $newurl); $newurl = str_replace(",", " ", $newurl); $myurl = str_replace("--", "-", str_replace("%", "", str_replace(" ", "-", str_replace("-", " ", trim(str_replace("/", " ", str_replace(".", "", $newurl))))))); $myurl = strtolower($myurl); $query = mysqli_query($GLOBALS['conn'], "select id from $tbl where slug='$myurl' "); if (mysqli_num_rows($query) > 0) { $myurl = $myurl . $id; mysqli_query($GLOBALS['conn'], "update $tbl set slug='$myurl' where id='$id' "); } else { mysqli_query($GLOBALS['conn'], "update $tbl set slug='$myurl' where id='$id' "); }*/ } function buildURL($url) { $newurl = str_replace(" - ", " ", $url); $myurl = str_replace("--", "-", str_replace("?", "", str_replace("!", "", str_replace("&", "", str_replace("%", "", str_replace(" ", "-", str_replace("-", " ", trim(str_replace("/", " ", str_replace(",", "", str_replace(".", "", str_replace("'", "", $newurl)))))))))))); return stripslashes(strtolower($myurl)); } function buildURLAlcohol($url) { $newurl = str_replace(" - ", " ", $url); $myurl = str_replace("--", "-", str_replace("?", "", str_replace("!", "", str_replace("&", "", str_replace("%", "", str_replace(" ", "-", str_replace("-", " ", trim(str_replace("/", " ", str_replace(",", "", $newurl)))))))))); return stripslashes(strtolower($myurl)); } function parseInput($val) { return mysqli_real_escape_string(stripslashes($val)); } function encryptPassword($val) { return sha1($val); } function getFieldWhere($filed, $tbl, $where, $id) { $data = callAPI('POST', WEBAPI_URL_NEW.'miniWebsite/getFieldWhere',array("filed"=>$filed, "tbl"=>$tbl,"where"=>$where,"id"=>$id)); //$sql = mysqli_query($GLOBALS['conn'], "select $filed as field from $tbl where $where='" . $id . "'"); foreach($data->lstuser as $result){} return (stripslashes($result->field)); } function clearCache() { header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); } function redirect($url) { header("location:$url"); exit(); } function validateAdminSession() { if (trim($_SESSION["sess_admin_id"]) == "" && trim($_SESSION["sess_admin_logged"]) != "true") { $_SESSION["sess_msg"] = "Session expired. Please login again to continue"; redirect("index.php"); } } function rounder($num) { $fln = $num - floor($num); if ($fln > 0.00 and $fln < 0.1) { $fln = 0.09; } if ($fln > 0.10 and $fln < 0.2) { $fln = 0.19; } if ($fln > 0.20 and $fln < 0.3) { $fln = 0.29; } if ($fln > 0.30 and $fln < 0.4) { $fln = 0.39; } if ($fln > 0.40 and $fln < 0.5) { $fln = 0.49; } if ($fln > 0.50 and $fln < 0.6) { $fln = 0.59; } if ($fln > 0.60 and $fln < 0.7) { $fln = 0.69; } if ($fln > 0.70 and $fln < 0.8) { $fln = 0.79; } if ($fln > 0.80 and $fln < 0.9) { $fln = 0.89; } if ($fln > 0.90 and $fln < 0.99) { $fln = 0.99; } return floor($num) + $fln; } function username($name) { if (strlen($name) > 8) { $name = substr($name, 0, 8) . ".."; return(ucwords($name)); } return(ucwords($name)); } function CompressImage($source, $destination, $quality) { $info = getimagesize($source); if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source); elseif ($info['mime'] == 'image/gif') $image = imagecreatefromgif($source); elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source); imagejpeg($image, $destination, $quality); return $destination; } function getFileVer($FileName) { return $FileName . '?v=' . filemtime($_SERVER['DOCUMENT_ROOT'] . "/" . $FileName); //return $FileName . '?v=' . filemtime($_SERVER['DOCUMENT_ROOT']); } function encryptString($text) { // Store the cipher method $ciphering = "AES-128-CTR"; // Use OpenSSl Encryption method $iv_length = openssl_cipher_iv_length($ciphering); $options = 0; // Non-NULL Initialization Vector for encryption $encryption_iv = '1234567891011121'; // Store the encryption key $encryption_key = "mYvALuE350_Key20#20"; // Use openssl_encrypt() function to encrypt the data $encryption = openssl_encrypt($text, $ciphering, $encryption_key, $options, $encryption_iv); return $encryption; } function decryptString($enc_text) { // Store the cipher method $ciphering = "AES-128-CTR"; // Non-NULL Initialization Vector for decryption $decryption_iv = '1234567891011121'; // Use OpenSSl Encryption method $iv_length = openssl_cipher_iv_length($ciphering); $options = 0; // Store the decryption key $decryption_key = "mYvALuE350_Key20#20"; // Use openssl_decrypt() function to decrypt the data $plain = openssl_decrypt($enc_text, $ciphering, $decryption_key, $options, $decryption_iv); // Display the decrypted string return $plain; } function hikerounder($price, $hike) { //$num=$num),2); //$price=number_format($price,2); $hikes = number_format(($price * $hike / 100), 2,'.',''); $price = rounder(number_format($price + $hikes, 2,'.','')); return $price; } function getTaxhike($price, $hike, $method, $taxvalue) { $price = hikerounder($price, $hike); if ($method == 'Amount') { $tax_value = $taxvalue; } if ($method == 'Low Tax') { $tax_value = ($price * 2.25) / 100; } if ($method == 'High Tax') { $tax_value = ($price * 10.25) / 100; } if ($method == 'City of Chicago/Soda Tax') { $tax_value = ($price * 10.25 / 100) + ($price * 3 / 100) + ($price * 10.25 / 100); } return number_format($tax_value, 2); } function diwaliProductList() { $dewaliProd = array(); return $dewaliProd; } function getTimeoneForDelivery($zipstate){ if ($zipstate == 'CA') { $time_zone = 'PT'; } elseif ($zipstate == 'PA' || $zipstate == 'NY' || $zipstate == 'NJ' || $zipstate == 'CONNECTICUT') { $time_zone = 'ET'; } else { $time_zone = 'CT'; } return $time_zone; } function changeTimezone(){ //change timezone as per zipcode } // Comparison function function date_sort($element1, $element2) { $datetime1 = strtotime($element1['deliveryDate']." ".$element1['deliveryFromTime']); $datetime2 = strtotime($element2['deliveryDate']." ".$element2['deliveryFromTime']); return $datetime1 - $datetime2; } // example : $search_list = array('key'=>12); // searchFromArray($array, $search_list) function searchFromArray($array, $search_list) { // Create the result array $result = array(); // Iterate over each array element foreach ($array as $key => $value) { // Iterate over each search condition foreach ($search_list as $k => $v) { // If the array element does not meet // the search condition then continue // to the next element if (!isset($value[$k]) || $value[$k] != $v) { // Skip two loops continue 2; } } // Append array element's key to the //result array $result[] = $value; } // Return result return $result; } // Method: POST, PUT, GET etc // Data: array("param" => "value") ==> index.php?param=value function callAPI($method, $url, $data = false){ $curl = curl_init(); switch ($method) { case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // Optional Authentication: curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "username:password"); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($curl); $result = json_decode($result); curl_close($curl); return $result; } function add_working_date($days) { $workingDays = [1, 2, 3, 4, 5]; # date format = N (1 = Monday, ...) $from = new DateTime('now'); $dates = []; $dates[] = $from; while ($days) { $from->modify('+1 day'); if (!in_array($from->format('N'), $workingDays)) continue; $dates[] = $from; $days--; } return $dates[$days]; } function add_working_exclude_friday_date($days) { $workingDays = [1, 2, 3, 4]; # date format = N (1 = Monday, ...) $from = new DateTime('now'); $dates = []; $dates[] = $from; while ($days) { $from->modify('+1 day'); if (!in_array($from->format('N'), $workingDays)) continue; $dates[] = $from; $days--; } return $dates[$days]; } function unitConv($size,$sizetype){ $sizetype=strtoupper($sizetype); if ($sizetype == 'KG' || $sizetype == 'LTR' || $sizetype == 'GM' || $sizetype == 'ML' || $sizetype == 'GAL' || $sizetype == 'FLOZ' || $sizetype == 'OZ' || $sizetype == 'LBS') { if (is_numeric($size)) { if ($sizetype == 'KG') { $size = $size * 2.20462; $sizetype = 'Lbs'; } elseif ($sizetype == 'LTR') { $size = $size * 33.814; $sizetype = 'Oz'; } elseif ($sizetype == 'GM') { $size = $size * 0.00220462; $sizetype = 'Lbs'; } elseif ($sizetype == 'ML') { $size = $size * 0.0338; $size = $size * 1.0432; $sizetype = 'Oz'; } elseif ($sizetype == 'GAL') { $size = $size * 148.9468; $sizetype = 'Oz'; } elseif ($sizetype == 'FLOZ') { $size = $size * 1.0432; $sizetype = 'Oz'; } elseif ($sizetype == 'LBS') { $size = $size; $sizetype = 'LBS'; }elseif ($sizetype == 'OZ') { $size = $size; $sizetype = 'Oz'; }else{ $size = $size; $sizetype = 'EACH'; } $size = (string) number_format($size, 2); } } return array($size,$sizetype); } //Get device token //Method for notification scheduler function notificationScheduler($frequency,$notificationDate,$notificationCount) { $differenceFormat = '%a'; $datetime = new DateTime( "now", new DateTimeZone( "America/Chicago" ) ); $date_1 = $datetime->format( 'Y-m-d H:i:s' ); $date_2 = $notificationDate; $datetime1 = date_create($date_1); $datetime2 = date_create($date_2); $interval = date_diff($datetime1, $datetime2); $noOfDays = $interval->format($differenceFormat); $notifDate = date("Y-m-d", strtotime($date_2)); $currentDate = date("Y-m-d", strtotime($date_1)); //Check notification frequency and datetime if($frequency==1 && $currentDate > $notifDate ){ return true; }else if($frequency==7) { if($notificationCount ==0) { return true; }else if($noOfDays >=28){ return true; } } return false; } //Replace place holder from email template function replacePlaceHolder($template, $placeholders){ $placeholders = array_merge($placeholders, array('<?'=>'', '?>'=>'')); return str_replace(array_keys($placeholders), $placeholders, $template); } ### Instacart integration related function //function to generate feed file csv and move into inbound dir function genrateFlatFile($fileName,$columnArr,$dataArr ) { $file = fopen($fileName, 'wb'); // save the column headers fputcsv($file, $columnArr); // save each row of the data foreach ($dataArr as $row) { fputcsv($file, $row); } // Close the file fclose($file); return true; } function logToFile($filename, $msg) { $fd = fopen($filename, "a"); $str = "[" . date("Y/m/d h:i:s", mktime()) . "] " . $msg; fwrite($fd, $str . "\n"); fclose($fd); } //Method to remove space and line break from product name function removeLineBreakSpaces($str) { $string = trim(preg_replace('/\s\s+/', ' ', $str)); return $string; } //Method to parse insta transaction log csv function parse_csv_file($csvfile) { $csv = Array(); $rowcount = 0; if (($handle = fopen($csvfile, "r")) !== FALSE) { $max_line_length = defined('MAX_LINE_LENGTH') ? MAX_LINE_LENGTH : 100000; $header = fgetcsv($handle, $max_line_length); $header = str_replace(' ', '_', $header); $header = str_replace('/', '_', $header); $header_colcount = count($header); while (($row = fgetcsv($handle, $max_line_length)) !== FALSE) { $row_colcount = count($row); if ($row_colcount == $header_colcount) { $entry = array_combine($header, $row); $csv[] = $entry; } else { error_log("csvreader: Invalid number of columns at line " . ($rowcount + 2) . " (row " . ($rowcount + 1) . "). Expected=$header_colcount Got=$row_colcount"); return null; } $rowcount++; } //echo "Totally $rowcount rows found\n"; fclose($handle); } else { error_log("csvreader: Could not read CSV \"$csvfile\""); return null; } return $csv; } //Method to split store , product and Item id from insta item id fields function splitProductStore($itemId) { $item = explode('-',$itemId); $itemArr = array('store_prefix'=>$item[0], 'store_id'=>$item[1], 'location'=>$item[2] ); return $itemArr; } //Get store id by store ref id function is_cli() { if( defined('STDIN') ) { return true; } if( empty($_SERVER['REMOTE_ADDR']) and !isset($_SERVER['HTTP_USER_AGENT']) and count($_SERVER['argv']) > 0) { return true; } return false; } //Method to get percentage of number function getPercentOfNumber($number, $percent){ return ($percent / 100) * $number; } //Get the first letter of each word from store name function storePrefix($storeName) { $words = preg_split("/\s+/", $storeName); $acronym = ''; foreach ($words as $w) { $acronym .= ucfirst($w[0]); } return $acronym; } ################################################### //Method for get client IP location info function grabIpInfo($clientIPAddress) { $LocationArray = json_decode( file_get_contents('http://ip-get-geolocation.com/api/json/'.$clientIPAddress), true); $euCountries = [ "DE", "AT", "BE", "BG", "CY", "HR", "DK", "ES", "EE", "FI", "FR", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "CZ", "RO", "GB", "SK", "SI", "SE","GB","GB-ENG","GB-NIR","GB-SCT" ]; if(in_array($LocationArray['countryCode'],$euCountries)) { return false; } //print_r($LocationArray); return true; } //get IP location using GeoPlugin function getIpLocationGeoPlugin($clientIPAddress) { $ipLocationInfo= unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$clientIPAddress)); $excldCountries = [ "DE", "AT", "BE", "BG", "CY", "HR", "DK", "ES", "EE", "FI", "FR", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "CZ", "RO", "GB", "SK", "SI", "SE","GB","GB-ENG","GB-NIR","GB-SCT" ]; if(in_array($ipLocationInfo['geoplugin_countryCode'],$excldCountries)) { return false; } //print_r($LocationArray); return true; //print_r($ipLocationInfo); } //Restrict Uk and EU to access Rakuten marketing (Implemnetd by vivek) function geoPluginQuicklly($ipAddress) { //Using the API to get information about this IP $details = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=$ipAddress")); //Using the geoplugin to get the continent for this IP $continent=$details->geoplugin_continentCode; //And for the country $country=$details->geoplugin_countryCode; //If continent is Europe if($continent=="EU" || $country=="UK" || $country=="GB" || $country=="GB-ENG" || $country=="GB-NIR" || $country=="GB-SCT"){ //Do action if country is UK or EU return false; }else{ //Do action if country is not UK or EU return true; } } //FUNCTION TO GET STORE DETAILS USING API function callStoreAPI($method, $url, $data){ $tokenData = callAPI('POST', WEBAPI_URL_NEW.'login',array("email"=>"web-app@quicklly.com", "password"=>"cgcptcu97b")); $token = $tokenData->token; $data['token'] = $token; $url = str_replace(API_URL, WEBAPI_URL_NEW, $url); $curl = curl_init(); switch ($method){ case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); break; case "PUT": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // OPTIONS: curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'APIKEY: '.API_KEY, 'Content-Type: application/json', )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // EXECUTE: $result = ''; if(curl_exec($curl) === false) { $result = 'Curl error: ' . curl_error($curl); } else{ $result = curl_exec($curl); } curl_close($curl); return $result; } //Function for prvent XXS issues function xss_clean($data) { // Fix &entity\n; $data = str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), $data); $data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data); $data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data); $data = html_entity_decode($data, ENT_COMPAT, 'UTF-8'); // Remove any attribute starting with "on" or xmlns $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data); // Remove javascript: and vbscript: protocols $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data); // Only works in IE: <span style="width: expression(alert('Ping!'));"></span> $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data); // Remove namespaced elements (we do not need them) $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data); do { // Remove really unwanted tags $old_data = $data; $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); } while ($old_data !== $data); // we are done... return $data; } function getDeliveryDatesfromApi($storeid,$zipcode,$section,$deliverytype) { $todayorrderlistarray['callFrom']=callFrom; $todayorrderlistarray['apiKey']=API_KEY; $todayorrderlistarray['zipcode']=$zipcode; $todayorrderlistarray['lstStoreSection'][0]['section']="$section"; $todayorrderlistarray['lstStoreSection'][0]['sid']="$storeid"; $todayorrderlistarray['lstStoreSection'][0]['data']="$deliverytype"; $data=json_encode($todayorrderlistarray); $url = API_URL.'/common/get-delivery-info'; // Create a new cURL resource $ch = curl_init($url); // Setup request to send json via POST $payload =$data; // Attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); // Return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the POST request $result = curl_exec($ch); return $result; // Close cURL resource curl_close($ch); } function getDeliveryDatesfromApiLaravel($storeid,$zipcode,$section,$deliverytype,$token) { $todayorrderlistarray['callFrom']=callFrom; $todayorrderlistarray['apiKey']=API_KEY; $todayorrderlistarray['zipcode']=$zipcode; $todayorrderlistarray['lstStoreSection'][0]['section']="$section"; $todayorrderlistarray['lstStoreSection'][0]['sid']="$storeid"; $todayorrderlistarray['lstStoreSection'][0]['data']="$deliverytype"; $todayorrderlistarray['lstStoreSection'][0]['token']="$token"; $data=json_encode($todayorrderlistarray); $url = WEBAPI_URL_NEW.'common/get-delivery-info'; // Create a new cURL resource $ch = curl_init($url); // Setup request to send json via POST $payload =$data; curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BEARER); curl_setopt($ch,CURLOPT_XOAUTH2_BEARER,$token); // Attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); // Return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the POST request $result = curl_exec($ch); return $result; // Close cURL resource curl_close($ch); } function parseField($val) { return mysqli_real_escape_string($GLOBALS['conn'],strip_tags(trim($val))); } function s_group_by_arr_key($array, $key) { $return = array(); $sPrice = 0; foreach($array as $val) { $sPrice = $val['sPrice']*$val['sQty']; $return[$val[$key]]['price'] += $sPrice; } //print_r($array);die; return $return; } function zip_redirect_outside_us($zip, $redirectpage = 'moments') { if($zip){ if (strlen($zip) != 5 || !is_numeric($zip)) { //setcookie('url', '', time() - (3600), "/"); setcookie('postalcode', $zip, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day setcookie('url', ',', time() + (86400 * 30 * 12), "/"); // 86400 = 1 day header("Location:" . SITE_URL . $redirectpage); exit(); } }else{ AutoZipSet(); ?> <script> sessionStorage.zipcodepop = 1;</script> <?php } } function redirect301($url=false,$zip=false,$zipurl=false){ //echo $url.$zip.$zipurl; die; if($zip!=''){ setcookie('postalcode', $zip, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day $_COOKIE['postalcode']=$zip; } if($zipurl!=''){ setcookie('url', $zipurl, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day $_COOKIE['url']=$zipurl; } header("HTTP/1.1 301 Moved Permanently"); header("Location:" . SITE_URL.$url); exit; } function clean($string) { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. return rtrim(preg_replace('/-+/', '-', $string),'-'); // Replaces multiple hyphens with single one and remove last hyphen. } function clearlaravelcache($section,$parameter) { //$url = 'https://ormwebapi.quicklly.com/cache/'.$section.'/'.$parameter; $url = 'https://devrestapi.goquicklly.com/cache/'.$section.'/'.$parameter; // Create a new cURL resource $ch = curl_init($url); // Setup request to send json via POST /// $payload =$data; // Attach encoded JSON string to the POST fields //curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); // Set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); // Return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the POST request return $result = curl_exec($ch); } function sanitizeInputVar($val) { $string = preg_replace('/[^A-Za-z0-9\-]/', '', $val); // Removes special chars. return mysqli_real_escape_string($GLOBALS['conn'],strip_tags(trim($string))); } function cleanstring($string) { return preg_replace('/[^A-Za-z0-9\-]/', '-', $string); // Removes special chars. } function getContent($title) { $sql = mysqli_query($GLOBALS['conn'], "select * from tbl_content where title='$title' "); $result = mysqli_fetch_assoc($sql); return (stripslashes($result['content'])); } ?>
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
config.php
3.47 KB
lrwxrwxr-x
2024-09-20 17:35:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
db.class.php
14.24 KB
lrwxrwxr-x
2024-09-19 08:57:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
functions.php
27.21 KB
lrwxrwxr-x
2024-09-19 08:57:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
national_processing.php
26.46 KB
lrwxrwxr-x
2024-09-19 08:57:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Sendmail.php
5.23 KB
lrwxrwxr-x
2024-10-07 12:57:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
variable.php
1.92 KB
lrwxrwxr-x
2024-09-19 08:57:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).