Jump to content

joymis

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by joymis

  1. Hello, I have this code <button class="btn btn-info" onclick="BatchAsign()">Batch</button> <button class="asign_btn" onclick="Asign({a:'1', b:'2'}, this)">Asign1</button> <button class="asign_btn" onclick="Asign({a:'2', b:'6'}, this)">Asign2</button> <button class="asign_btn" onclick="Asign({a:'5', b:'4'}, this)">Asign3</button> <script> function BatchAsign(){ $.each( $('.asign_btn'), function( key, val ) { $(this).trigger( "click", ['all'] ) }); } function Asign(arr, dom, x) { if(x == 'all'){ // I want do something } } </script> When I click BatchAsign button, I want pass a extra parameters to Asign. I used console.log(x), it's display 'undefined'. How can I get string 'all' in the function Asign? thanks.
  2. Thanks for your reply. I will try this method.
  3. Hello, My web db is oracle, and in my a same page have A form, B form, C form, I used three times ajax send ABC forms to do insert data to db after three times insert data to db, can I commit only one time? thanks.
  4. Thank you for your help I tried delete old dir and then upload the same dir and files again, it is can work. but I still don't know why this happened...
  5. Hello, I have a web dirs like this / obj/ a.php b.php c.php test/ d.php Contents of these files: d.php: require_once '../obj/a.php'; a.php: require_once 'b.php'; b.php: require_once 'c.php'; then I run d.php, the log display: PHP Warning: require_once(c.php): failed to open stream: No such file or directory in /var/www/xxx/test/b.php PHP Fatal error: require_once(): Failed opening required 'c.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/xxx/test/b.php Is there something obvious I'm missing? how do include paths work in PHP? thanks.
  6. ok, thank you for your help
  7. but my OUT bind type maybe number or string or array, or have any function can get OUT bind length? class DBObj{ public function spExec($sql, $params){ $stid = oci_parse($this->con, $sql); foreach ($params as $key => &$value) { if($value == 'sp_return') // I'm not sure $len // could I use something function get OUT bind length? oci_bind_by_name($stid, $key, $r, $len); else oci_bind_by_name($stid, $key, $value); } oci_execute($stid, OCI_DEFAULT) or die($this->dbError($stid)); return $r; } } $db = new DBObj(); // maybe this return number $sql = "BEGIN :ret := aaa(:p1, :p2, :p3); END;"; $params = array(':ret' => 'sp_return', ':p1' => '1', ':p2' => '2', ':p3' => '3'); $result = $db->spExec($sql, $params); echo $result; // maybe this return string or array $sql = "BEGIN :ret := bbb(); END;"; $params = array(':ret' => 'sp_return'); $result = $db->spExec($sql, $params); echo $result;
  8. Hello, I have some code like this $sql = "BEGIN :ret := sifw.sf_todoList('38000', '', 'all'); END;"; $stid = oci_parse($conn, $sql); oci_bind_by_name($stid, ':ret', $r); oci_execute($stid); I got a error : 「ORA-06502: PL/SQL: numeric or value error: character string buffer too small」 if I change oci_bind_by_name($stid, ':ret', $r) to oci_bind_by_name($stid, ':ret', $r, 200), it's work but I don't want to set a current length, because I do not know OUT bind type and length. how can I fixed this error? Thanks
  9. because it's height and scrollbar always out of control and let me crazy. It looks like I will have no choice.
  10. Hello, I have a page https://domainA.com/test.php and I hope embed an external page like http://domainB.com/test.php into https://domainA.com/test.php but I don't want to use iframe or frame In addition to these two methods there are other ways? thanks.
  11. Thank for your help, I'm not notice your main is $("#unexe_table").on("click", ".up, .down", function() {...}) not $(".up, .down").on("click", function() {...}) $("#unexe_table").on("click", ".up, .down", function() {...}) can be work thanks.
  12. Thank you for your help, I thought it would cover the original event handler my code was originally written like this, but tbody content from ajax return and I have use blockUI plugin function SearchQuery(){ $.ajax({ ...... async: false, beforeSend:function(){ $.blockUI({ css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .5, color: '#fff' }, message: '<p>Searching,please wait...</p>' }); }, success: function(response) { $("#query_content_unexe").html(response['query_content']); actOrder(); }, complete:function(){ $.unblockUI(); } }) } when I use "async: false" blockUI will not work, if I no use "async: false" up and down click will not work, so I used the function
  13. Hello, this is my code demo https://jsfiddle.net/ugkfk64o/ when I click "new" button and then click cell "c" -> "down" button, it will move 2 rows but if I don't click "new" button, I only click cell "c" -> "down" button, it's ok where is this error?
  14. ok, thank you for your help
  15. it's work. Thank you for your help.
  16. Hello, I have some html code like this <table> <thead>....</thead> <tbody id="content"> <tr> <td> <img ......> <img onclick="test()" src="1.jpg"> </td> </tr> <tr> <td><img onclick="test()" src="3.jpg"></td> </tr> <tr> <td> <img ......> <img ......> <img onclick="test()" src="2.jpg"> </td> </tr> </tbody> </table> when I onclick 3.jpg, I want get tr index is 1, and I onclick 1.jpg, I want get tr index is 0 how can I use jQuery or javascript get the tr index and no use like parentNode api? because I not sure parentNode of img must be td, maybe it's div, span, or a table. Thanks.
  17. Hello, I have some environment variables...like upload_path = 'abc/' upload_size = '5M' sys_id = 'w3c' session_time = '600' ...... I want use DB or use *.ini access these variables. whcih one is better and safe? Thanks.
  18. Hi all, I have a data like this, dept_no under_dept level 01000 01000 0 01010 01000 1 03000 01000 1 03010 03000 2 03016 03010 3 03020 03000 2 03050 03000 2 03056 03050 3 91020 91020 1 now I have a var $x = 01000, then I should get all data row, when $x = 03000, then I should get dept_no like '03%' row when $x = 03010, then I should only get dept_no = 03010 and 03016 row does anyone have good idea can tell me how can I do? thanks
  19. OK, Thank you for your help
  20. Thank you for your help and information. I learned a lot. Besides, which browsers maybe used IndexOf('/') ?
  21. Hello, I have a javascript code like this <input type="file" class="filename" onchange="myFunction(this)"> <script> function myFunction(elem) { if(elem.value.replace(/C:\\fakepath\\/g ,"").length > 20) { elem.value = elem.defaultValue; alert('The file name too long!'); return false; } else{ alert('OK'); } } </script> when I select a file, the IE11 will display two message, fisrt alert 'ok' then alert 'The file name too long!' but firefox and chrome is correct, only display 'The file name too long!' how can I do that IE11 only display one message? Thanks.
  22. joymis

    RSA decrypt error

    OK, thank you for your help, I will change to use openssl_encrypt.
  23. joymis

    RSA decrypt error

    ok, thank you very much for your explanation, now I fully understand. I tried file_get_contents() after the encrypt file still 0 byte, might it openssl_private_encrypt() has special rule? I looks php.net website, it said.. But my test file only had 24KB, is it a large data?
  24. joymis

    RSA decrypt error

    Hello justsomeguy, I had think read the entire file at once and encrypt, but I don't know why not work, this is my entire file at once code $file = fopen('test.png', "rb"); $fp = fopen('enc.png', 'w'); $x = fread($file, filesize('test.png')); fwrite($fp, public_encrypt($x)); // I got 0 byte file // fwrite($fp, $x); ==> it's work fclose($file); fclose($fp); And in my original case, I tried more method like this, but after decrypted the file size not equal original file size. $file = fopen('test.png', "r"); $fp = fopen('enc.png', 'w'); while(! feof($file)){ $x = public_encrypt(fgets($file)); fwrite($fp, $x."\n"); } fclose($file); fclose($fp); $file = fopen('enc.png', 'r'); $fp = fopen('dec.png', 'w'); while(! feof($file)){ $z[] = fgets($file); } array_pop($z); foreach($z as $v) { $aaa = explode("\n", $v); $z = private_decrypt($aaa[0]); fwrite($fp, $z); } fclose($fp); fclose($file); In addition to RSA encryption, are there more better encryption tools or method can let me reference? Thanks.
  25. joymis

    RSA decrypt error

    Hello, I have a RSA encrypt / decrypt function from google, and I try it for file upload this is my code <?php const PRIVATE_KEY = 'private_2048.key'; const PUBLIC_KEY = 'public_2048.crt'; $file = fopen('test.jpg', "r"); $fp = fopen('enc.jpg', 'w'); while(! feof($file)){ $x = public_encrypt(fgets($file)); var_dump($x); fwrite($fp, $x); } /** it's display this string(344) "CZtRordK+BC/fUJX1P2FD8Yt0217bquw....... string(344) "I9m8ZLRz1FACXVmWWlmzISS.......... string(0) "" string(344) "dp5vPnpZhEpz6K4Cmh........ string(0) "" string(344) "mT60XZEph87lOz....... string(0) "" string(0) "" string(0) "" */ fclose($file); fclose($fp); $file = fopen('enc.jpg', "r"); $fp = fopen('dec.jpg', 'w'); while(! feof($file)){ $z = fgets($file); var_dump($z); fwrite($fp, private_decrypt($z)); } /** it's display this string(1376) "CZtRordK+BC/fUJX1P2FD8Yt02.......... */ fclose($fp); fclose($file); function public_encrypt($plaintext) { $fp = fopen(PUBLIC_KEY, "r"); $pub_key = fread($fp, 8192); fclose($fp); $pub_key_res = openssl_get_publickey($pub_key); if(!$pub_key_res) { throw new Exception('Public Key invalid'); } openssl_public_encrypt($plaintext,$crypttext, $pub_key_res); openssl_free_key($pub_key_res); return(base64_encode($crypttext)); } function private_decrypt($encryptedext) { $fp = fopen(PRIVATE_KEY, "r"); $priv_key = fread($fp, 8192); fclose($fp); $private_key_res = openssl_get_privatekey($priv_key); if(!$private_key_res) { throw new Exception('Private Key invalid'); } openssl_private_decrypt(base64_decode($encryptedext), $decrypted, $private_key_res); openssl_free_key($private_key_res); return $decrypted; } ?> in my code, I var_dump $x and then if I decrypt and var_dump, it's work. but when I read encrypt file and var_dump $z, it's not the same $x. how can I do let $z = $x? Thanks.
×
×
  • Create New...