This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array(33) { ["HOME"]=> string(12) "/nonexistent" ["USER"]=> string(3) "www" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["QUERY_STRING"]=> string(0) "" ["REQUEST_METHOD"]=> string(3) "GET" ["CONTENT_TYPE"]=> string(0) "" ["CONTENT_LENGTH"]=> string(0) "" ["SCRIPT_NAME"]=> string(1) "/" ["REQUEST_URI"]=> string(1) "/" ["DOCUMENT_URI"]=> string(1) "/" ["DOCUMENT_ROOT"]=> string(8) "/var/www" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_SCHEME"]=> string(4) "http" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_SOFTWARE"]=> string(11) "nginx/1.9.2" ["REMOTE_ADDR"]=> string(8) "10.0.2.2" ["REMOTE_PORT"]=> string(5) "49342" ["SERVER_ADDR"]=> string(9) "10.0.2.15" ["SERVER_PORT"]=> string(2) "80" ["SERVER_NAME"]=> string(9) "localhost" ["REDIRECT_STATUS"]=> string(3) "200" ["SCRIPT_FILENAME"]=> string(18) "/var/www/index.php" ["HTTP_HOST"]=> string(9) "localhost" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0" ["HTTP_ACCEPT"]=> string(74) "text/html,application/xh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array(32) { ["HOME"]=> string(12) "/nonexistent" ["USER"]=> string(3) "www" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["QUERY_STRING"]=> string(0) "" ["REQUEST_METHOD"]=> string(3) "GET" ["CONTENT_TYPE"]=> string(0) "" ["CONTENT_LENGTH"]=> string(0) "" ["SCRIPT_NAME"]=> string(12) "/lorem/ipsum" ["REQUEST_URI"]=> string(12) "/lorem/ipsum" ["DOCUMENT_URI"]=> string(12) "/lorem/ipsum" ["DOCUMENT_ROOT"]=> string(8) "/var/www" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_SCHEME"]=> string(4) "http" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_SOFTWARE"]=> string(11) "nginx/1.9.2" ["REMOTE_ADDR"]=> string(8) "10.0.2.2" ["REMOTE_PORT"]=> string(5) "49585" ["SERVER_ADDR"]=> string(9) "10.0.2.15" ["SERVER_PORT"]=> string(2) "80" ["SERVER_NAME"]=> string(9) "localhost" ["REDIRECT_STATUS"]=> string(3) "200" ["SCRIPT_FILENAME"]=> string(18) "/var/www/index.php" ["HTTP_HOST"]=> string(9) "localhost" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_ACCEPT"]=> string(74) "text/html,application/xhtml+xml,app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else{ | |
$(".error").hide(); | |
clearTimeout(close_error_msg); | |
$("#form-"+pure_id).submit(function(e){ | |
e.preventDefault(e); | |
comment(pure_id); | |
}); | |
} | |
function comment(pure_id){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUERY 1: | |
INSERT INTO votes (post_id, user_id, value, date_time) | |
SELECT :pt,:ui,:v,:dt | |
FROM $table_name t | |
WHERE t.id=:pt limit 1 | |
QUERY 2: | |
INSERT INTO votes (post_id, user_id, value, date_time) | |
SELECT :pt,:ui,:v,:dt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Valid ---------------- without subdomain | |
www.example.com | |
http://example.com | |
http://www.example.com | |
https://example.com | |
https://www.example.com | |
// Valid ---------------- with subdomain | |
www.sub.example.com | |
http://sub.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT pr1.id AS user_id, | |
pr1.title AS user_name, | |
pr2.id AS liker_id, | |
pr2.title AS liker_name, | |
x.which AS which_table | |
FROM ( | |
SELECT rid, rootid, 'vote' which FROM p_likes | |
UNION ALL | |
SELECT rid, rootid, 'comment' which FROM p_comments | |
UNION ALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeWrongClass(el){ | |
el.removeClass('wrong'); | |
} | |
$(".ask_q_title_input").on('focus', function(){ removeWrongClass($(this)) }); | |
$("#qandatextarea").on('focus', function(){ removeWrongClass($(this)) }); | |
$(".make_bounty > a").on('click', function(){ removeWrongClass($('.make_bounty')) }); | |
$(".chosen-single").on('click', function(){ removeWrongClass($(this)) }); | |
$("#ask_q_tags").on('click', function(){ removeWrongClass($(this)) }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT q.type, | |
q.author_id author, | |
q.deleted, | |
q.deleter_id, | |
COUNT(DISTINCT a.id) answers_num, -- it will be 0 for answers | |
COUNT(DISTINCT v.id) votes_num | |
FROM qanda q | |
LEFT JOIN qanda a ON q.id = a.related | |
LEFT JOIN votes v on q.id = v.post_id | |
WHERE q.id = ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.parent{ | |
.child { | |
color: red; | |
} | |
} | |
/* ----------- */ | |
.parent{ | |
& .child { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a database connection: | |
First, you need to create a connection to the MySQL database using PHP. You can do this using the PHP mysqli_connect() function, which takes four arguments: the database host, the username, the password and the name of the database. | |
$conn = mysqli_connect("hostname", "username", "password", "database_name"); | |
2. Check the connection: | |
Once the connection has been established, you can check whether it was successful by using the mysqli_connect_errno() function. This will return 0 if the connection was successful, or another error code if there was an error. |
OlderNewer