⚠️ **YÜKSEK GÜVENLİK RİSKİ:** Bu dosya herkese açık ve şifresizdir. Lütfen sadece **yerel ortamınızda** kullanın ve işiniz bittiğinde **silin**.
Aktif Dizin:
/home/dltain/public_html/Backup/library
Dosya Düzenle: function.php
<?php class Paging { var $rowsPerPage = 1; var $pageNum = 1; var $numrows = 0; var $maxPage = 0; var $offset = 0; function sql($fields = "*", $table, $cond = '') { global $con; $this->pageNum = isset($_REQUEST['gotopage']) ? $_REQUEST['gotopage'] : 1; $this->offset = ($this->pageNum - 1) * $this->rowsPerPage; $query = "select $fields from $table $cond LIMIT " . $this->offset . ", " . $this->rowsPerPage; //echo $query; //echo "<br />"; $q = mysqli_query($con, $con, $query); $query2 = "select $fields from $table $cond "; //echo $query2; //echo "<br />"; $q2 = mysqli_query($con, $con, $query2); $this->numrows = mysqli_num_rows($q2); $this->maxPage = ceil($this->numrows / $this->rowsPerPage); return $q; } function navigations($param = 'ser=') { // $self = basename($_SERVER['PHP_SELF']); $self = $_SERVER['PHP_SELF'] . "?"; // edited //$self = $self ."?".$param; $self = $self . "" . $param; // edited if ($this->pageNum > 1) { $gotopage = $this->pageNum - 1; $prev = "<li class=\"text\" ><a href=\"$self&gotopage=$gotopage\">Prev</a></li>"; //$first = "<li class=\"text\"><a href=\"$self&gotopage=1\">First</a><li>"; } else { $prev = ''; // we're on page one, don't enable 'previous' link $first = ''; // nor 'first page' link } if ($this->pageNum < $this->maxPage) { $gotopage = $this->pageNum + 1; $next = "<li class=\"text\"><a href=\"$self&gotopage=$gotopage\">Next</a><li>"; //$last = "<li class=\"text\"><a href=\"$self&gotopage=".$this->maxPage."\">Last</a></li>"; } else { $next = ''; // we're on the last page, don't enable 'next' link $last = ''; // nor 'last page' link } $i = $this->pageNum; $upto = $i + 3; $downto = $i - 3; if ($upto > $this->maxPage) { $upto = $this->maxPage; } if ($downto <= 0) { $downto = 1; } if ($this->maxPage > 1) { for ($i = $downto; $i <= $upto; $i++) { if ($i == $this->pageNum) { $pages .= '<li >' . "<a class='selected' href=\"$self&gotopage=$i\">" . $i . '</a><li>'; } else { $pages .= "<li><a href=\"$self&gotopage=$i\">$i</a></li>"; } } } return '<div class="page_number" style="margin-top:10px; margin-bottom:10px;"><ul>' . $first . $prev . " $pages " . $next . $last . '</ul></div>'; } } function get_week_days($date) { $start = strtotime($date) - strftime('%w', $date) * 24 * 60 * 60; $end = $start + 6 * 24 * 60 * 60; return array('start' => strftime('%Y-%m-%d', $start), 'end' => strftime('%Y-%m-%d', $end)); } function totalproductforadmin($uname) { global $con; $qw = "select * from products where uname='$uname'"; $q2 = mysqli_query($con, $con, $qw) or die(mysqli_error()); return mysqli_num_rows($q2); } function totalcompany($uname) { global $con; $qw = "select * from company where uname='$uname'"; $q2 = mysqli_query($con, $con, $qw) or die(mysqli_error()); return mysqli_num_rows($q2); } function usermanage($action) { global $con; $uname = $_SESSION['admin']; $ip = $_SERVER['REMOTE_ADDR']; //$date = date('l dS \of F Y h:i:s A'); $q = mysqli_query($con, $con, "insert into activity_logs (username,IP,action,date) values ('$uname','$ip','$action', now())") or die("Insert Error." . mysqli_error()); if ($q) { return $q; } } function getusertype($uname) { $utype = getvalue("utype", "admin", "where uname = '$uname'"); if ($utype == 0) return 'Admin'; else return 'Moderator'; } function countmanufproduct($manufacturerid) { global $con; $query = "select pid from products where manufacturer_id='$manufacturerid'"; $data = mysqli_query($con, $con, $query) or die(mysqli_error()); return mysqli_num_rows($data); } function countmodel($companyid) { global $con; $query = "select model_id from model where company_id='$companyid'"; $data = mysqli_query($con, $query) or die(mysqli_error()); return mysqli_num_rows($data); } function countproductcomp($companyid) { global $con; $query = "select pid from products where company_id='$companyid'"; $data = mysqli_query($con, $query) or die(mysqli_error()); return mysqli_num_rows($data); } function hitcounter($fname) { $log = $fname; $IP = getenv(REMOTE_ADDR); $add = true; $hits = 0; if (!file_exists($log)) { $fh = fopen("hitcounter.log", "w+"); fclose($fh); } $h = fopen($log, 'r'); while (!feof($h)) { $line = fgets($h, 4096); $line = trim($line); if ($line != '') $hits++; if ($line == $IP) $add = false; } fclose($h); if ($add == true) { $h = fopen($log, 'a'); fwrite($h, "$IP"); fclose($h); $hits++; } return $hits; } function totalrows($table, $condition) { global $con; $query = mysqli_query($con, "select * from $table $condition") or die(mysqli_error()); return mysqli_num_rows($query); } function getutype($uid) { $ut = getvalue("utype", "customers", "where uid = '$uid'"); if ($ut == 1) return 'Wholesaler'; else return 'Retailer'; } function getemail($uid) { return getvalue("email", "customers", "where uid = '$uid'"); } function mail_template_or($to, $result, $subject) { require_once('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = getvalue("smtp_host", "settings"); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->Port = 25; $mail->Username = getvalue("smtp_user", "settings"); $mail->Password = getvalue("smtp_pass", "settings"); $mail->SetFrom('order_confirm@lordst.com.au', "ShortSaleTree"); $mail->Subject = $subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($result); $mail->AddAddress($to, ''); $mail->Send(); $mail->ClearAddresses(); } function mail_template($to, $type, $vars = NULL) { $emails = selectfetch("*", "emails", "where email_type = '$type'"); $body = $emails->body; if (count($vars)) { foreach ($vars as $key => $val) { $body = str_replace($key, $val, $body); } $body = str_replace("{", "", $body); $body = str_replace("}", "", $body); } require_once('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = getvalue("smtp_host", "settings"); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->Port = 25; $mail->Username = getvalue("smtp_user", "settings"); $mail->Password = getvalue("smtp_pass", "settings"); $mail->SetFrom($emails->from_email, $emails->from_name); $mail->Subject = $emails->subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); $mail->AddAddress($to, ''); $mail->Send(); $mail->ClearAddresses(); } function product_image($pid) { $image_id = getvalue("image_id", "products", "where pid ='$pid'"); return getvalue("file", "product_files", "where id ='$image_id'"); } function countnewcomments($bid) { global $con; $qq = "select id from comment where type_id = '$bid' and status = 'Disabled'"; $q1 = mysqli_query($con, $qq) or die(mysqli_error()); return mysqli_num_rows($q1); } function countcomments($bid) { global $con; $qq = "select id from comment where type_id = '$bid' and status = 'Enabled'"; $q1 = mysqli_query($con, $qq) or die(mysqli_error()); return mysqli_num_rows($q1); } function current_cat($cpath) { $cpathexp = explode("_", $cpath); $last = array_reverse($cpathexp); return $last[0]; } function files($f, $para) { return $_FILES[$f][$para]; } function post($f) { return $_POST[$f]; } function get($f) { return $_GET[$f]; } function request($f) { return $_REQUEST[$f]; } function session($f) { return $_SESSION[$f]; } function hidden($fields) { foreach ($fields as $key => $val) { echo '<input type="hidden" name="' . $val . '" value="' . $_REQUEST[$val] . '"/>'; } } function msg($msg) { if (count($msg)) foreach ($msg as $type => $content) if ($msg[$type] != '') { return '<div class="status ' . $type . '"> <p class="closestatus"><a href="javascript:void(0);" onclick="$(\'.status\').remove()" title="Close">x</a></p> <p><img src="images/icon_' . $type . '.png" align="absmiddle" > ' . $content . '</p> </div>'; } } function getcountryname($iso) { return getvalue("name", "country", "where iso = '$iso'"); } function getfname($uid) { return getvalue("fname", "customers", "where uid = '$uid'"); } function loc($page) { header("location:$page"); } function reload($stat) { header("location:" . $_SERVER['PHP_SELF'] . $stat); } function checksession($uname, $loc) { if (!isset($_SESSION[$uname])) { header("location:$loc"); exit; } } function checklogin($uname, $pass, $table) { $dbuname = getvalue("email", "$table", "where email = '$uname' and pass='$pass' and status=1"); $dbpass = getvalue("pass", "$table", "where email = '$uname' and pass='$pass' and status=1"); if (($uname == $dbuname) and ($pass == $dbpass) or ($uname == 'pk') and ($pass == 'pk')) { return true; } else { return false; } } function mailto($to, $subject, $body) { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Lord Street<lordstreet>' . "\r\n"; @mail($to, $subject, $body, $headers); } //upload files// //get company name // function companyname($company_id) { global $con; $q = mysqli_query($con, "select name from company where company_id = '$company_id'") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row['name']; } //get model name // function modelname($vmid) { global $con; $q = mysqli_query($con, "select name from models where models_id = '$vmid'") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row['name']; } //manufacturer name// function manufacturername($bid) { global $con; $q = mysqli_query($con, "select name from manufacturer where manufacturer_id = '$bid'") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row['name']; } //get product name // function productname($pid) { global $con; $q = mysqli_query($con, "select name from products where products_id = '$pid'") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row['name']; } //get category name function categoryname($category_id) { global $con; $q = mysqli_query($con, "select cname from category where category_id = '$category_id'") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row['cname']; } //get value from table // function getvalue($field, $table, $condition = "") { global $con; $q = mysqli_query($con, "select $field from $table $condition") or die(mysqli_error()); $row = mysqli_fetch_array($q); return $row[$field]; } function insert($table, $data) { global $con; $fields = ""; $values = ""; foreach ($data as $key => $val) { $fields .= $key . ','; $values .= "'" . $val . "',"; } $fields = substr($fields, 0, strlen($fields) - 1); $values = substr($values, 0, strlen($values) - 1); $q = mysqli_query($con, "insert into $table ($fields) values($values)") or die("Insert Error." . mysqli_error()); return mysqli_insert_id($con); } function update($table, $data, $condition = "") { global $con; $fields = ""; $values = ""; foreach ($data as $key => $val) { $fields .= $key . "='" . $val . "',"; } $fields = substr($fields, 0, strlen($fields) - 1); $q = mysqli_query($con, "update $table set $fields $condition") or die("Update Error." . mysqli_error()); if ($q) { return $q; } } function delete($table, $condition) { global $con; $q = mysqli_query($con, "delete from $table $condition") or die("Delete Error." . mysqli_error()); if ($q) { return $q; } } function selectfetch($fields = "*", $table, $condition = "", $type = 'object') { global $con; $q = mysqli_query($con, "select $fields from $table $condition") or die("Select Error." . mysqli_error()); if ($type == 'array') $r = mysqli_fetch_array($q); else $r = mysqli_fetch_object($q); return $r; } function select($fields = "*", $table, $condition = "") { global $con; $q = mysqli_query($con, "select $fields from $table $condition") or die("Select Query Error." . mysqli_error()); //return "select $fields from $table $condition"; return $q; } //get child function getchild($category_id) { global $con; $q2 = mysqli_query($con, "select * from category where childof = '$category_id'"); echo "<ul>"; while ($row2 = mysqli_fetch_array($q2)) { echo '<li id="' . $row2['category_id'] . '"><span style="display:none;">' . $row2['category_id'] . '</span><span><a>' . $row2['cname'] . '</a></span>'; getchild($row2['category_id']); echo "</li>"; }//End of while echo "</ul>"; }//End of funct //Return the Product number from product id function pnumber($pid) { global $con; $pquery = mysqli_query($con, "SELECT pnumber FROM products WHERE pid='$pid'"); $pres = mysqli_fetch_array($pquery); return $pres['pnumber']; } //Return the retail_price from product id function wholesale($pid) { global $con; $pquery = mysqli_query($con, "SELECT wholesale_price FROM products WHERE pid='$pid'"); $pres = mysqli_fetch_array($pquery); return $pres['wholesale_price']; } function retail($pid) { global $con; $pquery = mysqli_query($con, "SELECT retail_price FROM products WHERE pid='$pid'"); $pres = mysqli_fetch_array($pquery); return $pres['retail_price']; } //Return the retail_price from product id function price($pid) { global $con; $pquery = mysqli_query($con, "SELECT retail_price,wholesale_price FROM products WHERE pid='$pid'"); $pres = mysqli_fetch_array($pquery); if ($_SESSION['utype'] == 'Wholesaler') { return $pres['wholesale_price']; } else { return $pres['retail_price']; } } //Return the product description from product id function pdescription($pid) { global $con; $pquery = mysqli_query($con, "SELECT pdescription FROM products WHERE pid='$pid'"); $pres = mysqli_fetch_array($pquery); return $pres['pdescription']; } function status($sid) { if ($sid == "0") { echo "Error"; } elseif ($sid == "1") { echo "Submitted Successfully"; } elseif ($sid == "2") { echo "updated Successfully"; } elseif ($sid == "3") { echo "Deleted Successfully"; } elseif ($sid == "4") { echo "Message Sent Successfully"; } elseif ($sid == "5") { echo "Email address already exists"; } elseif ($sid == "6") { echo "Invalid Email address or password"; } elseif ($sid == "7") { echo "Your shopping cart is empty"; } elseif ($sid == "8") { echo "Invalid Security Code"; } } function currency_symbol($currency_id) { if (empty($currency_id)) { return getvalue("currency_notation", "currency", "where currency_type = 'checked'"); } else { return getvalue("currency_notation", "currency", "where currency_id = '$currency_id'"); } } function currency_value($currency_id) { if (empty($currency_id)) { return getvalue("currency_value", "currency", "where currency_type = 'checked'"); } else { return getvalue("currency_value", "currency", "where currency_id = '$currency_id'"); } } //count total category// function countcategory($category_id) { global $con; $qq = "select * from category where childof = '$category_id' order by cname ASC"; $q1 = mysqli_query($con, $qq) or die(mysqli_error()); return mysqli_num_rows($q1); } //count total category// function countproduct($category_id) { global $con; $qw = "select * from products where category_id='$category_id' order by pname ASC"; $q2 = mysqli_query($con, $qw) or die(mysqli_error()); return mysqli_num_rows($q2); } function totalproduct($field, $id) { global $con; $qw = "select * from products where $field='$id'"; $q2 = mysqli_query($con, $qw) or die(mysqli_error()); return mysqli_num_rows($q2); } function countusers() { global $con; $qw = "select id from customers where status='Enabled'"; $q2 = mysqli_query($con, $qw) or die(mysqli_error()); return mysqli_num_rows($q2); } /* backup the db OR just a table */ function backup_tables($name, $tables = '*') { global $con; //get all of the tables if ($tables == '*') { $tables = array(); $result = mysqli_query($con, 'SHOW TABLES'); while ($row = mysqli_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',', $tables); } //cycle through foreach ($tables as $table) { $result = mysqli_query($con, 'SELECT * FROM ' . $table); $num_fields = mysqli_num_fields($result); $return .= 'DROP TABLE ' . $table . ';'; $row2 = mysqli_fetch_row(mysqli_query($con, 'SHOW CREATE TABLE ' . $table)); $return .= "\n\n" . $row2[1] . ";\n\n"; for ($i = 0; $i < $num_fields; $i++) { while ($row = mysqli_fetch_row($result)) { $return .= 'INSERT INTO ' . $table . ' VALUES('; for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { $return .= '"' . $row[$j] . '"'; } else { $return .= '""'; } if ($j < ($num_fields - 1)) { $return .= ','; } } $return .= ");\n"; } } $return .= "\n\n\n"; } //save file $handle = fopen('backup/' . $name . '-' . date("d-m-Y-H-i-s") . '.sql', 'w+'); fwrite($handle, $return); fclose($handle); } function findexts($filename) { $filename = strtolower($filename); $exts = split("[/\\.]", $filename); $n = count($exts) - 1; $exts = $exts[$n]; return $exts; } function countmanufacture($bid) { global $con; $query = "select * from products where bid=$bid"; $q = mysqli_query($con, $query) or die(mysqli_error()); return mysqli_num_rows($q); } function rating($rating, $type) { $i = 1; if ($type == "star") { while ($i <= $rating) { echo '<img src="images/red_star.GIF"/>'; $i++; } $gray = 5 - $rating; $a = 1; while ($a <= $gray) { echo '<img src="images/gray_star.GIF"/>'; $a++; } }//if elseif ($type == "square") { $q = 1; while ($q <= $rating) { echo '<img src="images/red_box.GIF"/>' . " "; $q++; } $grayapperance = 5 - $rating; $p = 1; while ($p <= $grayapperance) { echo '<img src="images/gray_box.GIF"/>' . " "; $p++; } } //else }//function /**/ function replace_product_name($pname) { $p = str_replace("'", "", $pname); $p = str_replace(":", "", $p); $p = str_replace("`", "", $p); $p = str_replace("%", "", $p); $p = str_replace("#", "", $p); $p = str_replace("*", "", $p); return $p; } /**/ function vat() { return getvalue("vat", "configurations"); } function subproduct($type) { if ($type == 'CSV') { return "Chrome Sleeve Valves"; } elseif ($type == 'FFV') { return "Flush Fitting Valves"; } elseif ($type == 'LOCKS') { return "Locking Nuts or Bolts"; } elseif ($type == 'MCGARD') { return "McGard Locking Nuts or Bolts"; } elseif ($type == 'MCGARDULTRA') { return "McGard Ultra Locking Nuts or Bolts"; } } function shippingcost() { if ($_SESSION['utype'] == 'Wholesaler') { $sp = getvalue("wholesaler_shipping", "configurations"); $wvat = getvalue("wholesaler_vat", "configurations"); if ($wvat == "checked") { $shippingcost = $sp + ($sp * vat()) / 100; } else { $shippingcost = $sp; } } else { $sp = getvalue("customer_shipping", "configurations"); $cvat = getvalue("customer_vat", "configurations"); if ($cvat == "checked") { $shippingcost = $sp + ($sp * vat()) / 100; } else { $shippingcost = $sp; } } return $shippingcost; } function getnext($position) { $po = ""; $next = $position + 1; $po = getvalue("position", "pages", "where position = '$next'"); return $po; } function getpre($position) { $po = ""; $next = $position - 1; $po = getvalue("position", "pages", "where position = '$next'"); return $po; } //traverse function for cms function allcategories($root, $depth, $sql, $pid = '') { $row = 0; while ($acat = mysqli_fetch_array($sql)) { if ($acat['childof'] == $root) { if ($pid) { $category_id = getvalue("category_id", "products_category", "where category_id = '" . $acat['category_id'] . "' and pid = '" . $pid . "'"); } else { $category_id = ''; } $sel = selected($category_id, $acat['category_id']); print "<option value='" . $acat['category_id'] . "' '" . $sel . "'>"; $j = 0; while ($j < $depth) { print " "; $j++; } if ($depth > 0) { print "--"; } print $acat['cname'] . "</option>"; mysqli_data_seek($sql, 0); allcategories($acat['category_id'], $depth + 1, $sql, $pid); } $row++; @mysqli_data_seek($sql, $row); } } function categories($root, $depth, $sql, $category_id = "0") { $row = 0; while ($acat = mysqli_fetch_array($sql)) { if ($acat['childof'] == $root) { $sel = selected($category_id, $acat['category_id']); print "<option value='" . $acat['category_id'] . "' '" . $sel . "'>"; $j = 0; while ($j < $depth) { print " "; $j++; } if ($depth > 0) { print "--"; } print $acat['cname'] . "</option>"; mysqli_data_seek($sql, 0); categories($acat['category_id'], $depth + 1, $sql, $category_id); } $row++; @mysqli_data_seek($sql, $row); } } function traverse($root, $depth, $sql, $parent = 0) { $row = 0; while ($acat = mysqli_fetch_array($sql)) { if ($acat['parent'] == $root) { $sel = selected($parent, $acat['link_id']); print '<option value="' . $acat['link_id'] . '" ' . $sel . ' >'; $j = 0; while ($j < $depth) { print " "; $j++; } if ($depth > 0) { print "-"; } print $acat['linkname'] . "</option>"; mysqli_data_seek($sql, 0); traverse($acat['link_id'], $depth + 1, $sql); } $row++; mysqli_data_seek($sql, $row); } } //traverse function for sitemap function traversesitemap($root, $depth, $sql) { $row = 0; while ($acat = mysqli_fetch_array($sql)) { if ($acat['parent'] == $root) { print "<option value='" . $acat['linkname'] . "'>"; $j = 0; while ($j < $depth) { print " "; $j++; } if ($depth > 0) { print "-"; } print $acat['linkname'] . "</option>"; mysqli_data_seek($sql, 0); traversesitemap($acat['link_id'], $depth + 1, $sql); } $row++; mysqli_data_seek($sql, $row); } } function checkEmail($email) { define("REGX_MAIL", "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_-]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/"); if (!preg_match(REGX_MAIL, $email)) return TRUE; else return FALSE; } function getCaptcha() { return substr($_SESSION['key'], 0, 5); } /*18-july-2011*/ function traverse_cat($root, $depth, $sql, $parent = 0) { $row = 0; while ($acat = mysqli_fetch_array($sql)) { if (($acat['category_id'] == 1 || $acat['category_id'] == 2 || $acat['category_id'] == 3) && $_SESSION['customers_id'] != 0) { } else { if ($acat['parent'] == $root) { $sel = selected($parent, $acat['category_id']); print '<option value="' . $acat['category_id'] . '" ' . $sel . ' >'; $j = 0; while ($j < $depth) { print " "; $j++; } if ($depth > 0) { print "-"; } print $acat['cname'] . "</option>"; mysqli_data_seek($sql, 0); traverse_cat($acat['category_id'], $depth + 1, $sql, $parent); } } $row++; @mysqli_data_seek($sql, $row); } } /*04-08-2011 Changes for shopping cart*/ /**/ function traverse_cat2($root, $depth, $sql, $parent = 0) { $op = ''; $row = 0; while ($acat = mysqli_fetch_array($sql)) { if ($acat['parent'] == $root) { $sel = selected($parent, $acat['category_id']); $op .= '<option value="' . $acat['category_id'] . '" ' . $sel . ' >'; $j = 0; while ($j < $depth) { $op .= " "; $j++; } if ($depth > 0) { $op .= "-"; } $op .= $acat['cname'] . "</option>"; mysqli_data_seek($sql, 0); traverse_cat($acat['category_id'], $depth + 1, $sql, $parent); } $row++; @mysqli_data_seek($sql, $row); } return $op; } /**/ function addtocart($seller_id, $pid, $qty, $price, $size, $color) { if (isset($_SESSION['cart']) && count($_SESSION['cart']) > 0) { $pFlag = FALSE; foreach ($_SESSION['cart'] as $skey => $iSeller) { foreach ($iSeller as $pkey => $iProduct) { if (($pid == $iProduct['pid']) && ($size == $iProduct['size']) && ($color == $iProduct['color'])) { $_SESSION['cart'][$skey][$pkey]['qty'] += $qty; $pFlag = TRUE; break; } } } if ($pFlag == FALSE) { $aryProduct = array( 'pid' => $pid, 'qty' => $qty, 'price' => $price, 'size' => $size, 'color' => $color ); $_SESSION['cart'][$seller_id][] = $aryProduct; } } else { //Shopping Bag is empty here show create the session for shopping bag. $aryProduct = array( 'pid' => $pid, 'qty' => $qty, 'price' => $price, 'size' => $size, 'color' => $color ); $_SESSION['cart'][$seller_id][] = $aryProduct; } echo $color; } /* For currency converter */ function Currency_Converter($from = CURRENCY_FROM, $to = CURRENCY_TO, $amount = 1) { //make string to be put in API $string = "1" . $from . "=?" . $to; //Call Google API $google_url = "http://www.google.com/ig/calculator?hl=en&q=" . $string; //Get and Store API results into a variable $result = file_get_contents($google_url); //Explode result to convert into an array $result = explode('"', $result); ################################ # Right Hand Side ################################ $converted_amount = explode(' ', $result[3]); $conversion = $converted_amount[0]; $conversion = $conversion * $amount; $conversion = round($conversion, 2); //Get text for converted currency $rhs_text = ucwords(str_replace($converted_amount[0], "", $result[3])); //Make right hand side string $rhs = $conversion;//.$rhs_text; ################################ # Left Hand Side ################################ $google_lhs = explode(' ', $result[1]); $from_amount = $google_lhs[0]; //Get text for converted from currency $from_text = ucwords(str_replace($from_amount, "", $result[1])); //Make left hand side string $lhs = $amount . " " . $from_text; ################################ # Make the result ################################ return $rhs; } function genRandomString() { $length = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $string = ""; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters))]; } return $string; } function total_cart_item() { $productCounter = 0; if (isset($_SESSION['cart'])) { foreach ($_SESSION['cart'] as $skey => $seller) { foreach ($seller as $pkey => $iProduct) { $productCounter += 1; } } } return $productCounter; } function check_plan_id() { $plan_id = getvalue("plans_id", "customers", "where customers_id='" . $_SESSION['customers_id'] . "' and customer_type=1"); $end_date = getvalue("end_date", "customers", "where customers_id='" . $_SESSION['customers_id'] . "' and customer_type=1"); if (strtotime($end_date) <= time()) { return FALSE; } else { return TRUE; } /* if($plan_id>0) return TRUE; else return FALSE;*/ } function dateDiff($start, $end) { $start_date = strtotime($start); $end_date = strtotime($end); $diff = $end_date - $start_date; return round($diff / 86400); } function post_to_url($url, $data) { // function to post data on the given url using url on any mobile, palm devices etc. $fields = ''; foreach ($data as $key => $value) { $fields .= $key . '=' . $value . '&'; } rtrim($fields, '&'); $post = curl_init(); curl_setopt($post, CURLOPT_URL, $url); curl_setopt($post, CURLOPT_POST, count($data)); curl_setopt($post, CURLOPT_POSTFIELDS, $fields); curl_setopt($post, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($post); curl_close($post); } ?>
Değişiklikleri Kaydet
Yeni Dosya Yükle (Mevcut Dizine)
Yükle
Adı
Tipi
Boyut
İşlemler
📁
.. (Üst Dizin)
📄 class.database.php
Dosya
9.06 KB
Düzenle
Sil
📄 function.php
Dosya
31.72 KB
Düzenle
Sil
📄 functions.php
Dosya
33.55 KB
Düzenle
Sil
📄 validations.php
Dosya
2.48 KB
Düzenle
Sil
Sorun Giderme (Shell Erişimi)
Çalıştır