[Solved] How to add pthreads to MAMP PRO PHP

This question was an XY problem and it didn’t deserve so many downvotes. The real problem how to perform a long running task while returning a response to the client so they don’t feel the app is slow The solution Using PHP-FPM and function fastcgi_finish_request Example <?php // This is the output that we return … Read more

[Solved] php need working code as example of password hashing

Follow the examples provided in PHP the Right Way under password hashing: require ‘password.php’; $passwordHash = password_hash(‘secret-password’, PASSWORD_DEFAULT); if (password_verify(‘bad-password’, $passwordHash)) { // Correct Password } else { // Wrong password } DO NOT under any circumstances “invent” your own algorithm. These are notoriously tricky to get right and unless you have a background in … Read more

[Solved] How does source code manage white space and concatenation [duplicate]

Don’t break the string up like that unless you use . to concatenate them back together! So, either: $email_body = “message from $name \n email address $visitor_email \n \n $message”; // also the whole string on one line is fine or $email_body = “message from $name \n” . “email address $visitor_email \n” . “\n $message”; … Read more

[Solved] get data from DB as range using php

For example… DROP TABLE IF EXISTS my_table; CREATE TABLE my_table (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,date DATE NOT NULL ,price INT NOT NULL ); INSERT INTO my_table VALUES (1 ,’2014-01-01′, 10), (2 ,’2014-01-02′, 10), (3 ,’2014-01-03′, 10), (4 ,’2014-01-04′, 10), (5 ,’2014-01-05′, 20), (6 ,’2014-01-06′, 20), (7 ,’2014-01-07′, 10), (8 ,’2014-01-08′, 10); SELECT … Read more

[Solved] JavaScript MySQL injection prevention [closed]

For a start, JavaScript is code that a user can actually edit using DOM tools (like inspect element) and should never be used as a mechanism to security with Databases. You should firstly start to research about prepare statements in PDO if you’re using un-trusted user input; the bind paramtter in the PDO interface automatically … Read more

[Solved] Referring to an id from url on a php page [closed]

This entirely depends on how you’ve set your page up, but just as with any HTML page you should be able to refer to: page.php#anchor Where anchor refers to an id within the page. Note the lack of / before the # solved Referring to an id from url on a php page [closed]

[Solved] header of php not working btw html? [duplicate]

header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. … Read more

[Solved] how to add this jquery to mysite [closed]

this should work … $(document).ready(function() { $(“#web”).click(function () { $(“#contweb”).stop().slideToggle(); return false; }); $(“#web”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); $(“#screen”).click(function () { $(“#contscreen”).stop().slideToggle(); return false; }); $(“#screen”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); $(“#keyboard”).click(function () { $(“#contkey”).stop().slideToggle(); return false; }); $(“#keyboard”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); }); 3 solved how … Read more

[Solved] Hundreds of buttons in one page with same name and same ids, how to differentiate?

You can do it like Braziliam way, we call it as “Gambiarra” $(‘input [type=submit]’).click(function(){ var productname = $(this).parent().find(‘.post-meta-ab a’).html(); }); PS. If you cant set a UNIQUE ID for your DOM elements, don’t use any at all. Basically for each product on you list you have this structure: <li class=”ms-tt grid_3″ data-id=”id-1″ data-type=”digital”> <div class=”m-thumb … Read more