Jump to content

All Activity

This stream auto-updates     

  1. Yesterday
  2. Karaethon

    background-image failure

    I have a bakground-image problem, If I put the image info in my external style sheet nothing will appear in the browser but if I cut&paste it into the body tag it works perfectly. NO CHANGE IN CODE! <body class='startup body' style='background-image: url("./img/coins.png"), url("./img/coins.png"); background-attatchment: scroll; background-position: left, right; background-size: 10vw; background-repeat: repeat-y; background-color: black;'> Works perfectly but.. body{ background-image: url("./img/coins.png"), url("./img/coins.png"); background-attatchment: scroll; background-position: left, right; background-size: 10vw; background-repeat: repeat-y; background-color: black; } Does not. WHY?!? ARGHHH Can anyone explain or figure out if I'm doing something wrong?
  3. SamMajece

    class, static and instance methods in Python - how to use

    On https://trymobilespy.com/hack-phone-send-text-messages/ you can read more about hacking phones. It means a lot these days
  4. NotionCommotion

    Cannot send large TLS packages over socket

    This is a more concise version. Notice how the data received by the server adds up to 22,176 and not my expected 100,000, and the write:errno=32 at the end of the client? If you want, please change is the path in the server to your cert/key and the IP the client is pointing your server and try it out. Thanks PS. Smaller strings works great. Strings of this size works great if both the client and server is on the same machine. TCP instead of TLS on multiple machines works great. Unfortunately, these are not my requirements. <?php ini_set('display_startup_errors', '1'); ini_set('display_errors', '1'); error_reporting(E_ALL); require 'vendor/autoload.php'; $loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server('', $loop); $socket = new React\Socket\SecureServer($socket, $loop, ['local_cert' => 'cert_with_priv_key.pem'] ); $socket->on('connection', function (React\Socket\ConnectionInterface $connection) { $connection->on('data', function ($data) {echo("onData: ".strlen($data).PHP_EOL);}); $connection->on('error', function (\Exception $e) {echo("onError: ".$e->getMessage().PHP_EOL);}); $connection->on('close', function() {echo("onClose".PHP_EOL);}); $connection->on('end', function() {echo("onEnd".PHP_EOL);}); $connection->on('drain', function() {echo("onDrain".PHP_EOL);}); $connection->on('pipe', function() {echo("onPipe".PHP_EOL);}); }); $socket->on('error', function (\Exception $e) {echo('onServerError: '.$e->getMessage().PHP_EOL);}); $loop->run(); [michael@example wireshark]$ php server.php onData: 1008 onData: 1008 onData: 1008 onData: 2016 onData: 2016 onData: 2016 onData: 1008 onData: 3024 onData: 3024 onData: 3024 onData: 3024 onEnd onClose michael@rpi:~/test $ printf '=%.0s' {1..100000} | openssl s_client -connect 12.345.67.890:1338 CONNECTED(00000003) depth=0 C = XX, L = Default City, O = Default Company Ltd, CN = example.net verify error:num=18:self signed certificate verify return:1 depth=0 C = XX, L = Default City, O = Default Company Ltd, CN = example.net verify return:1 --- Certificate chain 0 s:/C=XX/L=Default City/O=Default Company Ltd/CN=example.net i:/C=XX/L=Default City/O=Default Company Ltd/CN=example.net --- Server certificate -----BEGIN CERTIFICATE----- MIIEODCCAqACCQCzx57HUSzlRDANBgkqhkiG9w0BAQsFADBeMQswCQYDVQQGEwJY WDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBh bnkgTHRkMRowGAYDVQQDDBFncmVlbmJlYW50ZWNoLm5ldDAeFw0xOTA2MTIxNjM0 MzZaFw0yMDA2MTExNjM0MzZaMF4xCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZh dWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxGjAYBgNVBAMM EWdyZWVuYmVhbnRlY2gubmV0MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKC AYEAxGarBrx3JhDiEq5VVwbEFTY/GHLRnqD9X1Cti8l4s+dbdqHbr0gpyXS0DIF+ xiH1RHAkyw3Nzixf0vEoRRwOaRmkYk9uFTTOFDMNWEv00ZVzhjgCgxYWHBna4KQ+ S3lRpM8wlMPlpeqbjq0LsvfTO1rr/pSQ6Ml34tXVWRvrOjZeaEl4yV0LFzInbHo9 FlsABnmuAuRSD5gCMGIqiVnpChF4Cbu1WrEPi9LlID3zvXh7kED9EjFYDeaSUUwf X/0AN4LgFuo1qj/iQ4KEDbAMo7L6dTN4AupYWatzTA1fK2K6AGYvYdnjTrNNbomZ hOSNwlZfb9SD9/S5aQDcGkMyzCzb7svSYKvx5b5+XpxJLI1daDbidstrLg3DvEfp GcGyOfLAu7ZOfgkZaeOZsFZj3MLQrzSlBFOZ+DYVEf0aq8iTvVt+mrp6MlncU0FL UHngtmD7ZTJmFEgtbeUbrY/QwHvAQOCd85/0wbUf/5esBJKiiaNstKY7nJJ9gwsl kF8FAgMBAAEwDQYJKoZIhvcNAQELBQADggGBAK8b7Eqo5GTDV1vgoJCl/SUUjPey DnakNZ5rVGSmTDntgS7p1N9BaCS5JbRQkwDhRcRaGua6jH68uiAOlp03C+qZHERJ kZOtHOhK+8Uetn2dD3G80l8OXRmAPLoJ7yEt+wBfohrC8TBScq+e8cjbCkq2lEKd 9BAFFj21dlv8gO/f8QMZjyVsrjLu4Dn1Pjlos3X8jXNNUzVRi2qtA9bLT+ldEkc6 9mcQpYVq2rX+b8uEwFqy26HEvbMjiQ7F8ocC5Kz0RrMMfnJWfELysTXwbF9IvZF1 8d1IKVY4PdhLi7ZLxtAiaUaA3u0zimPDHrlUtuu99v7mbnZ5qVYj0ekMGJ1bRmnb bhfMqH34L2oSPpQTr9aYpuTOjpTR8juCflvcy0SUO2rinTeJK7BBWLVEhLi5JZ7v Q2F/Lc2aP+Wot4RtvYpooBi/lB9TqhsfdWOdKEmS3fLFpNLEh4y2bNs8ENvDDtGL tA1N791c156ih3i0Xdl7hiBV1CTwCoV1GCjyYw== -----END CERTIFICATE----- subject=/C=XX/L=Default City/O=Default Company Ltd/CN=example.net issuer=/C=XX/L=Default City/O=Default Company Ltd/CN=example.net --- No client certificate CA names sent Client Certificate Types: RSA sign, DSA sign, ECDSA sign Requested Signature Algorithms: RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA224:DSA +SHA224:ECDSA+SHA224:RSA+SHA1:DSA+SHA1:ECDSA+SHA1 Peer signing digest: SHA512 Server Temp Key: ECDH, P-256, 256 bits --- SSL handshake has read 1908 bytes and written 431 bytes Verification error: self signed certificate --- New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384 Server public key is 3072 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : ECDHE-RSA-AES256-GCM-SHA384 Session-ID: ADECAF1B1EB79A9A8B2E8C4010E7E3DCAE4C22BB8905826F24D0FEDB3CFFB192 Session-ID-ctx: Master-Key: 19C4733CD92428AF59D5A965F8BAC319C60486304365693173364DE2E37FFB6A710B5600A8E4B434FEC79DD0A734EFF8 PSK identity: None PSK identity hint: None SRP username: None TLS session ticket lifetime hint: 300 (seconds) TLS session ticket: 0000 - 4a 69 06 8e b1 d9 09 da-7a 37 58 74 d6 c3 1a 12 Ji......z7Xt.... 0010 - ee c1 8b 76 ad 75 43 b3-ab 8d 24 cf 85 31 38 60 ...v.uC...$..18` 0020 - 66 f6 b3 3a 42 78 0d 55-fe 58 dc 75 1a 0e 9d 4e f..:Bx.U.X.u...N 0030 - 93 5f cb 71 22 46 03 4a-af a7 43 e5 a5 b8 f5 dc ._.q"F.J..C..... 0040 - 88 88 3f 42 54 19 f4 01-64 9d bd 6b 92 20 7d 86 ..?BT...d..k. }. 0050 - bd 5d aa a6 62 72 b1 74-d7 58 bc 86 ee 13 84 07 .]..br.t.X...... 0060 - a8 3b 00 bc 0f 16 88 4c-98 fd 0a 63 e6 a5 1e f4 .;.....L...c.... 0070 - 8f e9 cf eb 0e c0 c6 a8-25 bf 4f 0c 2c ff 71 e3 ........%.O.,.q. 0080 - 70 2d f4 2f 30 bd c0 98-ec 29 6c 76 72 e4 fe 45 p-./0....)lvr..E 0090 - dd 61 94 90 c6 5d 0f 51-ca 4b 66 19 cb 13 27 b4 .a...].Q.Kf...'. Start Time: 1561067011 Timeout : 7200 (sec) Verify return code: 18 (self signed certificate) Extended master secret: no --- write:errno=32 michael@rpi:~/test $
  5. NotionCommotion

    Cannot send large TLS packages over socket

    Yes, I see the smaller chunks. If the client and server is on the same machine, it appears the chunks can be much larger. Regarding what I am witnessing: When using the openssl s_client on the RPi to send a long string to the VPN php socket server, the RPi oppenssl s_client complains with write:errno=32 which I believe is a broken pipe. When using the openssl s_client on the VPN to send a long string to the VPN php socket server, the VPN oppenssl s_client doesn't appear to complain but the string is not received and the VPN server just shows the client as closing. When using the PHP client on the RPi to send a long string to the VPN php socket server, the RPi PHP client doesn't appear to complain but the string is not received and the VPN server just shows the client as closing. When using the PHP client on the VPN to send a long string to the VPN php socket server, the VPN PHP client complains with Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 89784032 bytes) in ..WritableResourceStream.php on line 150 and the VPN server just shows the client as closing. An actually needed string is 17485. When ran on the same machine, all appears good, however, when on different machines, no displayed error but nothing set.
  6. I know only slightly more about SOAP than a squirrel, but I believe normally these things work by you providing a WSDL for SoapClient to read from.
  7. kicken

    Cannot send large TLS packages over socket

    Can you clarify what exactly happens? If you mean that the larger data segments are split into smaller chunks than that's to be expected. Network packets have a maximum size (1500 bytes, less overhead typically) so large data segments have to be split across several packets before being sent. Due to the way networks work, those individual packets may arrive at different times and out of order. TCP will handle ordering them for you, but if you try and read from the socket and only some of the data has arrived you'll get what's there now then have to read again to get the rest. That means the data you write may be split across multiple data events on the receiving end.
  8. Hello dear Barand , i am trying to make sure that i have set up the MySQL use to be able to access the database via localhost? - this is pretty important! Aferward i have to try using the following code to connect to the DB <?php $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db'); /* * This is the "official" OO way to do it, * BUT wait - the $connect_error was broken until PHP 5.2.9 and 5.3.0. - so i have to make sure if i am the one that must be careful here */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $mysqli->close(); well i have to do some more test. i keep you posted - and i come back and report all the findings.
  9. Crap - I didn't even see that! Thank you - now to figure out how to get the namespace on the attribute.
  10. Your request is missing the namespace. It's not literally the name "username" that the SOAP endpoint wants to see but an element with the local name "username" in the "http://givenNamespace.com" namespace. These would all work: <functionCall xmlns="http://givenNamespace.com"> <username>...</username> </functionCall> <foo:functionCall xmlns:foo="http://givenNamespace.com"> <foo:username>...</foo:username> </foo:functionCall> Or similar versions - as long as an xmlns with the right URI is in the hierarchy.
  11. I've gotten the connection issues taken care of (as far as I can tell, it was a typo in the IP whitelist). However, I've got another "am I just totally asleep?" question. The endpoint expects these headers: POST /path/handler.asmx HTTP/1.1 Host: legit.com Content-Type: text/xml; charset=utf-8 SOAPAction: "http://givenNamespace.com/functionCall" Content-Length: 540 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <functionCall xmlns="http://givenNamespace.com"> <username>username</user> <password>password</pwd> </functionName> </soap:Body> </soap:Envelope> and this is what I get from __getLastRequestHeaders() and __getLastRequest() after my __soapCall() call: POST /path/handler.asmx HTTP/1.1 Host: legit.com Connection: Keep-Alive User-Agent: PHP-SOAP/7.2.19 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://givenNamespace.com/functionCall" Content-Length: 540 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <functionCall xsi:type="SOAP-ENC:Struct"> <username xsi:type="xsd:string">username</user> <password xsi:type="xsd:string">password</pwd> </functionName> </SOAP-ENV:Body> </SOAP-ENV:Envelope> It's been a while since I've dealt with a non-WSDL API endpoint but am I crazy that my headers should work? Because I'm getting the following error: "Server was unable to process request. ---> Handler.loginNoSession(): DB Exception: Couldn't login. ErrorCode = 0 ---> Procedure or function 'checkUserPassword' expects parameter '@User', which was not supplied." And I feel like kind of an idiot about it. I'm assuming (because it seems rather obvious) that checkUserPassword is a stored procedure that gets passed the value of the 'user' parameter submitted in the Soap call, but apparently the middleware's not recognizing that I am passing the user parameter.
  12. NotionCommotion

    Cannot send large TLS packages over socket

    Eureka! It is not the client but the server. Instead of using both my PHP server and client at the same time, I replaced one at a time with openssl s_server and openssl s_client, and found my PHP client can send the data to openssl s_server. Maybe a server side PHP configuration issue? Are there any logs which might pose some clues?
  13. NotionCommotion

    Cannot send large TLS packages over socket

    I upgraded the RPi to PHP 7.3.4-2, however, no change. I was hoping as a read how earlier versions of PHP had bug related to this. Maybe not even PHP related?
  14. I have a hosted VPS running PHP 7.3.5 and a local RPi running 7.0.33, and will refer to them as VPS and RPi. I also have the following very basic socket client and server. The server on the VPS and the client on the RPi using TCP works great and so does both the server and the client on the VPS using TLS. But when I put the server on the VPS and the client on the RPi using TLS, I can only send relatively short packages (approximately 2,600 characters). And there is no hard limit because one moment 2,628 characters works, but then a little later 2,619 will not. Does it look like something I am doing wrong or maybe upgrading PHP on the RPi will help? Thank you <?php require 'simple_common.php'; $loop = React\EventLoop\Factory::create(); $connector = new React\Socket\Connector($loop); logger("simple client is running using ".($tls?'tls':'tcp')); if($tls) { $sslContextOptions = [ 'peer_name'=> get('peer_name'), //'verify_peer'=>false, //'verify_peer_name'=>false, 'allow_self_signed'=>true, 'cafile' => get('cafile'), //Certificate Authority file used with verify_peer. Use public cert since selfsigned? //'verify_depth' not set and defaults to none //'ciphers' not used and defaults to DEFAULT //'capath'=>null, //Not needed since cafile is given //'CN_match' and 'SNI_server_name' are depreciated and peer_name should be used instead. ]; $connector = new React\Socket\SecureConnector($connector, $loop, $sslContextOptions); } $connector->connect(get('ipPort'))->then(function (React\Socket\ConnectionInterface $connection) use ($loop) { logger("onConnection"); setEvents($connection, 'client'); $string=str_repeat(substr(str_repeat('0123456789',10),0,-1), 26).'023456789023456789023456789023456789023456789023456789'; logger("write strlen: ".strlen($string)); logData('write', $string); $connection->write($string); }); $loop->run(); <?php require 'simple_common.php'; $loop = React\EventLoop\Factory::create(); logger("simple server is running using ".($tls?'tls':'tcp')); $socket = new React\Socket\Server(get('ipPort'), $loop); if($tls) { $sslContextOptions = [ 'local_cert' => get('local_cert'), //local certificate file w/ or w/o private key 'local_pk' => get('local_pk'), //Only needed if private key is not in local_cert //'passphrase' not set as local_cert is not encoded //'capture_peer_cert'=>true, //a peer_certificate context option will be created containing the peer certificate //'capture_peer_cert_chain'=>true, //a peer_certificate_chain context option will be created containing the certificate chain. //'SNI_enabled'=>true, //server name indication will be enabled. Enabling SNI allows multiple certificates on the same IP address. //'disable_compression'=>true, //disable TLS compression. This can help mitigate the CRIME attack vector. //'peer_fingerprint'=>[] //A hash or array of hashes which the remote certificate digest must match. ]; $socket = new React\Socket\SecureServer($socket, $loop, $sslContextOptions ); } $socket->on('connection', function (React\Socket\ConnectionInterface $connection) use ($loop) { logger('onConnection'); setEvents($connection, 'server'); $loop->addPeriodicTimer(1, function ($timer) use ($connection) { $data='Hello!'; logData('write', $data); $connection->write($data); }); }); $socket->on('error', function (\Exception $e) { logger('onServerError: '.$e->getMessage()); }); $loop->run(); <?php function setEvents($connection, string $type){ $connection->on('data', function ($data)use($type) { static $totalLng=0; $curLng=strlen($data); $totalLng+=$curLng; logger("$type onData: current: $curLng total: $totalLng"); logData('read', $data); }); $connection->on('error', function (\Exception $e)use($type) { logger("$type onError: ".$e->getMessage()); }); $connection->on('close', function()use($type) { logger("$type onClose"); }); $connection->on('end', function()use($type) { logger("$type onEnd"); }); $connection->on('drain', function()use($type) { logger("$type onDrain"); }); $connection->on('pipe', function()use($type) { logger("$type onPipe"); }); } function emptyLog($type){ $f = @fopen(get($type), "r+"); if ($f !== false) { ftruncate($f, 0); fclose($f); } } function logData($type, $string){ file_put_contents(get($type), $string, FILE_APPEND); } function logger($msg){ echo($msg.PHP_EOL); syslog(LOG_INFO, $msg); } function get($name){ $map = [ 'ipPort'=>'', 'peer_name'=>'tapmeister.com', 'cafile'=>'test_ss_crt.pem', //Use public cert since selfsigned? Why does even test_ss_csr.pem work? 'local_pk'=>'test_ss_key.pem', 'local_cert'=>'test_ss_crt.pem', //Why does even test_ss_csr.pem work? 'read'=>'raw_read_stream.log', 'write'=>'raw_write_stream.log', 'tls'=>true, ]; if(!isset($map[$name])) exit("Invalid name $name"); return $map[$name]; } ini_set('display_startup_errors', '1'); ini_set('display_errors', '1'); error_reporting(E_ALL); require 'vendor/autoload.php'; $tls=$argv[1]??get('tls'); emptyLog('write'); emptyLog('read');
  15. Hello dear Barand , first of all many thanks for the reply and your ideas and the sharing of ideas and insights. well i am so thankful that you gave me the hint several days. note: at the moment i am not at home - i am just traveling - and i have no access on the server - but as soon as i am back home i will do the tests on the server and i wll check some words regarding the installation: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 -installed. There are several wordpress website running on server. I have checked this all one week ago, In the phpinfo(); what do you suggest - should i ask my serveradmin that he will update & upgrade the whole system - in order to have a modern system... And then i run the mysqli_error_(function)!? I love to hear from you mysqli_error() function / mysqli::$error The mysqli_error() function / mysqli::$error returns the last error description for the most recent function call, if any. Syntax: Object oriented style string $mysqli->error; Procedural style string mysqli_error ( mysqli $link ) Parameter: Name Description Required/Optional link A link identifier returned by mysqli_connect() or mysqli_init() Required for procedural style only and Optional for Object oriented style Usage: Procedural style mysqli_error(connection); the Parameter: Name Description Required/Optional connection Specifies the MySQL connection to use. Required Return value: A string that describes the error. An empty string if no error occurred. Version: PHP 5, PHP 7 Example of object oriented style: <?php $mysqli = new mysqli("localhost", "user1", "datasoft123", "hr"); /* check connection */ if ($mysqli->connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit(); } if (!$mysqli->query("SET a=1")) { printf("Errormessage: %s\n", $mysqli->error); } /* close connection */ $mysqli->close(); ?> Copy Output: Errormessage: Unknown system variable 'a' Example of procedural style: <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } if (!mysqli_query($link, "SET a=1")) { printf("Errormessage: %s\n", mysqli_error($link)); } /* close connection */ mysqli_close($link); ?> Copy Output: Errormessage: Unknown system variable 'a' Example: <?php $con=mysqli_connect("localhost","user1","datasoft123","hr"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Perform a query, check for error if (!mysqli_query($con,"INSERT INTO employees (First_Name) VALUES ('David')")) { echo("Errorcode: " . mysqli_errno($con)); } mysqli_close($con); ?> Copy Sample Output: Errorcode: 1146 and dear Barand - i am happy bout your ideas regading the comparison - and for the sharing of the ideas: some words regarding the installation: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 -installed. There are several wordpress website running on server. I have checked this all one week ago, In the phpinfo(); what do you suggest - should i ask my serveradmin that he will update & upgrade the whole system - in order to have a modern system... And then i run the mysqli_error_(function)!? I love to hear from you
  16. OTCommerce

    Taobao API and 1688.com

    We provide API for integration of Taobao / Tmall and 1688.com showcase and search on the site. Any CMS is supported. More details on https://key.otcommerce.com/
  17. SkyRanger

    Issue with PHP

    I don't know what to say and I wish I could send something your way for a thank you for your assistance This part of my project has been a thorn in my side for weeks. If i get the $$$ to be able to send you something I definitely will. If it wasn't for people like you on here and the others who offer there time and assistance with very little in return I thank you. I will be at least adding you to credits of the program so people know. I have coming to this site for help for over 14 yrs and I still remember you were the first on then to help me and I will never forgot. Again thank you.
  18. Last week
  19. I've implemented the function on my testing server and it works very well. I appreciate so so much all of the time and effort you have provided to support my needs. It's been a wonderful first time experience using this platform for help.
  20. 1. The now extinct mysql library and the mysqli library are two completely different animals. 2. Forget about mysqli and use PDO. +---------+-------------+ | mysql | dodo | | mysqli | donkey | | PDO | racehorse | +---------+-------------+
  21. Hello dear experts and user of PHPFreaks, first of all: i have plenty of issues - a whole bunch of issues on a Server - i need to digg deeper into all things regarding creating a healthy db-connection. Therefore i need to learn all about the script - mysql_connect_error... see below. i have gathered some information - in order to think about it - and to share the ideas ... so i hopefully will learn and solve my issues. well the mysql_connect_error-script is a great help: It returns a string description of the last connect error ( see more infos here: https://www.php.net/manual/en/mysqli.connect-error.php ). The mysqli_connect_error() function returns the error description from the last connection error, if there is any error-note. the return value are the following ones: a. A string that describes the error. b. an empty string if no error occurred. at least this goes for the Version: PHP 5, PHP 7 well - if we run the code below we can get the info bout the option to connect to the db. What if we run this as a mysql-test-script, and what if we will want to convert it to use mysqli? Can this be done by changing mysql _query($sql); to mysqli _query($sql); ? <?PHP // the test-script that we are running. $DB["dbName"] = "emails"; $DB["host"] = "localhost"; $DB["user"] = "root"; $DB["pass"] = ""; $link = mysql_connect($DB['host'], $DB['user'], $DB['pass']) or die("<center>Howdy - be aware; There a thing happenede - An Internal Error has Occured. Please report following error to the webmaster shot him a mail now.<br><br>".mysql_error()."'</center>"); mysql_select_db($DB['dbName']); // end header connection part // function from a functions file that I run a mysql query through in any page. function executeQuery($sql) { $result = mysql_query($sql); if (mysql_error()) { $error = '<BR><center><font size="+1" face="arial" color="red">An Internal Error has Occured.<BR> The error has been recorded for review</font></center><br>'; if ($_SESSION['auto_id'] == 1) { $sql_formatted = highlight_string(stripslashes($sql), true); $error .= '<b>The MySQL Syntax Used</b><br>' . $sql_formatted . '<br><br><b>The MySQL Error Returned</b><br>' . mysql_error(); } die($error); } return $result; } // example query ran on anypage of the site using executeQuery function $sql='SELECT auto_id FROM friend_reg_user WHERE auto_id=' .$info['auto_id']; $result_member=executequery($sql); if($line_member=mysql_fetch_array($result_member)){ extract($line_member); } else { header("location: index.php"); exit; } ?> If we do replace mysql_* with mysqli_* then we will have to bear in mind that a whole load of mysqli_* functions need the database link to be passed. E.g.: the following ones. mysql_query($query) becomes mysqli_query($link, $query) I.e., lots of checking required. on the other hand side: is it suffice if we replace every mysql_* function call with its equivalent mysqli_*, when we will use the procedural API (note: there is some code based on the MySQL API, which is a procedural one - at least afaik), To help with that, the The MySQLi Extension Function Summary-manual is definitely something that will prove helpful. We can do the following: we have the following options to do that: - mysql_connect will be replaced by mysqli_connect - mysql_error will be replaced by mysqli_error and/or mysqli_connect_error, depending on the context - mysql_query will be replaced by mysqli_query ,,,, and so on and so forth. Note: For some functions, we may need to check the parameters very very carefully: Maybe there are some differences here and there -- but not that many differences. Belive me. Both mysql and mysqli-codes are based on the same library ( the great and powerful libmysql ; at least for PHP-version <= 5.2) Usage - for instance: with mysql, we have to use the mysql_select_db once connected, to indicate on which database we want to do our queries mysqli, on the other side, allows us to specify that database name as the fourth parameter to mysqli_connect. what do you think bout this.. love to hear from you
  22. Like so: $map = []; // charge both PST and GST $map['wholesale_customer'] = 'WholesalePSTGST'; $map['wholesale_silvia_silver'] = 'WholesalePSTGST'; $map['wholesale_silvia_gold'] = 'WholesalePSTGST'; $map['wholesale_silvia_premium'] = 'WholesalePSTGST'; $map['wholesale_silvia_union'] = 'WholesalePSTGST'; // charge only GST $map['wholesale_pst_exempt'] = 'WholesalePSTExempt'; $map['wholesale_silvia_silver_pst_exempt'] = 'WholesalePSTExempt'; $map['wholesale_silvia_gold_pst_exempt'] = 'WholesalePSTExempt'; $map['wholesale_silvia_premium_pst_exempt'] = 'WholesalePSTExempt'; $map['wholesale_silvia_union_pst_exempt'] = 'WholesalePSTExempt'; // charge neither $map['wholesale_tax_exempt'] = 'WholesaleZeroTax'; $map['wholesale_silvia_silver_tax_exempt'] = 'WholesaleZeroTax'; $map['wholesale_silvia_gold_tax_exempt'] = 'WholesaleZeroTax'; $map['wholesale_silvia_premium_tax_exempt'] = 'WholesaleZeroTax'; $map['wholesale_silvia_union_tax_exempt'] = 'WholesaleZeroTax';
  23. I must be missing something because I cannot see the point in having a chain of functions which convert one cryptic string value into another one. Eventually you are going to have to to decide on a YES/NO value as to whether a tax is included or not. Why not go straight there? Just my 0.02 worth. I'll shut up now.
  24. Barand

    Issue with PHP

    Correction to above. Did some further testing and repetetive adding/removing causes errors. Fixed by having "x" and "y". X is used for the id sufficies and is never decremented (thus maintaining uniqueness like mysql auto_increments). Y is used as the field counter and is incremented and decremented. Revised code <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript"> var max_fields = 10; //Maximum allowed input fields var x = 1; //Initlal input field id suffix is set to 1 var y = 1; //Initlal input field is set to 1 function loadOptions(x) { var select = $('#jobqueue'+x); //request the JSON data and parse into the select element var data = JSON.parse($("#jobdata").val()) //clear the current content of the select select.html(''); //iterate over the data and append a select option $.each(data, function(key, val){ select.append('<option id="' + val + '">' + val + '</option>'); }) } $(document).ready(function() { loadOptions(1); //When user click on add input button $("#add_fields").click(function(e){ e.preventDefault(); //Check maximum allowed input fields if(y < max_fields){ x++; //input field id increment y++; //input field increment //add input field $("#wrapper").append('<div><input type="hidden" name="input_array_kuemid[]" value=""/><input type="text" name="input_array_email[]" placeholder="Email Address" /> <input type="text" name="input_array_name[]" placeholder="Email Address Owner" /> <select id="jobqueue'+x+'" name="input_array_queue[]"></select><a href="javascript:void(0);" class="remove_field">Remove</a></div>'); loadOptions(x); // load options into new select object } }); //when user click on remove button $("#wrapper").on("click",".remove_field", function(e){ e.preventDefault(); $(this).parent('div').remove(); //remove inout field y--; //input field decrement }) }); </script> </head> <body> <button id="add_fields">Add</button> <br><br> <input type='hidden' id='jobdata' value='["Tech Support","AR","PNI","Shared","Mobile"]'> <div id="wrapper"> <div> <input type="hidden" name="input_array_kuemid[]" value=""/> <input type="text" name="input_array_email[]" placeholder="Email Address" /> <input type="text" name="input_array_name[]" placeholder="Email Address Owner" /> <select id="jobqueue1" name="input_array_queue[]"></select> <a href="javascript:void(0);" class="remove_field">Remove</a> </div> </div> </body> </html>
  25. no. $map is an array, with an element/line for each input/output mapping. starting what what i posted, to avoid making even more changes, add a line for each of your new role names and tax classes - $map['wholesale_silvia_silver'] = 'WholesalePSTGST'; $map['wholesale_silvia_gold'] = 'WholesalePSTGST'; ...
  26. I've already created tax rates classes and tax table rates in WooCommerce. so I don't need to calculate the tax within is function.
  27. Barand

    Issue with PHP

    I didn't test the delete bit, just he append. EDIT: Just copy/pasted my code from my above post and append (includung adding options) and the delete all work OK.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up

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.