Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try <?php $query = mysql_query("SELECT * FROM $local_database.shopping_cart_contents WHERE shopping_cart_id = '$_SESSION[shopping_cart_id]'", $b_link); while ($row = mysql_fetch_assoc($query)) { // foreach ($row['product_vendor'] as $vendor) { $vendor = $row['product_vendor']; # Determine if it has preset shipping or not if ($row['preset_shipping'] == "yes") { # If it does have preset shipping, determine if it is set or free if ($row['preset_shipping_set_or_free'] == "set") { # If the preset shipping is set, then use the preset shipping fee for the shipping rate * the quantity of that item $shipping_rate = $row['preset_shipping_fee'] * $row['shopping_cart_contents_qty']; } if ($row['preset_shipping_set_or_free'] == "free") { # If the preset shipping is free, then the shipping rate is free $shipping_rate = 0; } } if ($row['preset_shipping'] == "no") { # If it does not have preset shipping, calculate the shipping based on the to and from zipcodes and the total combined weight of how many of that item there are // foreach ($row['product_id'] as $product) { $sub_total_weight = $row['product_weight'] * $row['shopping_cart_contents_qty']; // } $total_weight = $sub_total_weight; if (isset($_POST['service'])) {$service = $_POST['service'];}else{$service = '03';} $length = '5'; $width = '5'; $height = '5'; $shipping_rate = ups($row['vendor_zipcode'],$shipping_zipcode,$service,$total_weight,$length,$width,$height); } //} if (isset($sub_total_shipping_price[$vendor]))$sub_total_shipping_price[$vendor] += $shipping_rate; else $sub_total_shipping_price[$vendor] = $shipping_rate; } print_r($sub_total_shipping_price); echo "\n<br />", array_sum($sub_total_shipping_price); ?>
  2. try $query = mysql_query("SELECT * FROM `Log` ORDER BY ID DESC") or die ("error in query" . mysql_error());
  3. try $pattern = '/<span id="testid">.*?<\/span>/';
  4. try <?php function generate_standard_text(&$vars, &$adgroup_array) { $standard_text = ""; // init results string to return if($vars['type'] == "standard"){ foreach ($adgroup_array as $adgroup){ $adgroup = trim($adgroup); $standard_text = "$adgroup\n"; if($vars['Phrase_Match']){ $standard_text1 = ""$adgroup"\n"; } if($vars['Exact_Match']){ $standard_text2 = "[$adgroup]\n"; } if($vars['Negative_Match']){ $standard_text3 = "-$adgroup\n"; } $out .= $standard_text.$standard_text1.$standard_text2.$standard_text3; } } return $out; // return results string } ?>
  5. try <?php $result=city::getDisplayName($id); echo $result; ?> remove ' around variable
  6. try <?php $test = 'MT9L2BGQGJC547VN4JT4Z8WY9FKFGZC'; $part = array(); $part[] = substr($test,0,2); $test =substr($test,2); $part[] = substr($test,0,4); $test =substr($test,4); while (strlen($test)){ $part[] = substr($test,0,5); $test =substr($test,5); } echo $out = implode('-', $part); ?>
  7. try <?php $test = array('test@test', 'test@test.com', 'test@test@test.com', 'john@google.com.com'); foreach ($test as $a){ echo $a, ' - '; echo preg_match('/^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.?[a-zA-Z0-9\-]+$/', $a), "<br />\n"; } ?>
  8. SELECT * FROM (SELECT `id`, `format` FROM `test` WHERE `cat`='$cat' ORDER BY `bid` DESC LIMIT 4) ORDER BY RAND()
  9. try <?php function find_dir($needle, $file = 'test.txt'){ $needle = '/'.trim($needle); $lines = file($file); foreach ($lines as $line){ $line = trim($line); if (strpos($line, $needle)){ $out = str_replace($needle, '',$line); $out = str_replace('//', '',$out); $out = explode('/', $out); return '<a href="file://'.implode('\\',$out).'">'.$out[count($out)-1].'</a>'; } } return false; } echo find_dir('mypic.tif'); ?>
  10. <?php $array = array('a'=> 11, 'b' => 'sasa'); echo " it is OK {$array['a']}"; //echo " it is not OK $array['a']";// array key not have '' echo " it is OK $array[a]"; $key = 'a'; echo " it is OK {$array[$key]}"; echo " it is OK $array[$key]"; ?>
  11. try <?php $db=mysql_connect("localhost", "unlimite_customers", "*******") or die("Could not connect to localhost."); mysql_select_db("unlimite_customers", $db) or die("Could not find customers."); $querySQL = "insert into customers (name, address, line1, line2, postcode, county, country, phone, contact , paypal, domain, username, password, plan, comments) values ($name, $address, $line1, $line2, $postcode, $county, $country, $phone, $contact , $paypal, $domain, $username, $password, $plan, $comments)"; mysql_query($querySQL) or die(mysql_error()); ?>
  12. try <? $msg = "Name:\t$_POST[name]\n"; $msg .= "Telephone:\t$_POST[phone]\n"; $msg .= "Email:\t$_POST[email]\n"; $msg .= "How do you wish to be contacted?:\t$_POST[contacted]\n"; $msg .= "Comments:\t$_POST[comments]\n"; $to = "email@domainname.com"; $subject = "Contact Us"; $mailheaders = "From: email@domainname.com <> \n"; mail($to, $subject, $msg, $mailheaders); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Web Site Title</title> </head> <body> <meta http-equiv="Refresh" content="0; url=thankyou.htm"> </body> </html>
  13. in function current_user change echo to return
  14. $url = rand(1,100)<=30 ? $url2 : $url1;
  15. <?php $strCart= ":New Arrival Collection :10.00 :1 :10.00 :Anturium Five :10.00 :2 :20.00"; $sngTotal=0.0; $strThisEntry= $strCart; $strBasket=""; $iBasketItems=0; $theItems = explode(":",$strCart); $strBasket = ''; $i = 1; while ($i < count($theItems)) { $item = $theItems[$i++]; $full_price = $theItems[$i++]; $quantity = $theItems[$i++]; $total = $theItems[$i++]; $strBasket .= 'Item:'. $item.'<br />'; $strBasket .= 'Quantity:'. $quantity.'<br />'; $strBasket .= 'Price (-tax):'. number_format($total/1.175,2).'<br />'; $strBasket .= 'Tax:'. number_format($total*7/47,2).'<br />'; $strBasket .= 'Full Price:'. number_format($full_price,2).'<br />'; $strBasket .= 'Row Total:'. number_format($total,2).'<br />'; $iBasketItems++; } // add delivery to the total and the basket //$sngTotal=$sngTotal+1.50; $strBasket= 'Items in basket:'.$iBasketItems . '<br />' . $strBasket . ":Delivery:1:5.00:---:5.00:5.00"; echo $strBasket ; ?>
  16. you change > to > ($Text = str_replace(">", ">", $Text) and you can't find any '>' character
  17. try <?php $ret = '[72 Stone Fist] Yuari (Iksar) zone: gfaydark AccID: 298 AccName: Flora LSID: 110561 Status: 0 [72 Soothsayer] Kefus (Iksar) zone: qrg AccID: 307 AccName: Nerine LSID: 110954 Status: 0 [74 Wildblood] Tigger (Vah Shir) zone: gukbottom AccID: 244 AccName: harkenus2 LSID: 112355 Status: 0 3 players online'; preg_match_all('/\[(?P<level>\d+)(?P<class>[^\]]*)\](?P<name>[^\(]+)\((?P<race>[^\)]+)\)\s*zone:\s*(?P<zone>[\S]+)\s/i', $ret, $out); print_r($out); ?>
  18. <?php $text = '123456789, 12345, xxx.sss@some.net'; $text = preg_replace("/([\w\.]+)(@)(([^\s\.]+)(\.)([^\s]*))/i","<a href=\"mailto:$1[at]$3\">$1[at]$4[dot]$6</a>",$text); //e-mail replace $text = preg_replace("/([0-9]{5})([0-9]{4})/", "$1-$2", $text); //zip code replace echo $text; ?>
  19. <?php $x = ':White Spray :80.00 :1 :80.00:Blue Spray :70.00 :1 :70.00'; $item_count = substr_count($x, ':') / 4; echo $item_count; ?>
  20. try <?php function xxx(){ $args = func_get_args(); foreach ($args as $a){ echo $a, "<br />\n"; } } xxx('sasa','aaa','bbb',5); ?>
  21. string
  22. try <?php $quote = "Now is the time for all good men to come to the aid of their country."; preg_match_all("/\st[^\s]*/", $quote, $regs); print_r($regs); ?>
  23. can you post example of $strCart
  24. can you echo xhtml_convert($_POST['comment']); before if
  25. try <?php $x = <<<eof <table border="0" align="center" cellpadding="0" cellspacing="0" class="ps_ListItem_TABLE"> <tr> <td width="120" align="center" valign="middle" class="ps_ListItem_TD-Pic"> <a href="__BlurbProductURL__"><img src="__BlurbPicURL__" border="0" class="ps_ListItem_IMG">[/url] </td> <!-- <p class="Style_1"> </p> --> <td width="365" align="left" valign="top" class="ps_ListItem_TD-Desc"> <a href="__BlurbProductURL__" class="ps_ListItem_Title_A"> <p class="ps_ListItem_Title_P">MyKeyword</p> [/url] <p class="ps_ListItem_Body_P">__BlurbDesc__</p> <!-- <p class="Style_1"></p><p class="SomeOtherClass"></p> --> <!-- b <p class="ps_ListItem_Title_P">MyKeyword</p> --> </td> </tr> </table> eof; preg_match('/^(.*)(<!--.*?(?!-->)MyKeyword.*?-->)(.*)$/s', $x, $out); print_r($out); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.