Jump to content

Confidence

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by Confidence

  1. Hi guys, my googling for "moneybookers API", "moneybookers PHP" ended up with crappy results, with people looking for programmers. Now i want to do this myself, but i cannot find any good source to start....and my email to moneybookers about this issue is still unanswered for 4 days. anyone did anything like thaT? any examples, sources? regards
  2. hi, i made my own page, but when i do an insert using mysql, jquery and php, the arabic text does not show properly it is a comments page. here is the DB structure CREATE TABLE IF NOT EXISTS `app_comments` ( `comment_id` int(20) NOT NULL auto_increment, `comment` text NOT NULL, `user_id` int(20) NOT NULL, `comment_date` date NOT NULL, `app_id` int(20) NOT NULL, PRIMARY KEY (`comment_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ; here is the jquery piece that transfers to php code. function submit_comment(){ $(".post_comments_button").click(function() { var post_comments = $('.post_comments').val(); var app_id = $('#app_id').val(); //alert (app_id); if(confirm('Add Comment?')) { var string = "task=add_comment&app_id=" + app_id + "&comment="+post_comments; $.ajax({ url : "appajax.php", type : "POST", data : string, success : function(data) { alert(data); window.location.reload(true); } }); } /**/ }); } and here is the acutal insert code in php $new_appquery = 'INSERT INTO app_comments (comment, user_id, app_id,comment_date) VALUES ("' . $comment . '",' . $user_id . ', ' . $app_id . ',NOW());'; and the actual problem is, the arabic text shows like this in my application: how can i solve this issue?
  3. Hi guys, i have an array of data, with customers and their pics. something like: something like my goal is to: 1. go through the array and download all the pics, with names like customerid.tiff 2. when done renaming, make a zip file ON-THE-FLY 3. download the zip file to my PC. i know i can use file_put_contents and things like that, but i am not able to really connect the dots, especially the zipping of them all on the fly.....anyone has an idea on this?
  4. if($GLOBALS["HTTP_RAW_POST_DATA"]){ $vars = explode(';',$GLOBALS["HTTP_RAW_POST_DATA"]); $permalink = $vars[1]; $action = $vars[0]; if(strlen($permalink) <= 0){ echo "no permalink sent"; return false; } if(strlen($action) <= 0){ echo "No transaction-ID sent"; return false; } echo 'provider-1'; }else{ echo "No Data sent."; return false; } can someone tell me, how do i test the different cases of this code? i tried something like function post_data($url, $data) { $params = array('http'=>array('method'=>'POST', 'content'=>$data)); $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); $response = @stream_get_contents($fp); //echo $response; return $response; } echo post_data('http://localhost/mfe/ocr/index.php','4345;naswa'); but i get all the time: No Data sent.
  5. Hi guys, my goal is to send a string from one page (htmlsend.php) to another (htmlreceive.php)....the data should be sent as $_POST['nc']....... if you wonder why, it a proof of concenpt, for more complex functionality as soon as this works. i made some code, but it is not working properly....would be cool if someone helps me point out the error cause. htmlsend.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $data='this is my data to send'; function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'POST', 'nc' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url"); } return $response; } echo do_post_request("http://localhost/jquery/htmlreceive.php", $data); ?> htmlreceive.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); echo '<pre>'; print_r($_POST); echo '</pre>'; $receive=$_POST['nc']; echo 'incoming message '.$receive; and this is the error i get when calling htmlsend.php Array ( ) Notice: Undefined index: nc in D:\Apache2\htdocs\jquery\htmlreceive.php on line 7 incoming message
  6. hi i have cascading select lists (1 select list gets generated based on choice of higher one...like country-> city) and i want user interaction blocked until i get the data from database i use jquery with blockUI...and it is added in header too....but it is not working....it does not block page when i chose something....what is wrong with my code? 1. $('#provider').change(function() { 2. $.blockUI(); 3. $('#tarif').load("ajax/order.php?atask=gettarifs", { 4. 'selectprovider' : $('#providerselect').val(), 5. 'kwhforajax' : $('#kwhforajax').val(), 6. 'current' : $('#current').val(), 7. 'zip' : $('#zip').val() 8. }); 9. $.unblockUI(); 10. });
  7. thanks guys. well if i have to check if it is same each time, then i am doing the calculation again which consumes resources...or not?
  8. hi guys, i have the following function //getting all providers function getAllProviders($tarifarray) { $i = 0; $provider_array = array (); foreach ( $tarifarray ['tarifarray'] as $key => $val ) { $energyprovider = $val ['versorgerName']; $providerid = $i; $temparray = array ($energyprovider => $providerid ); $provider_array = array_merge ( ( array ) $provider_array, ( array ) $temparray ); $i ++; } return $provider_array; } and it is recalled in many cases with the same result....how can i configure it so it caches the return value? unless it changes.
  9. hi guys, i want to transfer a php array through jquery to another php file as an input paramter, for processing....so i do in first php file $tarif_json=json_encode($tarif_data ['provider']); then i put it in a hidden form field <input type="hidden" name="json" id="json" value=" <?php echo $tarif_json ;?>" > and then i pass it to jquery to pass to another php page: $('#tarif').load("ajax/order.php?atask=gettarifs", { 'json' : $('#json').val() }); but when i debug with firebug in console view, to view ajax processes, i see json is empty under POST. what is the problem here? and is there another way to send the array to the other php page? thanks in advance.
  10. hi, if i have an array like this Array ( [customers] => Private [tariffarray] => Array ( [0] => Array ( [provider] => EnerGen Süd eG [tarifName] => Privattarif [topseller] => ) [1] => Array ( [provider] => energiehoch3 GmbH [tarifName] => Strom³ [topseller] => ) [2] => Array ( [provider] => Energy2day GmbH [tarifName] => RegioPlus50 [topseller] => 1 ) } } and i want to move the element with [topseller] => 1 to the top (position 0)...something like $myarray ['tariffarray'][0] how do i do that?
  11. thanks a lot. looks a lot simpler...i will adjust it to my needs.
  12. well what is meant is dropdown lists not menus, so i probably expressed it wrong in first dropdown list there are the telephone prvoiders. then when i chose one of them (say tnt-phones) i would get in the second dropdown list all of it tariffs ( for example Cheap Famiy) and then i get the price of this tariff shown 1.99 this is what i managed today to make, to gain something close to this...but i am not satisfied with it, it looks unclean and without a concept. first the index.php showing everything <html> <head> <script src="javascript/jquery-1.4.js" type="text/javascript"></script> <script src="javascript/selects.js" type="text/javascript"></script> </head> <body> <form method="post" action="#"> <p><label>provider: <select id="provider" name="provider"> <?php $provider_array = array('22' => 'tnt-phones', '23' => 'Megatelephone', '24' => 'helloephones'); foreach ($provider_array as $key => $value) { echo ('<option value="' . $key . '">' . $value . '</option>'); } ?> </select></label> <label>tarif: <select id="tarif" name="tarif"> </select></label></p> </form> </body> </html> then the jquery -based js, selects.js window.onload=initCs; var request = false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { request = false; } } @end @*/ if (!request && typeof XMLHttpRequest != 'undefined') { request = new XMLHttpRequest(); } function fillSelect(provider) { var url = "tarife_ajax.php?provider=" + escape(provider); request.open("GET", url, true); request.onreadystatechange = go; request.send(null); } function go() { if (request.readyState == 4) { if (request.status == 200) { var response = request.responseText; var list=document.getElementById("tarif"); var tarifs=response.split('|'); for (i=1; i<tarifs.length; i++) { var x=document.createElement('option'); var y=document.createTextNode(tarifs[i]); x.appendChild(y); list.appendChild(x); } } } } function initCs() { var provider=document.getElementById('provider'); provider.onchange=function() { if(this.value!="") { var list=document.getElementById("tarif"); while (list.childNodes[0]) { list.removeChild(list.childNodes[0]) } fillSelect(this.value); } } fillSelect(provider.value); } and finally the Ajax file and php processing file. tarif_ajax.php <?php function doIt ($provider) { switch ($provider) { case "22": return array( 'Cheap family', 'Cheap single', 'Cheap family plus', 'Xtra time'); break; case "23": return array( 'Cheaper XL'); break; case "24": return array( 'call me XL', 'we call 15%'); break; } } $provider = @$_GET['provider']; $tarifs = doIt($provider); foreach ($tarifs as $tarif) { echo '|' . $tarif; } ?>
  13. how can i get something like this here http://www.javascripttoolbox.com/lib/dynamicoptionlist/ <script type="text/javascript"> var names = new DynamicOptionList(); names.addDependentFields("sex","names"); names.forValue("boy").addOptions("Matt","Bob","Joe","Bill","John"); names.forValue("girl").addOptions("Jane","Angie","Jennifer","Amy","Sue"); names.forValue("boy").setDefaultOptions("Joe"); </script> but instead of the static options (boy, girl...etc)...the data will be coming from a php function as an array...looking like this. where in first box i have phonecompany and second i have tariff name and when both are selected, price is shown as a result.
  14. thanks ohdang, but how is the second dropdown list then generated? i see only one (first) list looking at your solution.
  15. hi guys, let us say i have an array looking like this and so on.... i get this array from a web-service request, or query. phoneprovider represent a phone provider...and each has their own tarifs...the phoneproviders have their spefici ID . there is one single most popular tarif...of the hole array, marked as "most popular" by the value [MostPopTarif] => 1 now i want to get the following: 2 dropdown menus....and price as result. when page is open, the "default" state...is the provider on dropdown 1 on left, with the most popular tarif on second dropdown in middle and price as value on far right. and this changes dynamically when i pick another provider....etc how can i implement this? in a form or a while-loop or something?
  16. Hi guys, for my new job my boss gave me a little task of optimization that i need to research, so i hope some of u have ideas on it, the case is the following: We have a shop with around 100 000 products and around 1000 categories. When calling the "top sold" products, all the categories and products gets searched, which totally slows down the server. My task is researching all possible optimization possibilities the query looks like this somehow: $sql="select distinct pr.product_id, pr.product_tax_class_id, pr.product_image, pr.product_price, pr.product_price_ratio, pr.product_base_price_id, pd.product_name from products p, " . product_description . " pd, ". product_to_categories . " p2c, " . categories . " c where pr.product_status = '1' and cat.categories_status = '1' and pr.product_ordered > 0 and pr.product_id = pd.product_id and pr.product_id = p2cat.product_id and p2cat.categories_id = cat.categories_id order by pr.product_ordered desc, pd.product_name limit " . MAX_SHOW_BESTSELLERS; i know first that caching (APC, Memcache) would help, also setting an index, but i dunno on what column to be honest....any more ideas? Thanks in advance.
×
×
  • 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.