REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 12.46 KB
Close
/home/godevadmin/www/admin/braintree/final/functions.php
Text
Base64
<?php 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 getCategoryTree($cat_id,$array){ $array[]=$cat_id; $parent=getParent($cat_id); if($parent!=0){ $array[]=$parent; return( getCategoryTree($parent,$array)); }else{ $tree=''; if($array!=''){ $array=array_unique($array); $array=array_reverse($array); foreach($array as $key=>$val){ $tree= $tree.getMainCategory($val)." >>"; } return( substr( $tree,0,-2)); }else{ return( 'Main Category'); } } } function getCategoryIDTree($cat_id,$array){ $array[]=$cat_id; $parent=getParent($cat_id); if($parent!=0){ $array[]=$parent; return( getCategoryIDTree($parent,$array)); }else{ $tree=''; if($array!=''){ $array=array_unique($array); $array=array_reverse($array); //print_r($array); foreach($array as $key=>$val){ $tree= $tree.$val.","; } return( substr( $tree,0,-1)); }else{ return( 'Main Category'); } } } function getCategoryArray($cat_id,$array){ $array[]=$cat_id; $parent=getParent($cat_id); if($parent!=0){ $array[]=$parent; return( getCategoryArray($parent,$array)); }else{ $array=array_unique($array); $array=array_reverse($array); return($array); } } function getMainParent($cat_id){ $arr=getCategoryArray($cat_id,$array=''); return ($arr[0]); } function getParent($pid){ $sql=mysql_query("select parent_id from tbl_maincategory where id='$pid'"); $result=mysql_fetch_assoc($sql); return ($result['parent_id']); } function getParentname($p_id){ $sql=mysql_query("select maincategory from tbl_maincategory where id='$p_id'"); $result=mysql_fetch_assoc($sql); return ($result['maincategory']); } function getgrandParent($p_id){ $sql=mysql_query("select maincategory from tbl_maincategory where id='$p_id'"); $result=mysql_fetch_assoc($sql); return ($result['maincategory']); } function getMainCategory($catid){ $sql=mysql_query("select maincategory from tbl_maincategory where id='$catid'"); $result=mysql_fetch_assoc($sql); return ($result['maincategory']); } function getDeliveryEstimate($cat_id){ $sql=mysql_query("select min_days,max_days,dayshour from tbl_deliveryestimate where cat_id='$cat_id'"); $rs=mysql_fetch_assoc($sql); if($rs[min_days]==0 && $rs[max_days]==0 ){ $str=''; }else{ $str="Typically delivered in "; if($rs[max_days]!=0){ $str.=$rs[min_days]." - ".$rs[max_days]; }else{ $str.=$rs[min_days]; } $str.=" Business"; if($rs[dayshour]==1){ $str.=" Days"; }else{ $str.=" Hours"; } $str.=""; } return ($str); } function CalculateOrderTime($order_date){ $order_time=''; $diff = abs(time() - strtotime($order_date)); $years = floor($diff / (365*60*60*24)); $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); $hours = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 -$days*60*60*24)/ (60*60)); $minutes = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 -$days*60*60*24-$hours*60*60)/ (60)); $seconds = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 -$days*60*60*24-$hours*60*60-$minutes*60)); if($years>0){$order_time.=$years." Years ";} if($months>0){$order_time.=$months." Months ";} if($days>0){$order_time.=$days." Days ";} if($hours>0){$order_time.=$hours." Hours ";} if($minutes>0){$order_time.=$minutes." Min ";} if($seconds>0){$order_time.=$seconds." Sec ";} $order_time.=" Ago "; return($order_time); } function getRewardPoints($user_id){ $pointArr=mysql_query("select sum(reward_point) as credit from tbl_reward_history where user_id='".$user_id."' and type='Cr'"); $rs=mysql_fetch_object($pointArr); $total_cr=$rs->credit; $pointArr=mysql_query("select sum(reward_point) as debit from tbl_reward_history where user_id='".$user_id."' and type='Dr'"); $rs=mysql_fetch_object($pointArr); $total_dr=$rs->debit; $current_points=$total_cr-$total_dr; return($current_points); } 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 getYouTubeVideo($url){ $a=explode('v=',$url); $b=explode('&',$a[1]); return ("http://www.youtube.com/embed/".$b[0]); } 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=mysql_query("select id from $tbl where slug='$myurl' "); if(mysql_num_rows($query)>0){ $myurl=$myurl.$id; mysql_query("update $tbl set slug='$myurl' where id='$id' "); }else{ mysql_query("update $tbl set slug='$myurl' where id='$id' "); } } function buildURL($url){ $newurl=str_replace(" - "," ",$url); $myurl=str_replace("--","-",str_replace("%","",str_replace(" ","-",str_replace("-"," ",trim(str_replace("/"," ",str_replace(",","",str_replace(".","",$newurl)))))))); return stripslashes(strtolower($myurl)); } function parseInput($val) { return mysql_real_escape_string(stripslashes($val)); } function encryptPassword($val) { return sha1($val); } function getAdminEmail(){ $sql=mysql_query("select email from tbl_admin where id=1"); $result=mysql_fetch_assoc($sql); return ($result['email']); } function getFieldWhere($filed,$tbl,$where,$id){ $sql=mysql_query("select $filed as field from $tbl where $where='".$id."'"); $result=mysql_fetch_assoc($sql); return (stripslashes($result['field'])); } function getTotalCredit($user_id){ $sql=mysql_query("select sum(credit_points) as tot_credit from tbl_credit_points where user_id='".$user_id."'"); $result=mysql_fetch_assoc($sql); return (stripslashes($result['tot_credit'])); } function getCategory($cat_id){ $sql=mysql_query("select * from tbl_category where id='".$cat_id."'"); $result=mysql_fetch_assoc($sql); return (stripslashes($result['category'])); } function getProductListingName($pname){ $pname=stripslashes(trim($pname)); /*$spos=strpos($pname," "); $pfname=substr($pname,0,$spos); $plname=substr($pname,$spos); $pname="<span>".$pfname."</span><br>".$plname;*/ if(strlen($pname)>20){ $pname=substr($pname,0,20).".."; return(ucwords(strtolower($pname))); } return(ucwords(strtolower($pname))); } function getSubcategory($cat_id){ $sql=mysql_query("select * from tbl_subcategory where id='".$cat_id."'"); $result=mysql_fetch_assoc($sql); return (stripslashes($result['subcategory'])); } function getFAQCategory($cat_id){ $sql=mysql_query("select * from tbl_faqcategory where id='".$cat_id."'"); $result=mysql_fetch_assoc($sql); return (stripslashes($result['faqcategory'])); } function getUser($uid){ $sql=mysql_query("select uname from tbl_user where id='".$uid."'"); $result=mysql_fetch_assoc($sql); return (stripslashes(ucfirst($result['uname']))); } function getContent($title) { $sql=mysql_query("select * from tbl_content where title='$title' "); $result=mysql_fetch_assoc($sql); return (stripslashes($result['content'])); } function getField($filed,$table,$id) { $sql=mysql_query("select $filed as field from $table where id='$id' "); $result=mysql_fetch_assoc($sql); 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("login.php"); } } function showSessionMsg() { if(trim($_SESSION["sess_msg"])) { echo $_SESSION["sess_msg"]; $_SESSION["sess_msg"] = ""; } } function validate_user() { if($_SESSION['sess_uid']=='') { ms_redirect("index.php?back=$_SERVER[REQUEST_URI]"); } } function validate_admin() { if($_SESSION['sess_admin_id']=='') { ms_redirect("index.php?back=$_SERVER[REQUEST_URI]"); } } function ms_redirect($file, $exit=true, $sess_msg='') { header("Location: $file"); exit(); } function sort_arrows($column){ global $_SERVER; return '<A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'asc')).'"><IMG SRC="images/white_up.gif" BORDER="0"></A> <A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'desc')).'"><IMG SRC="images/white_down.gif" BORDER="0"></A>'; } function sort_arrows1($column){ global $_SERVER; return '<A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'asc')).'"><IMG SRC="simg/white_up.gif" BORDER="0"></A> <A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'desc')).'"><IMG SRC="simg/white_down.gif" BORDER="0"></A>'; } function sort_arrows_front($column,$heading){ global $_SERVER; return '<A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'asc')).'"><img src="simg/sort_up.gif" alt="Sort Up" border="0" title="Sort Up"></A> '.$heading.' <A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'desc')).'"><img src="simg/sort_down.gif" alt="Sort Down" border="0" title="Sort Down"></A>'; } function sort_arrows_front1($column,$heading){ global $_SERVER; return '<A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'asc')).'"><img src="simg/sort_up.gif" alt="Sort Up" border="0" title="Sort Up"></A> '.$heading.' <A HREF="'.$_SERVER['PHP_SELF'].get_qry_str(array('order_by','order_by2'), array($column,'desc')).'"><img src="simg/sort_down.gif" alt="Sort Down" border="0" title="Sort Down"></A>'; } function get_qry_str($over_write_key = array(), $over_write_value= array()) { global $_GET; $m = $_GET; if(is_array($over_write_key)){ $i=0; foreach($over_write_key as $key){ $m[$key] = $over_write_value[$i]; $i++; } }else{ $m[$over_write_key] = $over_write_value; } $qry_str = qry_str($m); return $qry_str; } function qry_str($arr, $skip = '') { $s = "?"; $i = 0; foreach($arr as $key => $value) { if ($key != $skip) { if(is_array($value)){ foreach($value as $value2){ if ($i == 0) { $s .= "$key%5B%5D=$value2"; $i = 1; } else { $s .= "&$key%5B%5D=$value2"; } } }else{ if ($i == 0) { $s .= "$key=$value"; $i = 1; } else { $s .= "&$key=$value"; } } } } return $s; } function getBusinessRating($id){ $sql=mysql_query("select avg(rating_score) as rating from tbl_rating where status=1 and product_id='$id' "); $result=mysql_fetch_assoc($sql); return (stripslashes($result['rating'])); } function cookiezip(){ //if(!isset($_COOKIE[myvalue365zipcode])) { if($_POST['submit']=='FIND STORES' && $_POST['zip']!==''){ $cookie_name = "myvalue365zipcode"; $cookie_value = mysqli_real_escape_string($GLOBALS['conn'], $_POST['zip']); setcookie($cookie_name, $cookie_value, time() + (86400 * 365) , "/"); // 86400 = 1 day header("location:category.php"); exit; } } ?>
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 7 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
braintree
DIR
-
drwxrwxr-x
2023-11-07 19:59:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
braintree2
DIR
-
drwxrwxr-x
2023-11-07 19:59:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
braintree_php-master
DIR
-
drwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
css
DIR
-
drwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fonts
DIR
-
drwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
images
DIR
-
drwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
javascript
DIR
-
drwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
brain2.php
4.55 KB
lrwxrwxr-x
2023-11-07 19:59:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
checkout.php
737 B
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
curl2.php
556 B
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
error_log
79.75 KB
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
functions.php
12.46 KB
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.php
900 B
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index_21_7_2017.php
2.62 KB
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index_22_7.php
4.08 KB
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
result.php
912 B
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rss.xml
252 B
lrwxrwxr-x
2023-11-07 19:59:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
transaction.php
6.85 KB
lrwxrwxr-x
2023-11-07 19:59:46
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).